Acerca de
A sync engine and client-side database
Datos y análisisWhat 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
Crecimiento de estrellas medido
- in 24h
- 0
- in 7 days
- Recopilando historial
- in 15 days
- Recopilando historial
- in 1 month
- Recopilando historial
Cambios netos en períodos que se solapan, no totales diarios. Los datos no disponibles se dejan en blanco. Las estrellas indican interés, no calidad.
README.md
OriginalTandem
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 throughwith - 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.
- Overview: what Tandem is and how the pieces fit together
- Quickstart: build a synced todo app
- Queries: query options and relations
- Server: run
TandemServerand connect clients to it - Agent chat: stream an agent's reply to every viewer with plain subscriptions
- How sync works: mutations, push, pull, and rebase
- Client: persistence, tab sharing, and lifecycle
- Mutations: named operations and transactions
- Storage adapters: PostgreSQL, MySQL, D1, and JSON file storage
- Application permissions and schema compatibility
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
Explorar proyectos relacionados
Cargando…