Skip to content
المشاريع

حول

A sync engine and client-side database

البيانات والتحليلات

كيف تُقاس هذه الأرقام

ما يمكنك فعله

  • 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

النمو المقاس للنجوم

خلال 24 ساعة
٠
خلال 7 أيام
جارٍ جمع السجل
خلال 15 يومًا
جارٍ جمع السجل
خلال شهر
جارٍ جمع السجل

تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.

README.md

الأصل

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

استكشف مشاريع مشابهة ومرتبطة

جارٍ التحميل…