Cloudflare-first. Open source. Application-owned.

A small database for small web apps.

ThimbleDB keeps encrypted application data in object storage and a fast browser cache. It gives focused web apps a durable data layer without operating a separate database engine.

npx thimbledb@latest create my-app
  • Apache-2.0
  • 15.3 KB gzip browser build
  • 2-package base install
  • Node.js 22+
Browser cache
Application authority
Object storage

For experienced developers

Inspect the boundaries before adopting it.

The protocol, threat model, deletion semantics, benchmarks, and provider contracts are documented with their limitations.

Review the architecture →

For AI-assisted builders

Start with a fit check and copyable prompts.

Use the workload checklist, guided examples, and implementation prompts before asking a coding tool to wire the database.

Run the fit guide →

Small integration surface

Own the deployment. Keep application code direct.

The authority owns credentials, identity, keys, and conditional writes. Application code works with documents and collections.

Ready browser client
src/application.ts
const db = await createThimbleClient();

const notes = db.collection(noteDefinition);

One factory configures authority URLs, scope keys, memory cache, encrypted IndexedDB, and layout checks.

Bounded indexed query
application.ts
const result = await notes
  .where((note) => note.title.eq("First note"))
  .orderBy((note) => note.lastModified.desc())
  .take(25)
  .get();

Declared indexes narrow candidates. The client checks the complete predicate and falls back to a bounded scan when needed.

Know the fit

Designed for bounded, read-heavy application data.

ThimbleDB serves a deliberate workload. The limits are part of the product, not fine print.

A reasonable candidate

  • Records belong to one user, tenant, role, or public scope
  • ID reads, declared indexes, or bounded scans cover the workflow
  • Writes are modest compared with reads
  • The hot working set fits in browser storage
  • External OIDC already handles account security
Check whether the app fits →

Choose another database

  • Multi-record transactions or relational joins are central
  • Shared records receive high-frequency concurrent writes
  • The application needs full-text, vector, or analytical queries
  • Offline writes and automatic conflict resolution are required
  • The dataset is not meaningfully bounded
Read the tradeoffs →

How it works

Three boundaries, one application-owned data path.

The browser gets speed. The authority keeps control. Object storage provides durable encrypted bytes.

01

Browser

Memory and encrypted IndexedDB keep the active working set close to the user.

02

Authority

External identity, scope checks, key grants, validation, writes, deletion, and administration stay server-side.

03

Object storage

Canonical JSON becomes compressed AES-GCM envelopes stored in R2, S3, Azure Blob, or local files.

Cloudflare R2Amazon S3Azure Blob StorageLocal filesystem

Published R2 evidence

Fast when warm. Honest about cold reads.

In the regional browser run, final warm p95 reads ranged from 1.6 to 8.3 ms. Cold product reads ranged from 1.25 to 3.44 seconds after the snapshot change. External session creation remained slower.

These measurements describe one tested workload. They do not claim database-wide latency superiority.

Read the benchmark and limitations →
Final warm p951.6-8.3 ms
North Europe8.3 ms
US East5.2 ms
Southeast Asia1.6 ms

Direct answers

Questions to settle before implementation.

Read every answer →
What is ThimbleDB?

ThimbleDB is an encrypted, browser first database for small web applications. Object storage is the durable source of truth. An application owned authority handles identity, access checks, key grants, writes, deletion, and administration. Browsers keep a fast encrypted cache in memory and IndexedDB.

What kind of application fits ThimbleDB?

The strongest fits have bounded JSON data, clear user or tenant ownership, more reads than writes, direct reads by ID, and occasional collection scans. Examples include personal workspaces, small internal tools, field guides, catalogues, journals, and bounded context for AI assisted applications.

When should I use another database?

Use another system when the application needs multi record ACID transactions, joins, high frequency shared writes, real time collaboration, full text search, vector search, large analytical queries, or unrestricted reporting across tenants.

Is ThimbleDB a replacement for PostgreSQL or SQLite?

No. ThimbleDB serves a narrower workload. It avoids a continuously running database engine by storing encrypted immutable objects and small mutable location records in object storage. Relational databases remain the better choice when relationships, transactions, and flexible queries are central to the application.

Does ThimbleDB require Cloudflare?

No. Cloudflare Workers and R2 are the reference deployment. The package also includes a Node authority with local filesystem, Azure Blob Storage, Amazon S3, and S3 compatible adapters. The stored protocol remains the same across providers.

Does ThimbleDB store passwords?

No. Applications use Microsoft Entra or another OpenID Connect provider. ThimbleDB stores stable external identity mappings and revocable sessions, but passwords, passkeys, MFA factors, recovery, and verification remain with the identity provider.

Evaluate it against your workload

Start local. Keep the exit criteria visible.

Run the sample application, review the tradeoffs, and compare the result with a managed database before choosing a production data layer.