Example: an AI document desk
This is a stack the Stacktic team runs to test the platform and the MCP. A web application answers questions about the documents it stores, publishes an event for every document it ingests, and a nightly job writes a digest with the same self-hosted model. Every connection below is a link on its diagram; nothing was wired by hand.
The design
22 components. Names are the ones on the diagram.
| Layer | Cells |
|---|---|
| Applications | signal-desk (external source code, FastAPI, port 8080) · signal-digest (external source code, Python, port 8080) |
| Who reaches them | apisix with 8 routes · keycloak-operator with 3 clients: signal-desk-client, openwebui-client, and client for the MCP server |
| Data and events | cnpg with the databases signal-db and dagster-db · kafka with the topic doc-ingested · qdrant with the collection docs · valkey |
| Models | vllm with two model sub-components, qwen3-8b and bge-m3 · two AI gateway sub-components on apisix, ai-chat and ai-embed · open-webui · langflow |
| Jobs | dagster with the sensor doc-ingested-sensor and the job nightly-digest |
| Storage | seaweedfs with the buckets cnpg-backups and loki-logs |
| Observability | prometheus (12 scrape links) · grafana · loki · alloy |
| Delivery | argo-cd (21 links) · reloader · cert-manager |
| Operations | stack-agent · fastmcp |
What signal-desk's links generate
The application's code reads its configuration from environment variables. Every one of them comes from a link; none is typed by hand.
| Link on the diagram | In signal-desk's environment | Elsewhere in the stack |
|---|---|---|
apisix-external_source_code, subdomain desk, apisix_oidc_enable on | — | The route desk.<domain> with TLS. Because login is on and the application links a Keycloak client, the route gets an openid-connect plugin built from that client: nobody reaches the application without signing in |
external_source_code-client to signal-desk-client | OIDC_ISSUER_URL, OIDC_DISCOVERY_URL, OIDC_REALM, OIDC_CLIENT_ID, OIDC_CLIENT_SECRET, OIDC_REDIRECT_URIS | The client in Keycloak, created and kept in line by the Keycloak sync Job |
external_source_code-db to signal-db | DATABASE_URL (the FastAPI form) | The database and its user in the CloudNativePG cluster |
external_source_code-topic to doc-ingested | KAFKA_BOOTSTRAP_SERVERS, KAFKA_TOPICS, KAFKA_SECURITY_PROTOCOL and the TLS file locations | With the Kafka component's mtls on, a TLS user with ACLs per client and its certificate in the application's namespace. This stack runs with mtls off |
external_source_code-collection to docs | QDRANT_HOST, QDRANT_PORT, QDRANT_URL, QDRANT_COLLECTION, QDRANT_VECTOR_SIZE | The collection, created and reconciled by Qdrant's init Job from the sub-component |
external_source_code-valkey | REDIS_URL | — (the application uses it for its own rate limit and an answer cache) |
external_source_code-ai_gateway to ai-chat and to ai-embed | AI_GATEWAY_URL, AI_GATEWAY_MODEL, AI_GATEWAY_API_KEY, AI_GATEWAY_API_KEY_HEADER from the first link, and one complete set per gateway: AI_CHAT_AI_GATEWAY_* and AI_EMBED_AI_GATEWAY_* | — |
argo_cd-external_source_code | — | An Argo CD Application for the component |
The per-gateway names are the gateway sub-component's name in upper case with dashes as
underscores. An application with a single gateway link gets only the plain AI_GATEWAY_* set.
The models
Each AI gateway sub-component is one route on the gateway to one served model:
| Gateway route | Link | Model | Also used by |
|---|---|---|---|
ai-chat | ai_gateway-model | qwen3-8b | signal-digest, Open WebUI (open_webui-model), Langflow (langflow-model) |
ai-embed | ai_gateway-model | bge-m3 | — |
The application only ever talks to the gateway, so the key stays server-side and the gateway applies its key auth, prompt guard and token budget — see Private AI.
The event chain
The second application is started by events, not by a person.
| Link | What it generates |
|---|---|
external_source_code-topic | signal-desk's Kafka configuration, above; the application publishes an ingest event per document |
topic-db (topic doc-ingested to database signal-db) | A Kafka Connect cluster and a sink connector that writes every event into the database, with the statement in the link's sink_query attribute (here an audit table) |
topic-sensor (topic to Dagster sensor) | A Dagster sensor on that topic, generated with default_status=RUNNING, so it evaluates from the first daemon tick |
sensor-job (sensor to job) | The sensor starts nightly-digest |
job-external_source_code (job to signal-digest) | The job runs the signal-digest image as a Kubernetes job, in that component's namespace |
dagster-db | Dagster's own storage, in the database dagster-db |
signal-digest then reads signal-db and calls ai-chat through its own two links. No consumer
loop, connector definition or scheduler entry was written by hand.
Around it
| Concern | On the diagram | What it gives this stack |
|---|---|---|
| Delivery | argo-cd linked to 21 components · reloader | One Application per component; a changed Secret or ConfigMap restarts the pods that read it. The applications have push_and_deploy on: the build Job rolls the Deployment onto the image it just pushed |
| Images | Stack configuration: BuildKit, cache_build on | In-cluster builds with a layer cache, so a code-only change reuses the dependency layers |
| Metrics | prometheus linked to 12 components · grafana-prometheus | Scrape configuration, alert rules and dashboards for each linked component |
| Logs | alloy-loki · grafana-loki · loki-swbucket to loki-logs | Logs from every pod, stored in a bucket, queried in Grafana |
| Backups | cnpg-swbucket to cnpg-backups | The database's backups in a bucket |
| Operations | fastmcp linked to client, argo-cd, stack-agent, valkey, langflow | An MCP server behind Keycloak login, with Argo CD runtime tools, the stack agent's scans, persistent OAuth client storage and Langflow flow tools |
| Validation | stack-agent, deploy_access on | Link tests for every link above; a deploy arm that applies committed branches |
Security in this stack
| Layer | Setting |
|---|---|
| Login | The application route requires a Keycloak login, built from the client link |
| Workload | Both applications carry pod_security, drop_capabilities, no_privilege_escalation, read_only_fs and seccomp |
| Build | build_gate set to enforce: a source scan finding blocks the build; sast_gate off |
| Network | The standard generated network policies (the stack's microsegmentation_level is not set, which means the standard set) |
How it was built
The application code lives on the stack repository's build branch under apps/signal-desk and
apps/signal-digest. It was written and committed there by the MCP server, each commit signed
"Stacktic MCP". The generated files come from the platform's branch and are merged in on every
build — see The stack repository.