ThimbleDB is a Cloudflare-first database for small, read-heavy web applications. Browsers read encrypted immutable objects through an authenticated storage broker and retain them in memory and IndexedDB caches. Writes and key grants use the same small authority.
Cloudflare Workers and R2 are the reference deployment. Azure Blob Storage, Amazon S3, and a local filesystem adapter implement the same provider-neutral ObjectStore contract.
flowchart LR subgraph Browser["Browser trust boundary"] App["Web application"] Client["ThimbleDB client"] Memory["Decoded memory LRU"] IDB["Device-key-encrypted IndexedDB"] ScopeKey["Non-extractable scope key"] App --> Client Client --> Memory Client --> IDB Client --> ScopeKey end subgraph ReadPath["Brokered private-read boundary"] Domain["Authenticated object endpoint"] Objects["TDB1 gzip + AES-GCM envelopes"] Domain --> Objects end subgraph Authority["Authenticated authority boundary"] Auth["Authentication and scope authorisation"] Grant["Short-lived key grant"] Write["Validation and conditional write"] Auth --> Grant Auth --> Write end Client -- "Session-authorised ciphertext reads" --> Domain Client -- "Mutations" --> Auth Grant -- "Memory-only CryptoKey" --> ScopeKey Write -- "Encrypted objects" --> Objects Loading flowchart TB Engine["ThimbleDB protocol
cache + scopes + TDB1 + conditional HEAD"] Contract["ObjectStore abstraction
get + put + delete + list + ETag conditions"] Engine --> Contract Contract --> R2["Cloudflare R2
preferred"] Contract --> Local["Local filesystem
development"] Contract --> Azure["Azure Blob Storage
supported"] Contract --> S3["Amazon S3
supported"] Loading The stored object and encryption protocol stays the same across providers. Only bindings, credentials, and browser read authorisation differ.
The reference browser build is about 68.3 KB uncompressed and 18.7 KB gzip. It ships no database runtime or WASM module.
npx thimbledb@latest create my-notes-app cd my-notes-app npm run dev Or start from a maintained repository template:
npm install thimbledb Generate the recommended Microsoft Entra delegated scope and application roles:
npx thimbledb generate-entra-roles --out entra-authorization.json Enable the package-owned management frontend on a Node authority:
await startNodeAuthority({ studio: true, studioOrigin: "https://database.example.com", }); Then open /studio/. See ThimbleDB Studio.
The base install includes the browser/core APIs, authentication, Cloudflare authority, local provider, and Node authority without cloud storage SDKs. Install only the Node storage adapter your deployment uses:
# Azure Blob npm install @azure/storage-blob # Amazon S3 or R2 through the S3 API npm install @aws-sdk/client-s3 Use the browser/core API from thimbledb, external identity primitives from thimbledb/auth, and the complete endpoint authority from either thimbledb/authority/node or thimbledb/authority/cloudflare. Consumers supply their own domain, storage, OIDC application, and secrets.
The authority can share the application deployment or run as a separate service behind the same public browser origin. See Authority deployment modes.
Use Should you use ThimbleDB for a vibe-coded app? for an exact fit check before integration. The database comparisons describe when D1, SQLite, Firestore, lowdb, or direct object storage is the better choice.
See Use cases for workload fit checks and complete guides for personal workspaces, tenant operations, field use, catalogues, journals, and structured AI application context.
npm install npm run dev Open http://127.0.0.1:5173.
Configure Entra or a generic OIDC provider before signing in. The browser harness accepts an API access token and exchanges it for a ThimbleDB session. See Authentication.
The local provider is intended for development and one Node process. It is not a multi-process coordination backend.
For the browser harness, sample store, and benchmark commands, see Evaluation harness.
Published evidence includes live multi-region browser results against a private Cloudflare Worker and R2 deployment:
These results do not establish better cost or latency than D1, Durable Objects, Turso, Firestore, or another managed database. See Benchmarks for methods, raw artifacts, limitations, and layout decision thresholds.
ThimbleDB is suited to small per-user or per-tenant datasets, catalogues, configuration, internal tools, and applications whose hot working set fits in browser storage.
Choose another database for relational transactions, high-frequency shared counters, large cross-tenant queries, or strict immediate revocation. Warm cached reads are fast, but cold object reads and external session creation can take seconds from distant regions. Design the first-load experience with those limits in mind.




