Skip to content
Docs
On this page Modules 1/10
Internal — not published

The backend is one server process. It serves the JSON API the app calls, receives webhooks from the channel providers, answers the tracking links inside emails, runs scheduled jobs and works through background events. Everything it stores lives in one Postgres database, which also holds the vectors used for Knowledge search. Campaign runs are executed by Restate, a durable workflow engine that runs as its own service and calls back into the backend for each step. Files go to local disk or to S3.

Backend modules and what they share Hover or tap

Ways in

Feature modules

Shared foundation

Hover or tap a box to see what it does.

Work enters through a way in, reaches the module that owns it, and that module uses the shared foundation.

Modules

ModuleResponsible forDetails
Accounts and sign-inUsers, workspaces, members, invites, connected accounts, workspace settings, tokensAuth and accounts
CRMPeople, channel identities, companies, audiences, deals, tasks, notes, tags, the Unassigned pool, import and export, Inbox threads, Home’s Today list, lead research, meeting bookingCRM
ContentProducts, Knowledge documents and their search, templates, email imagesContent and knowledge
Channel clientsSending and receiving on email, LinkedIn, Telegram and ZaloChannels
AI agentThe reply agent, the Ask agent and their toolsAI agent
Campaign engineCampaigns, triggers, runs and the workflow for each personAutomation
AnalyticsEvents, tracking links, delivery notices, the Reports queriesAnalytics and tracking
Outside appsSlack notifications and the one-way HubSpot and Salesforce importChannels

Dependencies point one way. Accounts sit at the bottom, content and CRM build on accounts, the agent and the campaign engine build on CRM and content, and analytics builds on the campaign engine and CRM. Work that travels the other way, such as an inbound message that the channel clients receive and CRM and the agent handle, goes over the event bus.

Workspace scoping

Each access token names one workspace, and every service adds that workspace to each read and write it runs. No central filter or database rule does this for them. A record that belongs to another workspace answers exactly like a missing one, with a 404. Before a write links records by id (adding people to an audience, tagging people in bulk), the ids are first narrowed to those the workspace owns.

A new endpoint that leaves the workspace out of one query can read or change another workspace’s data, and nothing outside that query catches it.

Some data is shared on purpose:

  • A user is a login for the whole installation and can be a member of several workspaces.
  • A channel identity (an email address, a LinkedIn profile, a Telegram user) is stored once and linked to the person in each workspace that has it. Its opt-out state is shared with it.
  • Companies without a workspace form a read-only global pool that every workspace sees. Only the system writes to it.

Roles

A member is an owner or a member. Owners alone can rename the workspace, change a member’s role, remove a member, manage invites, and edit or delete other people’s notes. Every other action is open to any member, including connecting or deleting channels and AI accounts, changing how the agent behaves and deleting people in bulk. Users also carry a platform-wide admin flag in their token, and nothing checks it.

Event bus

Modules hand work to each other as events. The bus is durable: each delivery is a row in Postgres, so an event survives a restart and a failed handler is retried.

One event on the bus Step 1 of 5

The publisher names a topic and a payload. An event on a topic nobody subscribes to is dropped with a warning in the log.

The events that carry most of the work:

EventRaised whenHandled by
Inbound messageA webhook or a mailbox read receives a messageCRM, which writes the thread message and hands it to the agent
Outbound messageAnything sends a messageCRM (timeline entry) and analytics (send event)
Reply, debounced 2 s per personAn inbound message is recordedAnalytics, for reply attribution
Account connectedLinkedIn hosted sign-in finishesAccounts, which saves the LinkedIn account
CSV importA file is uploaded on PeopleThe import worker
Document ingestA Knowledge document is added or needs new vectorsThe Knowledge pipeline
Embedding model changedThe workspace picks another embedding modelRe-embedding of documents and lead memories
TrackingAn open, click or unsubscribe arrivesAnalytics, and the engagement part of the fit score
BounceA mailbox read finds a bounce reportCRM, which opts the address out
NotifyA hand-off to a person, a Draft held for review, a won deal, a campaign replySlack

The handlers for the inbound message, the Knowledge ingest and the outbound timeline entry catch their own errors and log them. The bus sees success and never retries those, so an inbound message that fails halfway is lost.

Scheduled jobs

JobHow often
Read IMAP mailboxesEvery 60 seconds
Fire campaign schedule triggersEvery 30 seconds
Run queued lead researchEvery 10 seconds
Import from HubSpot or SalesforceChecked every 5 minutes; each account has its own interval
Drop idle agent sessionsEvery 5 minutes
Analytics daily rollup01:00 server time

Every backend instance runs every job. The jobs that must not run twice at once take a lease row in Postgres or claim their rows with a conditional update.

Cache and locks

Compose runs a Redis container and the configuration requires its address, but nothing in the backend connects to it. The only cache is in the memory of each process; it keeps one AI provider client per connected AI account. Locks between instances are lease rows in Postgres that expire on their own.

Live inbox stream

The Inbox updates live over a server-sent events stream for the user’s workspace.

  • Every timeline entry the backend writes (a message in either direction, a draft, a tracking event, an agent tool call) pushes a small notice, except the read, snooze, close and reopen markers of the Inbox. The notice goes to the open streams of that workspace: ids, type, channel, direction and a summary. The client then refetches the thread over the normal API.
  • A ping goes out every 25 seconds.
  • The stream closes when an owner removes the user from the workspace.
  • The browser’s built-in event source cannot send the token header, so the app reads the stream with a plain fetch and reconnects after 1, 2, 5 and then every 10 seconds.

The notices live in the memory of one process. With two backend instances, a user connected to one of them does not see activity written by the other.

Configuration and errors

The configuration is checked when the backend starts. A missing or malformed value stops the start with one line per problem. Each domain error has an HTTP status, a stable code, a message and a retryable flag that campaign steps read to decide whether to try again. The response shape is on API conventions.

File storage

Files go to local disk or to an S3 bucket, chosen by configuration. The backend stores three kinds: Knowledge files, CSV imports with their error reports, and images uploaded for emails.

Secrets at rest

The stored data of a connected account, which holds its passwords, API keys and bot tokens, is encrypted with AES-256-GCM as it is written to the database and decrypted when it is read, by a layer under every query, so services never handle ciphertext. The key comes from configuration; when it is missing, the backend derives one from the token-signing secret and logs a warning. At start, rows still in plain text are encrypted and rows under the previous key are re-encrypted with the current one, which is how a key is rotated.

Docs
EN VI