Start here

Configuration reference

ThimbleDB authorities can be configured through code options and environment settings. Prefer code for collection layouts and indexes because it is easier to type-check and review. Keep secrets in the deployment platform’s secret store.

Code options take precedence over matching environment settings.

Authority code options

Both startNodeAuthority() and createCloudflareAuthority() accept:

OptionPurposeDefault
collectionLayoutsExplicit trie or snapshot layout by collectionTrie for collections not listed
collectionIndexesComplete declared secondary-index definitionsNo indexes
collectionsBounded Studio collection catalogueNames inferred from configured layouts and indexes
studioEnable Studio APIs and Node asset hostingfalse
studioOriginAdditional exact origin accepted for Studio mutationsLocal Node authority origin when Studio is enabled; otherwise none
readBundlesAdvertise bounded decoded point-read bundlesfalse

Common authority settings

These settings are supported by both the Node and Cloudflare authorities unless noted otherwise.

SettingPurposeDefault or requirement
THIMBLE_MASTER_KEYBase64 deployment master key with at least 32 decoded bytesRequired outside the local Node provider; local Node creates a protected key file when absent
THIMBLE_ALLOWED_ORIGINExact browser origin accepted for state-changing requestsRequired except local Node, which defaults to http://127.0.0.1:5173
THIMBLE_PREFIXApplication prefix inside the data storedemo
THIMBLE_KEY_VERSIONActive scope-key version for writes1
THIMBLE_READ_KEY_VERSIONSComma-separated historical key versions that remain readableEmpty
THIMBLE_HEAD_TTL_MSBrowser mutable-HEAD revalidation interval1000
THIMBLE_COLLECTION_LAYOUTSComma-separated `collection=triesnapshot` mappings
THIMBLE_COLLECTION_INDEXESJSON object containing the complete active index definitions{}
THIMBLE_DELETE_RETENTION_DAYSRestore window for retained deletions30
THIMBLE_DELETE_GRACE_DAYSAdditional delay before expired tombstones leave the live layout7
THIMBLE_MAINTENANCE_MODEReject normal writes while maintenance is runningfalse
THIMBLE_STUDIOEnable Studiofalse
THIMBLE_STUDIO_ORIGINAdditional exact Studio originNone, except local Node defaults to its authority origin
THIMBLE_COLLECTIONSComma-separated Studio collection catalogueEmpty
THIMBLE_READ_BUNDLESEnable the trusted-authority decoded bundle pathfalse

THIMBLE_READ_BUNDLES=true changes the read transport trust boundary. Review Security before enabling it.

Normal EnvelopeObjectStore and browser object-reader instances limit each decoded object to 16 MiB. This is a code-level safety default rather than an environment setting. Advanced direct integrations can supply an explicit maximumDecodedBytes override when constructing those wrappers.

Identity settings

Configure at least one production OIDC provider.

Microsoft Entra:

SettingPurpose
ENTRA_TENANT_IDExact Entra tenant
ENTRA_AUDIENCEAPI audience
ENTRA_REQUIRED_SCOPEOptional required delegated scope
ENTRA_REQUIRED_ROLEOptional required application role

Generic OIDC:

SettingPurpose
OIDC_PROVIDER_IDStable route-safe provider identifier
OIDC_ISSUERExact token issuer
OIDC_AUDIENCERequired audience
OIDC_JWKS_URIHTTPS JWKS endpoint
OIDC_ALLOWED_TENANTSOptional comma-separated tenant allowlist
OIDC_REQUIRED_SCOPEOptional required delegated scope
OIDC_REQUIRED_ROLEOptional required application role

At least one required scope or role must be configured for each provider. When both are set, both must be present.

Node-only runtime settings

SettingPurposeDefault
NODE_ENVProcess mode used to prohibit the local development identity in productionUnset
THIMBLE_PROVIDERObject-store adapter: local, azure, s3, or r2azure when AZURE_STORAGE_CONNECTION_STRING is set; otherwise local
THIMBLE_HOSTAuthority listen address127.0.0.1
THIMBLE_PORTAuthority listen port8787
THIMBLE_SECURE_COOKIESForce Secure session cookiestrue for cloud providers; otherwise false unless explicitly enabled
THIMBLE_SESSION_TTL_SECONDSOpaque session lifetime3600
THIMBLE_AUTH_RATE_LIMITAuthentication attempts per durable rate window5
THIMBLE_AUTH_RATE_WINDOW_MSAuthentication rate window60000
THIMBLE_SCOPE_CACHE_MAXMaximum cached scope runtimes100
THIMBLE_SCOPE_CACHE_TTL_MSScope-runtime cache lifetime900000
THIMBLE_TRUSTED_PROXY_IPSComma-separated immediate proxy addresses trusted for X-Forwarded-ForEmpty
THIMBLE_DISABLE_IP_RATE_LIMITDisable source-IP limiting when the proxy boundary cannot be verifiedfalse

Local Node settings

SettingPurposeDefault
THIMBLE_LOCAL_DATA_ROOTLocal application-object directory.thimble-data
THIMBLE_LOCAL_AUTH_ROOTLocal authentication-object directory.thimble-auth
THIMBLE_LOCAL_SECRET_ROOTLocal master-key directory.thimble-data
THIMBLE_DEV_IDENTITYEnable the loopback-only development identityfalse
THIMBLE_DEV_SUBJECTDevelopment identity subjectlocal-developer
THIMBLE_DEV_DISPLAY_NAMEDevelopment identity display nameLocal developer

The development identity requires a local provider, a non-production process, a loopback listen host, and loopback application and Studio origins.

Node provider settings

Azure Blob Storage:

SettingPurposeDefault
AZURE_STORAGE_CONNECTION_STRINGServer-only Blob Storage connection stringRequired
AZURE_STORAGE_CONTAINERData containerthimbledb
AZURE_AUTH_STORAGE_CONTAINERAuthentication container<data-container>-auth

Amazon S3:

SettingPurposeDefault
S3_BUCKETData bucketRequired
S3_AUTH_BUCKETAuthentication bucketRequired
AWS_REGIONAWS region used by the SDKus-east-1
S3_ENDPOINTOptional S3-compatible endpointAWS endpoint
S3_FORCE_PATH_STYLEUse path-style bucket addressingfalse

The AWS SDK uses its normal credential chain.

R2 through the S3 adapter:

SettingPurpose
R2_ACCOUNT_IDCloudflare account ID
R2_BUCKETData bucket
R2_AUTH_BUCKETAuthentication bucket
R2_ACCESS_KEY_IDR2 API access key ID
R2_SECRET_ACCESS_KEYR2 API secret

Prefer the native Worker bindings for the Cloudflare reference deployment.

Cloudflare bindings

BindingPurposeRequired
DBPrivate R2 data bucketYes
AUTH_DBSeparate private R2 authentication bucketYes
ASSETSStatic application and Studio assetsOptional
AUTH_RATE_LIMITERNative low-latency source-IP rate limitOptional

Cloudflare uses a one-hour session lifetime and a bounded in-memory scope runtime cache. Those values are not environment-configurable in the current Worker authority.

Maintenance command settings

These settings apply to command-line maintenance. They are not all authority runtime settings.

SettingPurpose
THIMBLE_SCOPE_IDTarget scope
THIMBLE_COLLECTIONSTarget collection list
THIMBLE_COLLECTIONSingle collection for a layout migration
THIMBLE_SOURCE_LAYOUTExisting trie or snapshot layout for a layout migration
THIMBLE_TARGET_LAYOUTReplacement trie or snapshot layout for a layout migration
THIMBLE_COLLECTION_LAYOUTSActive layout mapping
THIMBLE_RETIRED_COLLECTION_LAYOUTSRetired layouts eligible for quiescent cleanup
THIMBLE_COLLECTION_INDEXESComplete active index definitions
THIMBLE_MIGRATION_QUIESCENTConfirms writes are blocked for migration commands
THIMBLE_MAINTENANCE_QUIESCENTConfirms writes are blocked for destructive retention maintenance

Do not add THIMBLE_RETIRED_COLLECTION_LAYOUTS to a Worker and expect it to perform cleanup. Run the documented maintenance command in a controlled environment with the matching provider credentials and master key.

Supplied template coverage

The Cloudflare Wrangler example exposes current collection, Studio, and read-bundle settings.

The checked-in Azure and AWS infrastructure templates intentionally expose a smaller core setting set. Their deployment guides list the optional settings that require a reviewed derived template. Do not assume a shell variable is passed into Container Apps or Lambda unless the infrastructure template maps it into the container environment.

This page is built from the repository source.

View or improve this page on GitHub