The Phase 3 monolith (/backend) is decomposed into independently deployable
microservices. Each service owns its data and exposes a REST/event API; an
API gateway fronts them and clients never call a service directly.
Migration note:
/backend(the monolith) is the source of this split and stays in place during the carve-out. Services are extracted from it one at a time, not big-bang.
| Service | Responsibility |
|---|---|
api-gateway |
Single entry point — routing, auth token validation, rate limiting |
auth-service |
Authentication, JWT issuing, sessions |
user-service |
Platform users & profiles |
organization-service |
Tenants / company accounts (multi-tenancy) |
agent-service |
AI agents — config, execution, prompts, memory (see below) |
workflow-service |
Business-process automation across agents |
notification-service |
Email / in-app / WhatsApp notifications |
billing-service |
Plans, subscriptions, invoices, usage metering |
kb-service |
Knowledge base — documents, embeddings, vector search |
audit-service |
Audit logs & compliance trail |
Services communicate asynchronously over the Kafka event backbone (carried over
from the monolith's events module) and synchronously via REST through the gateway.
agent-service
├── agent-core # REST + persistence for agents
│ ├── controller · service · repository · dto · entity
├── agent-executor # runs the agent loop (reasoning + tool calls)
├── prompt-engine # builds & manages system/runtime prompts
└── memory-engine # short- & long-term conversation memory
Currently a monorepo (services/<name> folders) for easy local development.
Each service is self-contained and can be promoted to its own Git repository
(polyrepo) when teams and deploy pipelines need to scale independently.