Skip to content
프로젝트

소개

A sync engine and client-side database

데이터 및 분석

이 수치를 측정하는 방법

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

측정된 스타 증가

in 24h
0
in 7 days
기록 수집 중
in 15 days
기록 수집 중
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

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

관련 프로젝트 살펴보기

불러오는 중…