Brume · Docs

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 → Pod

Components 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.

ComponentRoleTechnology(ies)Why this choice
Web interfaceApplication your teams see day to dayNext.js 16, React 19, Tailwind CSS 4, shadcn/ui on Radix UIFast interface, server-side rendering, accessible components, coherent and maintainable design.
Litestar APISingle asynchronous entry point, JWT authentication, real-time chat over WebSocket, MCP serverPython 3.12, Litestar, asyncpg, MCPMature ecosystem, high performance and typed API without framework debt, fast database access without blocking.
Agent orchestratorSkill execution with checkpoints to resume interrupted runsLangGraph, DeepAgents, LangChainTraceable and resumable executions at every step, structured and predictable agents, model flexibility.
WorkerDocument extraction (Docling) and vector indexing outside the web pathDocling, PyMuPDF, Trafilatura, ProcrastinateHeavy 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)SvelteKitLightweight administration panel separate from user application, Kubernetes ServiceAccount with restricted privileges.
DatabaseApplication data, vector and trigram search, task queue, event log, checkpoints, and versioningPostgreSQL 18, pgvector, pg_trgm, CloudNativePGData, search, queues, events, and checkpoints in one place: fewer parts to operate, RAG in the same database, automatic failover.
Infrastructure foundationOrchestration, routing, TLS, hosting, network protection, monitoring, alertingK3s, 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:

TechnologyRoleWhy this choice
PyJWTAuthentication tokensSessions that can be verified and revoked by version counter.
cryptography (Fernet / AES)Application-level encryption of LLM keysStorage access gives nothing usable without the encryption key.
bcryptPassword hashingNon-reversible credentials.
python-magicDetection of the real file typeVerification before processing.

LLM models:

TechnologyRoleWhy this choice
Anthropic, OpenAI, MistralGeneration models, in BYOKYou 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.

ComponentCPU (requests → limits)Memory (requests → limits)Replicas
Interface (frontend)100m → 1000m256Mi → 1Gi2
API (backend)250m → 2000m512Mi → 2Gi2
Worker500m → 2000m1Gi → 4Gi1
Control panel (tower)100m → 500m256Mi → 512Mi2
PostgreSQL (CNPG)depending on sizingshared_buffers 4 GB, effective_cache_size 12 GB2

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.

ComponentDistributionMechanism
API, interface, control panel1 pod per workerRequired anti-affinity, rolling update maxUnavailable: 1 / maxSurge: 0
PostgreSQL (CNPG)primary + replicaAutomatic failover in 10 to 30 seconds
TraefikDaemonSetOne pod per worker, ports 80/443 in hostNetwork
CoreDNS2 replicasInternal DNS resolution maintained if one node fails
Tunnel connector (for example cloudflared)systemdOne 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.

On this page