Skip to content
AntFabric Corev1.0.0local

Data

One PostgreSQL database per instance. Core’s tables are in the public schema. Each plugin owns one schema and reaches it as its own database role, which can see nothing else.

Owner Schema Role Can see
Core public the application user Everything (core’s own code only)
Chat chat af_chat chat
Sales sales af_sales sales
Any plugin <schema> in plugin.yaml af_<name> its schema, plus the schemas of plugins it declares as dependencies

PluginDb runs every transaction with SET LOCAL ROLE af_<name> and the plugin’s schema on the search path. A plugin that reads public.users gets “permission denied”; it asks PluginPeople.

No foreign keys across schemas. Plugins reference people and files by id.

A change and what it causes commit together:

Outbox Holds Delivered by
event_outbox Live events published with a transaction The event dispatcher, to the socket gateway
workflow_outbox Workflow starts The workflow dispatcher, to Temporal
notification_requests Notification sends, keyed by idempotency key The delivery workflow

Row security on the outboxes lets a plugin role insert only its own rows.

  • SQL first, append-only. Core’s are in apps/backend/src/db/drizzle/migrations; a plugin’s in plugins/<name>/db/migrations, each with its own journal.
  • The runner holds one lock per instance, refuses an edited applied migration, records every run, creates plugin schemas and roles, and grants roles their declared dependencies’ schemas.
  • /health/ready is not ready until every core and plugin migration has run.
  • Only selected plugins are migrated. A plugin removed from an instance keeps its data.
Store Holds
Redis Rate limits, SSO state, presence, socket fan-out (sessions are rows in Postgres)
Object storage File bytes; the files table holds owner, key and status
Secret store Encrypted rows in secrets (SECRETS_ENCRYPTION_KEY)
Temporal Workflow state and history