Architecture
The PostgreSQL single store, the four layers, multi-tenant isolation, and the high-availability topology.
In brief
Four application images and one PostgreSQL cluster that carries everything: data, vector search, task queue, real-time events, checkpoints. Every building block is an auditable standard; high availability fits on three nodes.
This page explains what the system is made of and why. To choose your deployment mode, start from Getting started.
Every Brume component is an industry-standard building block that your teams recognize and can audit. There is no proprietary dependency, so the whole system remains portable. In Kubernetes resource names, <instance> means global.instanceName or, when that value is empty, the Helm release name. The hosting provider, CDN, and upstream access control remain operational choices.
A deliberately simple architecture
Brume relies on PostgreSQL as much as possible: application data, vector search (pgvector), asynchronous task queue (procrastinate), real-time events (LISTEN/NOTIFY), agent checkpoints, and file versioning all live in the same database. The platform requires neither Redis, Kafka, nor a separate message broker. Fewer moving parts means faster deployment, simpler operations, and a single thing to back up and monitor.
A complete deployment fits in four application images (interface, API, control panel, worker) and one PostgreSQL cluster managed by an operator. Restoring the database restores a coherent system: data, task queue, event log, and agent state all return to the same point in time, with no desynchronization between storage systems.
The four layers
From browser to database:
- Access: Next.js web interface, JWT-authenticated REST API, MCP server.
- Application: asynchronous Python Litestar API that also serves real-time chat over WebSocket, agent orchestrator (Deep Agents and LangGraph), dedicated worker for Docling document extraction and embeddings, operations control panel (
<instance>-tower). - Data: PostgreSQL with pgvector, procrastinate queue, event log, agent checkpoints, file versioning.
- Foundation: K3s and Helm, routing through Traefik, and a high-availability database through CloudNativePG; the hosting provider, CDN, and upstream access control are operational choices.
The core processing runs inside the perimeter. Model calls leave in BYOK mode, and a few targeted external services (email, transcription, analytics, connectors) provide specific functions that can be disabled in self-hosting. Details are in Your data.
Multi-tenant isolation
Brume uses a two-level multi-tenant model. tenant_id identifies the organization; workspace_id identifies a workspace attached to that organization. Depending on their scope, records are bound to the organization or workspace. Queries derive these scopes from the authenticated context and apply them to every data access.
Foreign keys link each workspace to an existing organization, then link resources to an existing workspace. PostgreSQL therefore guarantees the consistency of these relationships; application scoping prevents a query from crossing an organization or workspace boundary.
Permissions follow the same model. Tenant RBAC covers organization administration; workspace RBAC covers the resources in that workspace. Roles and any overrides are evaluated server-side within the current scope. A permission granted in one workspace grants no access to another.
Layer diagram
Navigateur
│
┌──┴──────────────────────────────────────────────────────────┐
│ ACCÈS Interface Next.js · API REST (JWT) · serveur MCP │
├──────────────────────────────────────────────────────────────┤
│ APPLICATION API Litestar (Python async) + chat WebSocket │
│ Orchestrateur Deep Agents / LangGraph │
│ Worker dédié (Docling, embeddings) │
│ Control panel <instance>-tower (SvelteKit) │
├──────────────────────────────────────────────────────────────┤
│ DONNÉES PostgreSQL + pgvector + pg_trgm │
│ procrastinate · conv_events · checkpoints │
├──────────────────────────────────────────────────────────────┤
│ SOCLE K3s + Helm · Traefik · CloudNativePG │
└──────────────────────────────────────────────────────────────┘Depending on your operational choices, incoming traffic follows this path from the public edge to the pod:
Utilisateur
→ CDN and upstream access control (optional; proxied DNS, TLS termination, and Zero Trust access, for example Cloudflare and Cloudflare Access)
→ access tunnel (optional; for example Cloudflare Tunnel with cloudflared, one connector per node)
→ Traefik en DaemonSet hostNetwork (ports 80/443 de chaque worker)
→ IngressRoute → Service K8s → PodComponents and technologies
Each building block is a documented standard, chosen for a precise benefit. The table below inventories the components, their technologies, and the reasons for each choice.
| Component | Role | Technology(ies) | Why this choice |
|---|---|---|---|
| Web interface | Application your teams see day to day | Next.js 16, React 19, Tailwind CSS 4, shadcn/ui on Radix UI | Fast interface, server-side rendering, accessible components, coherent and maintainable design. |
| Litestar API | Single asynchronous entry point, JWT authentication, real-time chat over WebSocket, MCP server | Python 3.12, Litestar, asyncpg, MCP | Mature ecosystem, high performance and typed API without framework debt, fast database access without blocking. |
| Agent orchestrator | Skill execution with checkpoints to resume interrupted runs | LangGraph, DeepAgents, LangChain | Traceable and resumable executions at every step, structured and predictable agents, model flexibility. |
| Worker | Document extraction (Docling) and vector indexing outside the web path | Docling, PyMuPDF, Trafilatura, Procrastinate | Heavy background processing without separate broker (no Redis, no Kafka), reliable extraction on complex documents, documents queryable without preparation. |
Control panel (<instance>-tower) | Cluster status, alerts, backups, protected by your upstream access control (for example Cloudflare Access) | SvelteKit | Lightweight administration panel separate from user application, Kubernetes ServiceAccount with restricted privileges. |
| Database | Application data, vector and trigram search, task queue, event log, checkpoints, and versioning | PostgreSQL 18, pgvector, pg_trgm, CloudNativePG | Data, search, queues, events, and checkpoints in one place: fewer parts to operate, RAG in the same database, automatic failover. |
| Infrastructure foundation | Orchestration, routing, TLS, hosting, network protection, monitoring, alerting | K3s, Helm, Traefik, CloudNativePG, Prometheus, Grafana, ntfy; hosting provider, CDN, and upstream access control of your choice (for example OVHcloud and Cloudflare) | Standard orchestration simple to operate, reproducible instances, routing and TLS on each node, sovereignty, zero trust, monitoring and real-time alerts. |
Security & authentication:
| Technology | Role | Why this choice |
|---|---|---|
| PyJWT | Authentication tokens | Sessions that can be verified and revoked by version counter. |
| cryptography (Fernet / AES) | Application-level encryption of LLM keys | Storage access gives nothing usable without the encryption key. |
| bcrypt | Password hashing | Non-reversible credentials. |
| python-magic | Detection of the real file type | Verification before processing. |
LLM models:
| Technology | Role | Why this choice |
|---|---|---|
| Anthropic, OpenAI, Mistral | Generation models, in BYOK | You keep the choice of model and your direct contract with the provider. |
Embeddings are produced in BYOK like generation, by the model the workspace policy designates — mistral/mistral-embed (1024 dimensions, EU region) or openai/text-embedding-3-large (1536 dimensions). The choice is frozen at the first successful index: see Data and flows.
Real-time chat is carried directly by the API
The chat stream goes over WebSocket directly on the Litestar API. Broadcasting relies on the conv_events event log in the database and PostgreSQL LISTEN/NOTIFY: a reconnecting session replays missed events from the database.
Resources per component
Each component declares its requests and limits in the Helm chart. PostgreSQL storage uses the local-path storageClass (local node disk), managed by CloudNativePG. Complete server sizing (node specs, topology, costs) is in Low-cost HA.
| Component | CPU (requests → limits) | Memory (requests → limits) | Replicas |
|---|---|---|---|
| Interface (frontend) | 100m → 1000m | 256Mi → 1Gi | 2 |
| API (backend) | 250m → 2000m | 512Mi → 2Gi | 2 |
| Worker | 500m → 2000m | 1Gi → 4Gi | 1 |
| Control panel (tower) | 100m → 500m | 256Mi → 512Mi | 2 |
| PostgreSQL (CNPG) | depending on sizing | shared_buffers 4 GB, effective_cache_size 12 GB | 2 |
High availability
The application is distributed across two worker nodes in separate datacenters, with a third arbiter node that carries no application load and ensures control-plane quorum.
| Component | Distribution | Mechanism |
|---|---|---|
| API, interface, control panel | 1 pod per worker | Required anti-affinity, rolling update maxUnavailable: 1 / maxSurge: 0 |
| PostgreSQL (CNPG) | primary + replica | Automatic failover in 10 to 30 seconds |
| Traefik | DaemonSet | One pod per worker, ports 80/443 in hostNetwork |
| CoreDNS | 2 replicas | Internal DNS resolution maintained if one node fails |
| Tunnel connector (for example cloudflared) | systemd | One connector per node when a tunnel is used |
In this reference topology, losing one worker node preserves service while control-plane quorum and a PostgreSQL replica remain available. Adapt routing, replication, and anti-affinity rules to your infrastructure.
Administration access
Administration interfaces enforce server-side access control and least privilege. Restrict them to authorized roles, protect their network exposure, and log operations according to your security policy.
Building blocks your teams know how to read
Kubernetes, PostgreSQL, Next.js: each building block is a proven, documented technology that a third party can operate. Your teams read the code, replay it on their own infrastructure, and keep their data portable from one environment to another.