Architecture
LM Foundry is a single-page web app in front of a set of Java services. The backend is Java 21, Spring Boot and Spring AI, on reactive (WebFlux) services, built as one Gradle multi-module project. Each service owns its database; the only exception is the knowledge base and its indexer, which share one.
Container view
Section titled “Container view”Browser ─► Foundry UI (React SPA) ──── OIDC sign-in ────► Identity provider
│
│ HTTPS + bearer token
▼
API gateway /api/<service>/v1/... → <service> /v1/...
│
▼
Services chat · knowledge-base · web-crawler · agents · tools · prompts · users · ...
│ │ │
│ RabbitMQ (indexing jobs, crawl events)
│ │
▼ ▼
Internal builtin-tools knowledge-indexer · crawler topology ──► verified websites
│ │
▼ ▼
Stores MongoDB · PostgreSQL + pgvector (or Azure AI Search) · Blob storage · URLFrontier
External Models: Azure OpenAI or any OpenAI-compatible endpoint (LM Studio) · MCP serversServices
Section titled “Services”| Service | Gateway route | Role |
|---|---|---|
| Foundry UI | n/a | React 19 single-page app; signs users in over OpenID Connect and calls the gateway. |
| chat-orchestration | /api/model | Chat completion with streaming, retrieval, tool calling, chat memory, embeddings, images; resolves agents and enforces grounding. |
| knowledge-base | /api/kb | Knowledge bases and their items, uploads, indexing requests. |
| knowledge-indexer | none (worker) | Consumes indexing jobs: parse, chunk, embed, write vectors. |
| web-crawler | /api/web-crawler | Domain verification, website sources, crawl runs, page review, commits pages to the knowledge base. |
| web-crawler-topology | none (worker) | Fetches pages (Apache StormCrawler), extracts Markdown, stores pages, reports events. |
| agent-management | /api/agent | Agents, their grounding settings and the support-agent template. |
| tools-management | /api/tools | Tool definitions, MCP server registry and health checks. |
| builtin-tools | none (service to service) | Calculator, email, web search, fetch page; called only by the chat service. |
| prompt-management | /api/prompt | Prompt library and gallery. |
| app-management | /api/application | Applications. |
| user-management | /api/user | Users, tenants, subscriptions and memberships. |
| authorization-service | internal | Answers who a caller is and which subscriptions they belong to. |
| permission-management-service | /api/permissions | Permissions. |
| deployment-management | /api/deployment | Model catalog and deployments (in development). |
Stores and queues
Section titled “Stores and queues”| Component | Used for |
|---|---|
| MongoDB | Knowledge base catalogue and items, tools, prompts, agents, applications, crawler state. One database per service. |
| PostgreSQL with pgvector | Vectors, chat memory, tenants and memberships, access control, model catalog. |
| Azure AI Search | Optional vector index instead of pgvector. |
| Blob storage (Azure Blob; Azurite locally) | Uploaded files, crawled pages, images. |
| RabbitMQ | Indexing jobs (with a dead-letter queue), crawl events. |
| URLFrontier | Crawl state, one crawl per website source. |
| Identity provider | OpenID Connect sign-in and token validation. The local stack runs Authentik. |
Design rules
Section titled “Design rules”- One asynchronous boundary for documents. Indexing goes through RabbitMQ; everything else is synchronous HTTP.
- No shared databases between services, except knowledge-base and knowledge-indexer.
- Every request is scoped to a subscription, checked once by a shared filter before any controller runs. See Subscriptions and tenants.
- Services call each other with the user’s token, so access checks apply all the way down. System flows (indexing, crawling) use a service account.
The reasoning behind these choices is in Architecture decisions.