A typed database for the apps you want to build. Live queries, offline writes, and a history you can replay. All in your own Cloudflare account.
TYPESCRIPT FIRST · ZERO CORE RUNTIME DEPENDENCIES · YOUR INFRASTRUCTURE
Website · Documentation · Source · npm
TapeDB is a TypeScript database library for Cloudflare. It combines schema-defined models and typed queries with live subscriptions and an offline write outbox. Each workspace has its own SQLite database inside a Durable Object.
| Live, by subscription. | Offline isn't the end. | A history to build on. |
|---|---|---|
| Subscribe to a query and receive row-level updates when relevant data changes. The same API for a read or a live view. | Writes apply optimistically and queue in a persistent outbox. Reconnect and pick up where you left off. | Transactions go onto a log. Segments and snapshots reach R2, ready for replay and recovery when needed. |
01 / LIVE
Define a schema. Connect a client. Build the experience. TapeDB handles the space between your interface and your database.
app.ts
// A query. A live view. The same API.
db.task.findMany({
where: { done: false },
}).subscribe(({ data }) => render(data));
// One write reaches every subscriber.
await db.task.create({
data: { title: "Replay the log" },
});Typed end to end. No query strings.
02 / SCHEMA
Fields, relations, and access rules in TypeScript. Your schema shapes the engine, migrations, and client types. TypeScript checks relation targets, inverses and personal-field subjects in your editor.
tapedb.schema.ts
import { schema, model, t } from "@tapedb/tapedb/schema";
export default schema({
project: model({
name: t.string(),
tasks: t.hasMany("task"),
}),
task: model({
title: t.string(),
done: t.boolean().default(false),
project: t.belongsTo("project"),
}),
});01 One definition. Models drive your data layer.
02 Real relations. Link and query your models.
03 Reviewed migrations. SQL you can commit.
Your schema. Your source of truth.
03 / ARCHITECTURE
Each workspace has one Durable Object and one SQLite database. A single writer makes transactions serializable. R2 gives the log somewhere to go.
Note
Your infrastructure. Your application supplies identity; TapeDB manages workspace data.
Built on primitives you already trust.
Cloudflare Workers · Durable Objects · SQLite · R2 object storage
npx tapedb-cli@latest initThe interactive setup installs dependencies and lets you run locally or deploy to Cloudflare. Follow the setup guide.
Browse and edit rows, run model queries, import and export CSV or JSON, inspect access rules and read workspace history.
Explore Studio for the full guide and screenshots.
A package can add to a TapeDB app in the schema, the Worker and the CLI at once. The first is a content management system: content types in code, drafts, releases, scheduled publishing, co-editing, a studio you can brand and extend, and a cached delivery path.
npx tapedb-cli@latest add @tapedb/cms| Guide | What you'll find |
|---|---|
| Introduction | Overview and core concepts |
| Setup | Interactive setup, local development and deployment |
| Models | Fields, relations and schema checks |
| Queries & live data | Read and subscribe |
| Writes & offline | Transactions and offline writes |
| Studio | Data browser, query console, access and history |
| Architecture | Workspaces, storage and recovery |
| Access | Identity, roles and rules |
| Migrations | Review and apply schema changes |
| Privacy | Retention and personal data |
| Export & erasure | Export and erase workspace data |
| Extensions | Packages that add models, routes and commands |
| API reference | Package exports and types |
| Limits | Supported limits |
