Architecture

Service topology and request flow for self-hosted ctx|.

Self-hosted ctx| uses the same product architecture as fully managed ctx|, but the operator owns the runtime, network boundary, secrets, and stateful services. Keep the browser, REST API, auth callbacks, and MCP endpoint on the same public backend origin.

Request flow

  1. The browser opens your public AUTH_BASE_URL.
  2. The backend serves API, auth, webhook, and MCP routes from that origin.
  3. The backend proxies UI requests to the ui service.
  4. Auth sessions, repository records, connections, and workflow state live in Postgres.
  5. Repository ingestion calls codesearch, which clones repositories and maintains Zoekt indexes.
  6. The worker runs OpenWorkflow jobs for ingestion, connector setup, Confluence sync, and Forge provisioning.
  7. Extracted claims and relationships are projected into the configured graph database.
  8. Chat and MCP tools retrieve from Postgres, codesearch, and the graph database before calling your configured model provider.

Services

ServiceDefault portStatefulPurpose
backend3000NoPublic API, auth, MCP, callbacks, UI proxy
ui3002NoProduct web app, proxied by backend
workerinternalNoBackground workflows and connector jobs
codesearch3001YesRepository clone cache and Zoekt index
postgres5432 in container, 5433 on host by defaultYesPrimary relational state
falkordb6379 Redis, 7687 BoltYesDefault graph database
otel-collector4318NoOptional OTLP collector for logs, traces, metrics

Public surface

Expose the backend origin publicly. Keep internal services private unless you have a specific operational need.

Route or endpointPublic?Notes
/YesBackend proxies UI requests
/.auth/*YesBetter Auth routes and provider callbacks
/api/v1/*YesREST API and connector callbacks
/:orgSlug/api/v1/*YesOrganization-scoped REST API
/mcp?orgSlug=...YesStreamable HTTP MCP endpoint
/.statusOptionalBasic backend status endpoint
ui:3002NoInternal service behind backend
codesearch:3001NoInternal service called by backend and workflows
postgres, falkordbNoStateful infrastructure

Stateful data

Back up anything you cannot rebuild quickly.

DataLocationRecovery note
App databasePostgresRequired. Contains users, sessions, repositories, connections, workflow state, and encrypted connector metadata.
Graph dataFalkorDB or another graph databaseBack up for fast recovery. Some graph data may be regenerated by reindexing, but that can be slow and may not cover all operational state.
Repository cacherepo_cache volume in ComposeRebuildable by recloning, but useful to retain.
Zoekt indexzoekt_index_deploy volume in ComposeRebuildable by reindexing, but can be expensive for large repositories.
SecretsDeployment secret store or .env filesRequired to decrypt sessions and connector credentials. Protect and version changes carefully.