Synchronization infrastructure

Track. Deliver.
Resolve. Recover.

Hecate keeps local application databases and independent backends consistent. Change tracking, delivery, retries, checkpoints, and conflict handling live in the platform — not in every app you ship.

Powered by Hecate's Engine. Managed through Hecate's Torch

01Change logSQLite triggers02Hecate runtimeDelivery & checkpoints03PostgreSQLCentral store04SubscriptionsRow-level auth05ConflictsExplicit policy
Sync status

Offline

3 local changes pending

Product

Hecate's Engine: Reusable sync, instead of a bespoke engine in every codebase.

Developers already know how to read and write a database. The hard part is keeping that data honest across an offline client and a backend that does not share a transaction.

01

Local first

Reads and writes succeed with no network. The change log is the queue.

02

Two modes

Local Sync is the product. Database Sync reuses the same runtime later.

03

One envelope

Events carry identity, source, and ordering. Adapters differ. The runtime does not.

04

Operable

Status, retries, slot retention, and diagnostics are part of the design, not an afterthought.

Capabilities

One platform. A primary path, and a second that shares its bones.

Capability A · Primary

MVP

Hecate Local Sync

SQLite on the device, PostgreSQL at the center, a TypeScript SDK in between. HTTP carries batches. WebSockets say when the server has something new.

  • Offline reads and writes
  • Local change tracking with SQLite triggers
  • Durable pending-change storage
  • Client-to-server and server-to-client sync
  • Selective, authorization-aware subscriptions
  • Device identity, retry, and diagnostics

React Native / Expo · JSON protocol · Device auth

Capability B · Next

Database Sync

Independent PostgreSQL databases, captured with logical replication and applied one way. Bidirectional sync waits until the one-way path is boring.

  • Initial snapshots and continuous capture
  • Transaction-aware pgoutput decoding
  • One-way replication with commit order preserved
  • Idempotent destination application
  • Checkpointing, retry, and slot monitoring
  • Table and row filtering

Architecture

Same runtime. Different adapters and consistency rules.

Event shape, delivery, checkpoints, idempotency, retry, observability, and configuration are shared. Sources and destinations are not.

Local Sync

Pipeline
  1. 1Applicationthen
  2. 2TypeScript SDKthen
  3. 3SQLite + change logthen
  4. 4Hecate serverthen
  5. 5PostgreSQL

The reverse path sends authorized backend changes back to connected devices.

Database Sync

Pipeline
  1. 1Source PostgreSQLthen
  2. 2Logical replicationthen
  3. 3CDC adapterthen
  4. 4Replication enginethen
  5. 5Destination PostgreSQL

pgoutput supplies the stream. The engine preserves transaction boundaries.

Shared runtime

01

Event identity

Stable ids, source identity, and source-specific cursors such as LSNs and SQLite sequences.

02

Durable processing

Events survive restarts. Pending work is stored, not held in memory.

03

Delivery

At-least-once transport with explicit acknowledgements.

04

Checkpoints

A successful apply and its checkpoint commit together when the destination allows it.

05

Idempotency

Replays do not duplicate effects on the destination.

06

Recovery

Interrupted batches resume from the last durable point.

07

Observability

Structured logs, metrics, and sync status for operators and devices.

08

Configuration

YAML for developers, validated before the runtime starts.

Guarantees

Reliability you can state out loud.

These are the constraints the engine is built around. They are also the ones a demo has to survive.

01

At-least-once

Hecate does not promise exactly-once delivery across independent databases. Application is idempotent, so a replay is safe.

02

Atomic checkpoints

Destination writes and the checkpoint that records them commit in one transaction wherever the database can do that.

03

Source cursors

PostgreSQL LSNs and SQLite change sequences stay distinct. Ordering mechanisms are not flattened into one fake clock.

04

Explicit conflicts

Offline clients will write concurrently. Last-write-wins is a policy you choose, not a silent default.

05

Authorized fan-out

Subscriptions enforce user, tenant, and record-level access before a row is offered to a device.

06

Backpressure

When a destination falls behind, consumption slows. Queue depth and PostgreSQL WAL retention stay visible.

Schema evolution is part of the same contract: clients and servers must define what happens to incompatible versions, in-flight events, and migrations before a pending change is applied.

Technology

A small stack, chosen so the hard parts stay light.

Core runtime

Go
Synchronization runtime
pgx
PostgreSQL connectivity
pglogrepl
Logical replication protocol
pgoutput
Change decoding

Local sync

SQLite
Offline inserts, updates, deletes
TypeScript
Client SDK
expo-sqlite
React Native integration
HTTP + WebSockets
Batches and notifications

Operate

Cobra
Hecate CLI
YAML
Developer configuration
Docker Compose
Local environment
OpenTelemetry
Instrumentation

Roadmap

Local Sync ships first. Database Sync follows the same primitives.

  1. 0

    Foundations

    Protocol, identity, acknowledgements, conflicts, and authorization — written down before the engine.

  2. 1

    Primitives

    A Go runtime that can identify, validate, deliver, checkpoint, and retry events.

  3. 2

    SQLite

    Triggers, change logs, transaction boundaries, and pending work that survives restart.

  4. 3

    Upstream

    Device auth, batched HTTP upload, transactional apply on PostgreSQL, duplicate suppression.

  5. 4

    Downstream

    Subscriptions, row filters, WebSocket hints, and HTTP catch-up for reconnecting devices.

  6. 5

    Conflicts

    Versioning, concurrent-update detection, and policies: server, client, last-write, or application.

  7. 6

    SDK

    A TypeScript SDK and Expo integration so apps do not build their own sync engine.

  8. 7

    Database sync

    One-way PostgreSQL logical replication. The next capability, not a gate on the first prototype.

  9. 8

    Developer experience

    CLI, YAML, health, Docker, and a path from install to a running sync.

  10. 9

    Hardening

    Partitions, crashes, large batches, schema changes, and slot growth — tested and documented.

MVP demonstration

Ten steps. Offline, restart, conflict, partition — then a clean resume.

  1. 01

    Device A, offline

    A customer record is created in SQLite. The change log keeps it.

  2. 02

    Restart

    The app closes and opens again. Pending work is still there.

  3. 03

    Reconnect

    Device A reaches the Hecate server and resumes from its checkpoint.

  4. 04

    Central apply

    The record lands in PostgreSQL inside a transaction.

  5. 05

    Device B

    An authorized subscription receives the new row.

  6. 06

    Edit on B

    Device B updates the customer. The change is captured upstream.

  7. 07

    Back to A

    Device A receives the modification on the next catch-up.

  8. 08

    Conflict

    Concurrent edits are detected and resolved by the configured policy.

  9. 09

    Partition

    The network drops mid-batch. Nothing is acknowledged early.

  10. 10

    Resume

    Sync continues without lost changes or duplicate effects.

Questions

The decisions that usually get buried in a README.

Local Sync. A React Native or Expo app stores data in SQLite, tracks changes locally, and synchronizes with a central PostgreSQL database over HTTP, with WebSockets for “changes are waiting” notifications.

Self-hosted MVP

Put sync in the infrastructure. Leave the product code to the product.