Skip to content
@tapedb

TapeDB

Typed models, live queries, and offline writes. A database library built for Cloudflare, running in your own account.

tapedb. Your data. Always in sync. Built on Cloudflare.

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.

Three diagrams. Live, by subscription: a row value changes and the subscriber registers it. Offline isn't the end: the connection breaks, writes queue in the outbox, then flush on reconnect. A history to build on: a playhead runs along the tape, steps back to a snapshot and replays.

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

A query. A live view. The same API.

Define a schema. Connect a client. Build the experience. TapeDB handles the space between your interface and your database.

TapeDB demo. In app.ts, client 01, await db.task.create with the title Replay the log is typed in. The write reaches the project First project: a fourth task, Replay the log, arrives marked NEW and the count goes from 03 to 04 tasks. The transaction tape advances one notch and records tx_0194 task.create.

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

Start with a model. Stay in your flow.

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

A workspace. A writer. A tape.

Each workspace has one Durable Object and one SQLite database. A single writer makes transactions serializable. R2 gives the log somewhere to go.

Architecture. 01 Client, your application: typed queries, live subscriptions, persistent outbox. HTTP / WS to 02 Workspace, a Durable Object: single writer, SQLite database, access rules, one per workspace. Async flush to 03 Storage, the tape in R2: log segments, state snapshots, recovery and replay, in your buckets.

Note

Your infrastructure. Your application supplies identity; TapeDB manages workspace data.

Built on

Built on primitives you already trust.

Cloudflare Workers  ·  Durable Objects  ·  SQLite  ·  R2 object storage

Get started

npx tapedb-cli@latest init

The interactive setup installs dependencies and lets you run locally or deploy to Cloudflare. Follow the setup guide.

Studio

Browse and edit rows, run model queries, import and export CSV or JSON, inspect access rules and read workspace history.

TapeDB Studio data grid with sample tasks

Explore Studio for the full guide and screenshots.

Extensions

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

How extensions work

Documentation

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

Pinned Loading

  1. tapedb tapedb Public

    A typed realtime database for Cloudflare Durable Objects: live queries, offline writes and a replayable log in R2, in your own account.

    TypeScript 2

Repositories

Showing 4 of 4 repositories

People

This organization has no public members. You must be a member to see who’s a part of this organization.

Top languages

Loading…

Most used topics

Loading…