Skip to Content
Workspace

System design

Three containers, one server process hosting nine modules, and one Postgres database with a schema per module.

Workspace runs as three containers: Caddy for HTTPS, one app container (a Next.js web app and one Node 22 server hosting every module) and PostgreSQL. No message broker, no cache server. One installation holds one company; it scales up on a bigger server, not out to more containers.

Staff in the browserthe web app, installable as a PWABrowser extensionon AI chat sites, after the person opts inIntegrations and AI assistantsREST API, MCP server, webhooksWorkspaceone server, one companychat · tasks · docs · meetingsapprovals · people · AI InsightsOptional, chosen by the companyAI provideryour key, any API, self-hosted,or a person's own computerSMTPinvitations, resets, digestsObject storage (S3)default: the server's diskHTTPSwith consentBearer wos_…Nothing is sent to the project's authors or to any third party.
Who uses Workspace and what it talks to.
Browserstaff, PWAYour server · docker composeCaddy:80 · :443 · TLSapp container · one imagewebNext.js BFF · :3000sessions in PostgresserverNode 22 · :4000gateway + 8 modulesone processPostgreSQL 16one databasea schema and a loginrole per moduleS3 (SeaweedFS)signed URLs · profile s3default: the server's diskLiveKitprofile meet · videopagesws · files · mcpin memoryWebRTC media, straight to LiveKitAlso straight to :4000:wos_ API keys, OAuth,hooks, the runner,/api/ai/local*, /api/docs
Containers: Caddy, the app container (web and server) and Postgres.

Modules

The backend is one process (backend/server). Each module owns a folder, a Postgres schema, a login role, its migrations and an HTTP API. A lint rule refuses imports between modules; they call each other's API in memory or react to events. The web app (frontend/web, Next.js 15) is the BFF in front of the gateway.

ModuleOwns
gatewayVerifies sessions and API keys, rate limits, routes /api/<module>/*; MCP and the extension intake
identitySign-in (passwords, tokens, two-step), members, roles, teams, API keys, audit
platformThe workspace, first-run setup, master data, outbound webhooks
chatChannels, DMs, threads, files, calls; Socket.IO realtime and live co-editing
workProjects, tasks, documents, drive, calendar and meetings, approvals, goals, outcomes
homeThe "Needs you" feed, notifications, reminders, daily digest, Web Push
employeeProfiles, departments and reporting lines, attendance, leave, announcements
aiModel gateway, assistant, usage and budgets, AI Insights intake, policy and retention
searchFull-text index in Postgres, rebuilt from events
Module handlerone transactionRows + outbox rowCOMMIT, then NOTIFYOutbox relayclaims, SKIP LOCKEDEvent busin processConsumersper groupdead_eventsafter 5 triesfailsdlq replayPostgreSQL · one database · schema and login role workspace_<module> per moduleidentityplatformchatworkhomeemployeeaisearchwebA module's role can use only its own schema; cross-module data goes through APIs or events.search is a rebuildable projection (reindex); the outbox is the replay copy, kept 3 days.No workspace column anywhere: one installation is one company (ADR-0023).12 consumer groups: home projector, search indexer, platform webhooks and audit, employee, chat, work, ai.At least once, idempotent through processed_events; no ordering across topics.as the module's role
Data and messaging: one Postgres, a schema per module, events in process.

State changes other modules care about are written to an outbox in the same transaction and delivered in process, at least once, to every consumer. A failed event retries, then waits in a dead-letter table for a replay. Files go to local disk or S3 through signed URLs; search is a Postgres full-text index that can be rebuilt from the modules' own data.

Five rules behind every change

  1. No module reads another module's schema. Its Postgres role cannot. Data moves through module APIs (in memory) or events.
  2. One workspace. No workspace column, row-level security or workspace id anywhere; a second company is a second installation.
  3. Authorization is authorize(principal, permission, resource) in the owning module, for people, API keys and AI agents alike.
  4. State changes others care about go through the outbox, in the same transaction.
  5. Nothing may require AI. Generative endpoints answer 503 ai_not_configured and the UI hides them.

Why it is built this way

Each decision is an architecture decision record in docs/adr, never rewritten: a changed decision gets a new record that supersedes the old one. Three explain most of what you see here:

  • 0020: the AI Insights principles (consent, self-view, no surveillance, audited full text, data stays on the server, off by default).
  • 0021: one server process for every module, one app container behind Caddy.
  • 0023: one workspace in the data model, no workspace column or row-level security.

Full reference

In the repository: system design (goals, containers, each module's endpoints and topics, realtime, search, files, meetings, failure modes, testing), database (schemas, roles, migrations, one page per module) and events (outbox, relay, consumer groups, the catalog of every event).

Next: Request path, security and AI gateway.

On this page