# pannagamd/maska-storage architecture

> Architecture diagram of the GitHub repository pannagamd/maska-storage, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pannagamd/maska-storage
- Repository: https://github.com/pannagamd/maska-storage

## Overview

#### Purpose and Entry Points
MaskaStorage is a RAG knowledge-management platform: users ingest URLs/PDFs, then query their stored content in natural language. The current executable backend entry point is FastAPI in `backend/app/main.py`; the browser client mounts React in `frontend/src/main.jsx` and renders the app from `frontend/src/App.jsx`.

#### Client Boundary
The React/Vite frontend owns presentation, interaction state, and HTTP calls only; it must not access databases or execute AI processing. Its main application boundary is `frontend/src/App.jsx`, with styling/bootstrap support in `frontend/src/App.css` and `frontend/src/main.jsx`. It is expected to expose upload, archive, and chat experiences against backend contracts.

#### HTTP API and Coordination Layer
FastAPI routes receive requests and delegate work through dependency/service boundaries rather than embedding domain logic. Defined endpoint surfaces are:
- Upload ingestion: `backend/app/api/routes/upload.py`
- Chat/RAG queries: `backend/app/api/routes/chat.py`
- Archive access: `backend/app/api/routes/archive.py`
- Health checks: `backend/app/api/routes/health.py`

Shared injection/auth-related boundaries are `backend/app/api/dependencies.py` and `backend/app/core/security.py`. `backend/app/main.py` composes the API application.

#### Ingestion Pipeline
The intended upload control flow is URL/PDF submission → extraction → cleaning → chunking → embeddings → summarization/metadata → persistence. The API upload route is present at `backend/app/api/routes/upload.py`, but the planned AI, service, schema, and retrieval directories described in the README are not present in this tree. Those missing layers are the primary implementation gap between HTTP ingestion and storage.

#### Retrieval and Chat Pipeline
The intended chat flow is question → query embedding → ChromaDB similarity search/top-k ranking → prompt construction → LLM answer → response, coordinated by the backend rather than the frontend. The exposed boundary exists at `backend/app/api/routes/chat.py`; dedicated retrieval and AI implementation paths are absent from the current tree. ChromaDB and the LLM are therefore architectural external-service dependencies, not evidenced as integrated code here.

#### Persistence and Runtime Configuration
SQLite persistence is initialized through `backend/app/database/base.py` and `backend/app/database/session.py`. Runtime settings and constants are centralized in `backend/app/core/config.py` and `backend/app/core/constants.py`, with example environment inputs in `backend/.env.example`. The backend uses Python/FastAPI dependencies declared by `backend/requirements.txt`.

#### Deployment and Operational Boundaries
Container deployment is defined in `deployment/Dockerfile` and `deployment/docker-compose.yml`; the stated target infrastructure includes Docker and AWS. API expectations are documented separately in `docs/api_contract.md`, while architecture/setup references live in `docs/architecture.md` and `docs/setup.md`. Health routing provides the intended operational probe boundary via `backend/app/api/routes/health.py`.

Main entry points: [`backend/app/main.py`](https://github.com/pannagamd/maska-storage/blob/main/backend/app/main.py) (FastAPI application), [`frontend/src/App.jsx`](https://github.com/pannagamd/maska-storage/blob/main/frontend/src/App.jsx) (React application), [`backend/app/api/routes/upload.py`](https://github.com/pannagamd/maska-storage/blob/main/backend/app/api/routes/upload.py) (Upload API), [`backend/app/api/routes/chat.py`](https://github.com/pannagamd/maska-storage/blob/main/backend/app/api/routes/chat.py) (Chat API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser Client"]
  node_react_app["React application<br/>React/Vite UI<br/>[App.jsx]"]
  node_client_bootstrap["Client bootstrap<br/>React entry<br/>[main.jsx]"]
end

subgraph group_api["Backend API"]
  node_fastapi_app["FastAPI application<br/>API composition<br/>[main.py]"]
  node_upload_route["Upload API<br/>route<br/>[upload.py]"]
  node_chat_route["Chat API<br/>route<br/>[chat.py]"]
  node_archive_route["Archive API<br/>route<br/>[archive.py]"]
  node_health_route["Health API<br/>route<br/>[health.py]"]
  node_api_dependencies["API dependencies<br/>injection/auth boundary<br/>[dependencies.py]"]
  node_security["Security<br/>auth support<br/>[security.py]"]
end

subgraph group_planned["Planned RAG Services"]
  node_ingestion_pipeline["Ingestion pipeline<br/>planned service"]
  node_retrieval_pipeline["RAG retrieval<br/>planned service"]
end

subgraph group_runtime["Runtime &amp; Operations"]
  node_sqlite[("SQLite persistence<br/>database layer<br/>[session.py]")]
  node_chromadb[("ChromaDB<br/>vector database")]
  node_llm{{"LLM<br/>AI service"}}
  node_runtime_config["Runtime configuration<br/>settings<br/>[config.py]"]
  node_container_deployment["Container deployment<br/>Docker deployment<br/>[docker-compose.yml]"]
  node_api_contract["API contract<br/>documentation<br/>[api_contract.md]"]
end

node_client_bootstrap -->|"mounts"| node_react_app
node_react_app -->|"HTTP requests"| node_fastapi_app
node_fastapi_app -->|"serves"| node_upload_route
node_fastapi_app -->|"serves"| node_chat_route
node_fastapi_app -->|"serves"| node_archive_route
node_fastapi_app -->|"serves"| node_health_route
node_fastapi_app -->|"uses"| node_api_dependencies
node_api_dependencies -->|"auth support"| node_security
node_upload_route -.->|"submit URL/PDF"| node_ingestion_pipeline
node_ingestion_pipeline -.->|"persist metadata/content"| node_sqlite
node_ingestion_pipeline -.->|"store embeddings"| node_chromadb
node_chat_route -.->|"answer question"| node_retrieval_pipeline
node_retrieval_pipeline -.->|"similarity search"| node_chromadb
node_retrieval_pipeline -.->|"prompt and answer"| node_llm
node_archive_route -->|"read archive"| node_sqlite
node_fastapi_app -->|"loads settings"| node_runtime_config
node_container_deployment -->|"runs backend"| node_fastapi_app
node_api_contract -.->|"documents"| node_fastapi_app

click node_react_app "https://github.com/pannagamd/maska-storage/blob/main/frontend/src/App.jsx"
click node_client_bootstrap "https://github.com/pannagamd/maska-storage/blob/main/frontend/src/main.jsx"
click node_fastapi_app "https://github.com/pannagamd/maska-storage/blob/main/backend/app/main.py"
click node_upload_route "https://github.com/pannagamd/maska-storage/blob/main/backend/app/api/routes/upload.py"
click node_chat_route "https://github.com/pannagamd/maska-storage/blob/main/backend/app/api/routes/chat.py"
click node_archive_route "https://github.com/pannagamd/maska-storage/blob/main/backend/app/api/routes/archive.py"
click node_health_route "https://github.com/pannagamd/maska-storage/blob/main/backend/app/api/routes/health.py"
click node_api_dependencies "https://github.com/pannagamd/maska-storage/blob/main/backend/app/api/dependencies.py"
click node_security "https://github.com/pannagamd/maska-storage/blob/main/backend/app/core/security.py"
click node_sqlite "https://github.com/pannagamd/maska-storage/blob/main/backend/app/database/session.py"
click node_runtime_config "https://github.com/pannagamd/maska-storage/blob/main/backend/app/core/config.py"
click node_container_deployment "https://github.com/pannagamd/maska-storage/blob/main/deployment/docker-compose.yml"
click node_api_contract "https://github.com/pannagamd/maska-storage/blob/main/docs/api_contract.md"

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_react_app,node_client_bootstrap toneBlue
class node_fastapi_app,node_upload_route,node_chat_route,node_archive_route,node_health_route,node_api_dependencies,node_security toneAmber
class node_ingestion_pipeline,node_retrieval_pipeline toneMint
class node_sqlite,node_chromadb,node_llm,node_runtime_config,node_container_deployment,node_api_contract toneRose
```

## Components

### Browser Client

- [React application](https://github.com/pannagamd/maska-storage/blob/main/frontend/src/App.jsx): React/Vite UI · Presents upload, archive, and chat experiences. · `frontend/src/App.jsx`
- [Client bootstrap](https://github.com/pannagamd/maska-storage/blob/main/frontend/src/main.jsx): React entry · `frontend/src/main.jsx`

### Backend API

- [FastAPI application](https://github.com/pannagamd/maska-storage/blob/main/backend/app/main.py): API composition · `backend/app/main.py`
- [Upload API](https://github.com/pannagamd/maska-storage/blob/main/backend/app/api/routes/upload.py): route · `backend/app/api/routes/upload.py`
- [Chat API](https://github.com/pannagamd/maska-storage/blob/main/backend/app/api/routes/chat.py): route · `backend/app/api/routes/chat.py`
- [Archive API](https://github.com/pannagamd/maska-storage/blob/main/backend/app/api/routes/archive.py): route · `backend/app/api/routes/archive.py`
- [Health API](https://github.com/pannagamd/maska-storage/blob/main/backend/app/api/routes/health.py): route · `backend/app/api/routes/health.py`
- [API dependencies](https://github.com/pannagamd/maska-storage/blob/main/backend/app/api/dependencies.py): injection/auth boundary · `backend/app/api/dependencies.py`
- [Security](https://github.com/pannagamd/maska-storage/blob/main/backend/app/core/security.py): auth support · `backend/app/core/security.py`

### Planned RAG Services

Missing implementation layers between routes and storage.

- **Ingestion pipeline**: planned service · Extracts, cleans, chunks, embeds, summarizes, and persists submitted content.
- **RAG retrieval**: planned service · Embeds questions, retrieves top-k context, builds prompts, and generates answers.

### Runtime & Operations

- [SQLite persistence](https://github.com/pannagamd/maska-storage/blob/main/backend/app/database/session.py): database layer · `backend/app/database/session.py`
- **ChromaDB**: vector database · External dependency; no integration code is present.
- **LLM**: AI service · External dependency; no integration code is present.
- [Runtime configuration](https://github.com/pannagamd/maska-storage/blob/main/backend/app/core/config.py): settings · `backend/app/core/config.py`
- [Container deployment](https://github.com/pannagamd/maska-storage/blob/main/deployment/docker-compose.yml): Docker deployment · `deployment/docker-compose.yml`
- [API contract](https://github.com/pannagamd/maska-storage/blob/main/docs/api_contract.md): documentation · `docs/api_contract.md`

## Connections

- Client bootstrap → React application: mounts
- React application → FastAPI application: HTTP requests
- FastAPI application → Upload API: serves
- FastAPI application → Chat API: serves
- FastAPI application → Archive API: serves
- FastAPI application → Health API: serves
- FastAPI application → API dependencies: uses
- API dependencies → Security: auth support
- Upload API → Ingestion pipeline: submit URL/PDF
- Ingestion pipeline → SQLite persistence: persist metadata/content
- Ingestion pipeline → ChromaDB: store embeddings
- Chat API → RAG retrieval: answer question
- RAG retrieval → ChromaDB: similarity search
- RAG retrieval → LLM: prompt and answer
- Archive API → SQLite persistence: read archive
- FastAPI application → Runtime configuration: loads settings
- Container deployment → FastAPI application: runs backend
- API contract → FastAPI application: documents
