# noovoy-ai/northwestern-rag-backend architecture

> Architecture diagram of the GitHub repository noovoy-ai/northwestern-rag-backend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/noovoy-ai/northwestern-rag-backend
- Repository: https://github.com/noovoy-ai/northwestern-rag-backend

## Overview

#### Purpose and Entrypoint
This is a Python retrieval-augmented question-answering service over handbook/manual content. The runtime entrypoint is `main.py`; its browser-facing interface is `static/index.html`. Source material, chunk artifacts, and a persisted Chroma vector database are committed alongside the service.

#### Query/API Layer
`main.py` likely owns application startup, request handling, retrieval invocation, and response generation. It forms the boundary between the static client at `static/index.html` and backend AI/vector dependencies. Environment-provided credentials are modeled by `.env.example`.

#### Document Ingestion Pipeline
Content is prepared through dedicated ingestion scripts:
- `ingest.py`
- `ingest_manual.py`
- `handbook_vectordb_ready.md`

These stages convert the handbook/manual into retrieval-ready chunks and populate the vector store. `manual_chunks.json` is an intermediate or inspectable chunk representation, while `all.md` appears to be a consolidated source document.

#### Persistent Vector Retrieval Store
Chroma is the system’s durable retrieval boundary. Its persisted local state is under:
- `chroma_db/chroma.sqlite3`
- `chroma_db/91b81201-fb56-4dd5-a54b-ed174626aace/data_level0.bin`
- `chroma_db/a68aae4c-635f-4534-b922-0e09514fd3a3/link_lists.bin`

The application queries this embedded database at runtime; ingestion mutates it. This makes vector data a deployable stateful artifact rather than an externally managed database.

#### Export/Portability Path
`export_db.py` exports the persisted vector collection, with `vectordb_export.json` serving as an interchange or backup artifact. This provides a path to inspect, migrate, or reconstruct retrieval data independently of the binary Chroma files.

#### Runtime and Deployment
The application is containerized by `Dockerfile` and composed through `docker-compose.yml`, likely including persistent storage for the local Chroma directory. Python dependencies are declared in `requirements.txt`. CI/CD deployment automation is defined in `.github/workflows/deploy.yml`.

#### Primary Flow and Boundaries
1. Manual content in `all.md`/`handbook_vectordb_ready.md` is chunked by ingestion scripts.
2. Chunks and embeddings are persisted to `chroma_db/`.
3. A user interacts through `static/index.html`.
4. `main.py` receives the query, retrieves relevant chunks from Chroma, and uses configured AI services to produce an answer.
5. Retrieval artifacts can be exported through `export_db.py`.

Key boundaries are browser-to-backend HTTP, backend-to-vector-store retrieval, and backend-to-external model/embedding services configured via environment variables.

Main entry points: [`main.py`](https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/main.py) (QA application), [`chroma_db/chroma.sqlite3`](https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/chroma_db/chroma.sqlite3) (Chroma vector store), [`docker-compose.yml`](https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/docker-compose.yml) (Service composition), [`manual_chunks.json`](https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/manual_chunks.json) (Manual chunks)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingestion["Ingestion pipeline"]
  node_source_manual["Consolidated manual<br/>source content<br/>[all.md]"]
  node_prepared_manual["Prepared handbook<br/>source content"]
  node_ingest["General ingestion<br/>Python pipeline<br/>[ingest.py]"]
  node_manual_ingest["Manual ingestion<br/>Python pipeline<br/>[ingest_manual.py]"]
  node_chunks["Manual chunks<br/>chunk artifact<br/>[manual_chunks.json]"]
end

subgraph group_runtime["Query runtime"]
  node_browser["Browser client<br/>static UI<br/>[index.html]"]
  node_api["QA application<br/>Python service<br/>[main.py]"]
  node_credentials["AI credentials<br/>environment contract<br/>[.env.example]"]
  node_ai_services{{"Model and embedding APIs<br/>external AI service"}}
end

subgraph group_storage["Persistent retrieval data"]
  node_chroma[("Chroma vector store<br/>embedded vector database<br/>[chroma.sqlite3]")]
  node_vector_data[("Vector index files<br/>Chroma binary index<br/>[data_level0.bin]")]
  node_exporter["Vector store export<br/>Python export tool<br/>[export_db.py]"]
  node_export["Portable collection export<br/>backup artifact"]
end

subgraph group_delivery["Container and deployment"]
  node_container["Application image<br/>container build"]
  node_compose["Service composition<br/>container runtime<br/>[docker-compose.yml]"]
  node_dependencies["Python dependencies<br/>dependency manifest<br/>[requirements.txt]"]
  node_deployment["Deployment workflow<br/>CI/CD workflow<br/>[deploy.yml]"]
end

node_browser -->|"HTTP queries"| node_api
node_api -->|"similarity retrieval"| node_chroma
node_api -->|"answer generation"| node_ai_services
node_api -.->|"loads credentials"| node_credentials
node_source_manual -->|"ingests"| node_ingest
node_prepared_manual -->|"ingests"| node_manual_ingest
node_ingest -->|"creates chunks"| node_chunks
node_manual_ingest -->|"creates chunks"| node_chunks
node_chunks -->|"embeds and persists"| node_chroma
node_chroma -->|"stores vectors"| node_vector_data
node_chroma -->|"exports collection"| node_exporter
node_exporter -->|"writes"| node_export
node_dependencies -.->|"installed during build"| node_container
node_container -->|"runs image"| node_compose
node_compose -->|"hosts service"| node_api
node_compose -->|"persists local state"| node_chroma
node_deployment -->|"deploys"| node_compose

click node_browser "https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/static/index.html"
click node_api "https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/main.py"
click node_credentials "https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/.env.example"
click node_source_manual "https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/all.md"
click node_prepared_manual "https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/handbook_vectordb_ready.md"
click node_ingest "https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/ingest.py"
click node_manual_ingest "https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/ingest_manual.py"
click node_chunks "https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/manual_chunks.json"
click node_chroma "https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/chroma_db/chroma.sqlite3"
click node_vector_data "https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/chroma_db/91b81201-fb56-4dd5-a54b-ed174626aace/data_level0.bin"
click node_exporter "https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/export_db.py"
click node_export "https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/vectordb_export.json"
click node_container "https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/Dockerfile"
click node_compose "https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/docker-compose.yml"
click node_dependencies "https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/requirements.txt"
click node_deployment "https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/.github/workflows/deploy.yml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_source_manual,node_prepared_manual,node_ingest,node_manual_ingest,node_chunks toneBlue
class node_browser,node_api,node_credentials,node_ai_services toneAmber
class node_chroma,node_vector_data,node_exporter,node_export toneMint
class node_container,node_compose,node_dependencies,node_deployment toneRose
```

## Components

### Ingestion pipeline

- [Consolidated manual](https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/all.md): source content · `all.md`
- [Prepared handbook](https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/handbook_vectordb_ready.md): source content · `handbook_vectordb_ready.md`
- [General ingestion](https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/ingest.py): Python pipeline · `ingest.py`
- [Manual ingestion](https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/ingest_manual.py): Python pipeline · `ingest_manual.py`
- [Manual chunks](https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/manual_chunks.json): chunk artifact · `manual_chunks.json`

### Query runtime

- [Browser client](https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/static/index.html): static UI · `static/index.html`
- [QA application](https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/main.py): Python service · Handles queries, retrieval, and answer generation. · `main.py`
- [AI credentials](https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/.env.example): environment contract · `.env.example`
- **Model and embedding APIs**: external AI service

### Persistent retrieval data

- [Chroma vector store](https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/chroma_db/chroma.sqlite3): embedded vector database · Durable local retrieval state queried at runtime and written by ingestion. · `chroma_db/chroma.sqlite3`
- [Vector index files](https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/chroma_db/91b81201-fb56-4dd5-a54b-ed174626aace/data_level0.bin): Chroma binary index · `chroma_db/91b81201-fb56-4dd5-a54b-ed174626aace/data_level0.bin`
- [Vector store export](https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/export_db.py): Python export tool · `export_db.py`
- [Portable collection export](https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/vectordb_export.json): backup artifact · `vectordb_export.json`

### Container and deployment

- [Application image](https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/Dockerfile): container build · `Dockerfile`
- [Service composition](https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/docker-compose.yml): container runtime · Runs the application with persistent local vector data. · `docker-compose.yml`
- [Python dependencies](https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/requirements.txt): dependency manifest · `requirements.txt`
- [Deployment workflow](https://github.com/noovoy-ai/northwestern-rag-backend/blob/main/.github/workflows/deploy.yml): CI/CD workflow · `.github/workflows/deploy.yml`

## Connections

- Browser client → QA application: HTTP queries
- QA application → Chroma vector store: similarity retrieval
- QA application → Model and embedding APIs: answer generation
- QA application → AI credentials: loads credentials
- Consolidated manual → General ingestion: ingests
- Prepared handbook → Manual ingestion: ingests
- General ingestion → Manual chunks: creates chunks
- Manual ingestion → Manual chunks: creates chunks
- Manual chunks → Chroma vector store: embeds and persists
- Chroma vector store → Vector index files: stores vectors
- Chroma vector store → Vector store export: exports collection
- Vector store export → Portable collection export: writes
- Python dependencies → Application image: installed during build
- Application image → Service composition: runs image
- Service composition → QA application: hosts service
- Service composition → Chroma vector store: persists local state
- Deployment workflow → Service composition: deploys
