Skip to content

A multi-tenant control plane on Asterisk ARI with Postgres row-level security

Gaiastra is a multi-tenant communications and transaction platform. The interesting parts are not the telephony features but the two constraints that shaped the architecture: tenants must never see each other's data, and every transaction must be provable.

Event-driven control plane

Asterisk 22 is driven over ARI/Stasis from a TypeScript control plane. Every channel event becomes a domain event; the platform processes each cycle of call transactions with sub-second event handling. Keeping the control plane stateless and the state in PostgreSQL is what makes it restartable and testable.

Tenant isolation in the database, not the application

Application-level WHERE tenant_id = ? filters fail the day someone forgets one. Gaiastra uses PostgreSQL row-level security: the connection sets the tenant, and the database refuses to return rows outside it. RBAC and per-jurisdiction compliance rules are enforced the same way — as hard blocks, not as UI hints.

Proving it

Reconciliation jobs cross-check every transaction, CDR against queue_log, so the platform can show its own books balance. The whole system is covered by 1,393 automated tests, with PCI-DSS TLS/HSTS on every edge.

What comes next

The next phase moves settlement on-chain: tokenised usage billing with Solidity contracts and ethers.js, Redis event caching, and an AWS deployment. The control plane does not change — the ledger it settles against does.