Skip to content
Projets

À propos

A sync engine and client-side database

Données et analyse

Comment ces chiffres sont mesurés

What you can do

  • Optimistic local writes with rollback when the server rejects them
  • Typed object queries with select, where, orderBy, limit, offset, and relations through with
  • Live query subscriptions that re-run when matching data changes
  • Pokes tell subscribed clients to pull as soon as the server commits a change; each poke starts a pull

Progression mesurée des étoiles

in 24h
0
in 7 days
Historique en cours
in 15 days
Historique en cours
in 1 month
Historique en cours

Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.

README.md

Original

Tandem

A sync engine and database for building collaborative apps.

[!WARNING] Tandem is a work in progress and pre-1.0. APIs change without notice.

Tandem gives each client a local, queryable database. Writes apply locally first. Tandem then syncs them to a server in the background and replays any pending local changes on top of what the server sends back.

Features

  • Optimistic local writes with rollback when the server rejects them
  • Typed object queries with select, where, orderBy, limit, offset, and relations through with
  • Live query subscriptions that re-run when matching data changes
  • Pokes tell subscribed clients to pull as soon as the server commits a change; each poke starts a pull
  • Optional IndexedDB persistence on the client, shared safely between browser tabs
  • Scalar or compound tuple IDs, with typed prefix scans
  • A server database that implements the sync protocol
  • React bindings

Packages

Package Description
@tanishqkancharla/tandem-core Client database, schema, queries, and client sync
@tanishqkancharla/tandem-backend Mutators, pulls, and storage adapters
@tanishqkancharla/tandem-sync Sync engine: client connections and pokes
@tanishqkancharla/tandem-server TandemServer: backend and sync engine together
@tanishqkancharla/tandem-react React provider and hooks
@tanishqkancharla/gatekeeper Test harness for controlling call order and faults

Installation

pnpm add @tanishqkancharla/tandem-core
pnpm add @tanishqkancharla/tandem-react # React bindings
pnpm add @tanishqkancharla/tandem-server # Server

Example

import {
	collection,
	defineSchema,
	t,
	TandemClient,
} from "@tanishqkancharla/tandem-core"

const schema = defineSchema({
	todos: collection({
		id: t.id(),
		text: t.string(),
		complete: t.boolean(),
	}),
})

const client = new TandemClient({ schema })
await client.ready

const tx = client.transact()
tx.set("todos", { id: "1", text: "Try Tandem", complete: false })
await client.commit(tx)

const { result, destroy } = client.subscribe(
	{ collection: "todos", where: { complete: false } },
	(todos) => console.log(todos),
)

To sync between clients, pass a remote. See Quickstart.

Documentation

Visit tandemsync.dev or read the guides at docs.tandemsync.dev.

The full index is in docs/README.md.

Examples

examples/todo is a React todo app backed by a Hono server that runs TandemServer with JSON file storage.

pnpm install
pnpm exec turbo run dev --filter=@tandem/example-todo-web --filter=@tandem/example-todo-server

Development

This is a pnpm and Turborepo monorepo.

pnpm install
pnpm build
pnpm test
pnpm type-check
pnpm lint
pnpm format

pnpm dst:run runs the deterministic simulation tests in dst. See specs/deterministic-simulation-testing.md.

License

MIT

Explorer des projets similaires

Chargement…