Skip to content

System Architecture

This reference implementation is a Retrieval-Augmented Generation system: it embeds a question, retrieves the most similar chunks from a vector store, and asks an LLM to answer using only those chunks, with citations.

Model

The interactive C4 model below is rendered live from the architecture/ directory via the LikeC4 Vite plugin.

Components

ComponentTechnologyRole
Web UIReact + Vite on S3 + CloudFrontAsk a question; show the answer and source chunks
RAG APIFastAPI on Lambda (Mangum), API Gateway HTTP APIEmbed query, retrieve, synthesize answer
Vector storeAurora Serverless v2 + pgvector (RDS Data API)Document chunks and their embeddings
IngestionPython (Bedrock Titan)Load corpus, chunk, embed, upsert
ModelsAWS Bedrock (Titan embeddings, Claude)Embeddings and generation
Corpusneural-bridge/rag-dataset-12000 (Apache-2.0)Source knowledge

Why these choices

The system optimizes for near-zero idle cost. Aurora Serverless v2 with 0-ACU auto-pause lets the vector store scale to zero, and Bedrock is pay-per-token with no idle charge. See the cost model, infrastructure, and the Decisions (ADRs) section in the sidebar for the full rationale.

Containers

A more detailed view of the system internals:

Query sequence

Step-by-step flow of a single query through the system:

Ingestion

Corpus ingestion runs as a local script during development and as a one-off Lambda invocation in AWS: