Skip to content

Architecture overview ​

Orbit is a modular monolith: one Rust binary, orbit, holds a small kernel and every module compiled into it. Postgres is the only required dependency. The web app (React) and a Better Auth sidecar (TypeScript) complete the stack.

In depth

This page is the short version. Architecture in depth covers the kernel, bus, events, jobs, database roles and row-level security in detail.

The pieces ​

PieceWhereDoes
orbit binarycrates/orbit-binRuns the roles below and the operator commands
Kernelcrates/kernelModule registry, command and query bus, tenancy, Ctx, ID newtypes
Authorisationcrates/authzCedar schema, policies and entity loaders
Events and jobscrates/events, crates/jobsTransactional outbox, relay, apalis jobs, cron
Personal data and filescrates/pii, crates/storageField encryption, encrypted file storage
Doorscrates/api-graphql, crates/api-mcp, crates/api-scim, crates/cliGraphQL, MCP, SCIM and the CLI
Modulesmodules/<id>One business area each: schema, handlers, policies, manifest
Auth sidecarservices/authSign-in, organisations, invitations, SSO, JWTs
Web appweb/Admin web and the employee self-service app

Process roles ​

One image, one binary. The flag picks what a process runs.

CommandRuns
orbit migrateEvery migration, then exits. The only process with the owner login
orbit --role webHTTP: the web app, these docs at /docs, /graphql, /mcp, /scim/v2, /files, and the /api/auth proxy to the sidecar
orbit --role workerThe event relay and the job worker
orbit --role schedulerCron schedules that enqueue jobs
orbit --role allAll three serving roles, for development

Each serving process refuses credentials it must not hold (the owner URL, and the worker or doors URL when it doesn't run that role) and checks that no login is a superuser.

Postgres and database roles ​

  • One schema per module (leave.*, payroll.*). A module never reads another's tables; it uses the other module's queries and events.
  • Tenant scoping twice: every statement filters by tenant_id, and forced row-level security hides other tenants' rows as a second safety net.
  • Least-privilege logins: the owner (migrations only), the runtime role (handlers), the worker role (relay, jobs, scheduler) and the doors role (identity functions only). Each module also gets its own database role with grants on its own schema only (ADR 0005).

A request, end to end ​

  1. A door (GraphQL, MCP, CLI or SCIM) authenticates the caller and turns the request into a bus call. Doors hold no business logic.
  2. The bus opens a transaction scoped to the tenant and asks Cedar whether the actor may attempt the action.
  3. It checks the module is enabled for the tenant, then runs the handler.
  4. The handler checks the specific record with Cedar (ctx.authorize), changes state and emits events into the outbox, all in the same transaction.
  5. For a command, the bus writes the audit entry in that transaction and commits. Denied attempts are audited too.

Events and jobs

The relay publishes committed outbox rows in order, per tenant, at least once; handlers are idempotent. Failing subscribers retry with backoff, then dead-letter. Events for a disabled module are held and replayed when it is enabled again. Jobs run per tenant, only where their module is enabled.

Rules that never bend ​

  • Every action goes through the bus and Cedar. No "internal" shortcuts.
  • Money is never a float: rust_decimal::Decimal in Rust, decimal strings in the API.
  • History is immutable: locked payroll runs, signed acknowledgements and audit entries are never updated. Corrections are new records.
  • Agents may draft and recommend. Approving, locking payroll and changing pay need a person, or an explicit confirmation for tools marked sensitive.

Orbit by SkySync Tech. Licensed under AGPL-3.0.