Skip to content
Data and realtime1 min read

Optimistic writes and authorized realtime

Make interfaces feel immediate without creating a second source of truth.

On this page

Canonical source

This public guide is distilled from README.md and docs/CONVENTIONS.md. Keep implementation detail in those repository documents.

Commit once, settle precisely

A mutation can commit its domain change, durable outbox messages, replayable receipt, and PostgreSQL transaction ID together. Retries return the original result rather than repeating the write.

TanStack Query and TanStack DB can show the optimistic result immediately, then match the Electric transaction and preserve newer row versions during reconciliation.

Realtime remains a read path

Electric Shapes pass through a same-origin authenticated proxy. The server selects fixed tables, columns, and tenant predicates; browser input cannot choose arbitrary SQL structure.

Was this page helpful?

Feedback is stored only in this browser in the starter implementation.