Reference

Catalog tables

TablePurpose
viewmodelOne row per ViewModel: key columns, strategy, projector, auth scope, delete mode
view_sourceSource tables, watched columns, key-map SQL
dependency_edgeParent-child edges for DAG composition
write_bindingField-to-source-column mapping for reverse projection
write_sourceSource row location/insert/delete metadata for commit
change_logOrdered, durable change feed from base tables (daily-partitioned)
refresh_queueWork list: (view, key) pairs needing recompute
outboxTransactional outbox for subscriber consumption
dead_letterFailed refresh attempts past max_retries
subscriber_cursorPer-subscriber ack cursor for at-least-once delivery

Key functions

FunctionSignature
attach_captureattach_capture(tbl regclass) → void
validatevalidate(view text) → void
bootstrapbootstrap(view text) → bigint
bootstrap_allbootstrap_all() → void
refreshrefresh(view text, keys jsonb) → void
process_queueprocess_queue(batch int DEFAULT 500) → int
fetch_sincefetch_since(view, scope, since, limit) → SETOF (seq, deleted, payload)
commitcommit(view, op, model, base, expectedSeq, trace) -> jsonb
reconcile_allreconcile_all() -> TABLE(view, drift)
replay_dead_letterreplay_dead_letter(id bigint) -> void

Monitoring views

ViewContents
v_healthQueued / retrying / backing off / dead / oldest wait per view
v_perfRuns, keys, avg/max ms per view (last hour)
v_backlogPending count + oldest wait per view
v_subscriptionsLive SSE connections, lag, high-water per user/scope
v_trace_segmentsPer-trace breakdown by 7-hop segment (ms)

TS subscriber API

import { createSynctable } from '@synctable/core/server'

const st = createSynctable({
  connectionString: process.env.DATABASE_URL!,
  models: [myModel],
  authorize: (req, ctx) => ({ allowed: true, scope: { org_id: 1 } }),
  otel: { export: false },
})

await st.start()
// Auto-starts outbox drain + Graphile Worker