# advanced-ml-engineering/portfolio-rag-api architecture

> Architecture diagram of the GitHub repository advanced-ml-engineering/portfolio-rag-api, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/advanced-ml-engineering/portfolio-rag-api
- Repository: https://github.com/advanced-ml-engineering/portfolio-rag-api

## Overview

This repository is currently a FastAPI backend skeleton for the “Ask About Me” portfolio RAG assistant. Its implemented user-to-result workflow is a health request routed through the app to live Qdrant and DynamoDB checks, with an optional G4F check, then a typed health response. The README also documents planned ingestion, cited chat, and admin capabilities; those are shown as planned subsystems, not implemented call paths. Source excerpts support the health relationships; planned links are dashed and unverified.

Main entry points: [`app/routers/health.py`](https://github.com/advanced-ml-engineering/portfolio-rag-api/blob/main/app/routers/health.py) (Health endpoint), [`app/services/health.py`](https://github.com/advanced-ml-engineering/portfolio-rag-api/blob/main/app/services/health.py) (Dependency checks), [`app/routers`](https://github.com/advanced-ml-engineering/portfolio-rag-api/tree/main/app/routers) (Chat endpoint), [`app/main.py`](https://github.com/advanced-ml-engineering/portfolio-rag-api/blob/main/app/main.py) (FastAPI app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["API runtime"]
  node_vercel["Vercel entrypoint<br/>[index.py]"]
  node_app["FastAPI app<br/>[main.py]"]
  node_settings["Application settings<br/>[config.py]"]
end

subgraph group_health["Health checks"]
  node_health_route["Health endpoint<br/>[health.py]"]
  node_health_checker["Dependency checks<br/>[health.py]"]
  node_health_schema["Health response models<br/>[schemas.py]"]
  node_clients["Cached service clients<br/>[clients.py]"]
  node_llm_wrapper["G4F wrapper<br/>[llm.py]"]
end

subgraph group_rag["RAG capabilities"]
  node_github_sources["GitHub repositories"]
  node_ingestion["Ingestion"]
  node_chunking["Chunking and indexing"]
  node_metadata[("Document metadata")]
  node_chat["Chat endpoint"]
  node_retrieval["Context retrieval"]
  node_citations["Cited answer<br/>[schemas.py]"]
end

subgraph group_admin["Administration"]
  node_admin["Admin login and endpoints"]
end

node_user(("API caller"))
node_qdrant[("Qdrant Cloud")]
node_dynamodb[("DynamoDB")]
node_g4f["G4F provider"]

node_user -->|"requests"| node_vercel
node_vercel -->|"loads app"| node_app
node_app -->|"registers router"| node_health_route
node_app -->|"loads settings"| node_settings
node_health_route -->|"runs checks"| node_health_checker
node_health_route -->|"reads settings"| node_settings
node_health_route -->|"returns model"| node_health_schema
node_health_checker -->|"reads settings"| node_settings
node_health_checker -->|"gets clients"| node_clients
node_clients -->|"checks collections"| node_qdrant
node_clients -->|"describes table"| node_dynamodb
node_health_checker -->|"checks deeply"| node_llm_wrapper
node_llm_wrapper -->|"requests completion"| node_g4f
node_github_sources -.->|"supplies repositories"| node_ingestion
node_ingestion -.->|"chunks documents"| node_chunking
node_chunking -.->|"upserts vectors"| node_qdrant
node_ingestion -.->|"stores metadata"| node_metadata
node_user -.->|"asks question"| node_chat
node_chat -.->|"retrieves context"| node_retrieval
node_retrieval -.->|"searches vectors"| node_qdrant
node_chat -.->|"generates answer"| node_llm_wrapper
node_chat -.->|"returns citations"| node_citations
node_user -.->|"admin requests"| node_admin

click node_vercel "https://github.com/advanced-ml-engineering/portfolio-rag-api/blob/main/api/index.py"
click node_app "https://github.com/advanced-ml-engineering/portfolio-rag-api/blob/main/app/main.py"
click node_settings "https://github.com/advanced-ml-engineering/portfolio-rag-api/blob/main/app/config.py"
click node_health_route "https://github.com/advanced-ml-engineering/portfolio-rag-api/blob/main/app/routers/health.py"
click node_health_checker "https://github.com/advanced-ml-engineering/portfolio-rag-api/blob/main/app/services/health.py"
click node_health_schema "https://github.com/advanced-ml-engineering/portfolio-rag-api/blob/main/app/schemas.py"
click node_clients "https://github.com/advanced-ml-engineering/portfolio-rag-api/blob/main/app/services/clients.py"
click node_llm_wrapper "https://github.com/advanced-ml-engineering/portfolio-rag-api/blob/main/app/services/llm.py"
click node_ingestion "https://github.com/advanced-ml-engineering/portfolio-rag-api/tree/main/app/services"
click node_chunking "https://github.com/advanced-ml-engineering/portfolio-rag-api/tree/main/app/services"
click node_metadata "https://github.com/advanced-ml-engineering/portfolio-rag-api/tree/main/app/services"
click node_chat "https://github.com/advanced-ml-engineering/portfolio-rag-api/tree/main/app/routers"
click node_retrieval "https://github.com/advanced-ml-engineering/portfolio-rag-api/tree/main/app/services"
click node_citations "https://github.com/advanced-ml-engineering/portfolio-rag-api/blob/main/app/schemas.py"
click node_admin "https://github.com/advanced-ml-engineering/portfolio-rag-api/tree/main/app/routers"

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_vercel,node_app,node_settings toneBlue
class node_health_route,node_health_checker,node_health_schema,node_clients,node_llm_wrapper,node_qdrant,node_dynamodb toneAmber
class node_github_sources,node_ingestion,node_chunking,node_metadata,node_chat,node_retrieval,node_citations,node_user toneMint
class node_admin toneRose
class node_g4f toneIndigo
```

## Components

### API runtime

- [Vercel entrypoint](https://github.com/advanced-ml-engineering/portfolio-rag-api/blob/main/api/index.py): `api/index.py`
- [FastAPI app](https://github.com/advanced-ml-engineering/portfolio-rag-api/blob/main/app/main.py): `app/main.py`
- [Application settings](https://github.com/advanced-ml-engineering/portfolio-rag-api/blob/main/app/config.py): `app/config.py`

### Health checks

- [Health endpoint](https://github.com/advanced-ml-engineering/portfolio-rag-api/blob/main/app/routers/health.py): `app/routers/health.py`
- [Dependency checks](https://github.com/advanced-ml-engineering/portfolio-rag-api/blob/main/app/services/health.py): `app/services/health.py`
- [Health response models](https://github.com/advanced-ml-engineering/portfolio-rag-api/blob/main/app/schemas.py): `app/schemas.py`
- [Cached service clients](https://github.com/advanced-ml-engineering/portfolio-rag-api/blob/main/app/services/clients.py): `app/services/clients.py`
- [G4F wrapper](https://github.com/advanced-ml-engineering/portfolio-rag-api/blob/main/app/services/llm.py): `app/services/llm.py`

### RAG capabilities

- **GitHub repositories**
- [Ingestion](https://github.com/advanced-ml-engineering/portfolio-rag-api/tree/main/app/services): `app/services`
- [Chunking and indexing](https://github.com/advanced-ml-engineering/portfolio-rag-api/tree/main/app/services): `app/services`
- [Document metadata](https://github.com/advanced-ml-engineering/portfolio-rag-api/tree/main/app/services): `app/services`
- [Chat endpoint](https://github.com/advanced-ml-engineering/portfolio-rag-api/tree/main/app/routers): `app/routers`
- [Context retrieval](https://github.com/advanced-ml-engineering/portfolio-rag-api/tree/main/app/services): `app/services`
- [Cited answer](https://github.com/advanced-ml-engineering/portfolio-rag-api/blob/main/app/schemas.py): `app/schemas.py`

### Administration

- [Admin login and endpoints](https://github.com/advanced-ml-engineering/portfolio-rag-api/tree/main/app/routers): `app/routers`

### Other components

- **API caller**
- **Qdrant Cloud**
- **DynamoDB**
- **G4F provider**

## Connections

- API caller → Vercel entrypoint: requests (evidence: `api/index.py`)
- Vercel entrypoint → FastAPI app: loads app (evidence: `api/index.py`)
- FastAPI app → Health endpoint: registers router (evidence: `app/main.py`)
- FastAPI app → Application settings: loads settings (evidence: `app/main.py`)
- Health endpoint → Dependency checks: runs checks (evidence: `app/routers/health.py`)
- Health endpoint → Application settings: reads settings (evidence: `app/routers/health.py`)
- Health endpoint → Health response models: returns model (evidence: `app/routers/health.py`)
- Dependency checks → Application settings: reads settings (evidence: `app/services/health.py`)
- Dependency checks → Cached service clients: gets clients (evidence: `app/services/health.py`)
- Cached service clients → Qdrant Cloud: checks collections
- Cached service clients → DynamoDB: describes table
- Dependency checks → G4F wrapper: checks deeply (evidence: `app/services/health.py`)
- G4F wrapper → G4F provider: requests completion (evidence: `app/services/llm.py`)
- GitHub repositories → Ingestion: supplies repositories (evidence: `README.md`)
- Ingestion → Chunking and indexing: chunks documents (evidence: `README.md`)
- Chunking and indexing → Qdrant Cloud: upserts vectors (evidence: `README.md`)
- Ingestion → Document metadata: stores metadata (evidence: `README.md`)
- API caller → Chat endpoint: asks question (evidence: `README.md`)
- Chat endpoint → Context retrieval: retrieves context (evidence: `README.md`)
- Context retrieval → Qdrant Cloud: searches vectors (evidence: `README.md`)
- Chat endpoint → G4F wrapper: generates answer (evidence: `README.md`)
- Chat endpoint → Cited answer: returns citations (evidence: `README.md`)
- API caller → Admin login and endpoints: admin requests (evidence: `README.md`)
