# roxxsujal7/brambedkar architecture

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

- Interactive diagram: https://gitdiagram.com/roxxsujal7/brambedkar
- Repository: https://github.com/roxxsujal7/brambedkar

## Overview

The Dr. B. R. Ambedkar Digital Heritage Archive is a research and public-access platform for the BAWS corpus and related historical material. Visitors browse volumes, letters, media, debates, memorials and vows; they can search across collections, read or stream documents, and use OCR or a grounded assistant. Accounts support researcher workflows such as bookmarks and reading progress. The frontend and Express API provide the user-to-result path, with MongoDB-backed models and local catalog fallbacks. README capabilities are represented where routes or frontend modules identify them; unsampled route internals and external-service wiring are not inferred.

Main entry points: [`ambedkar-archive/frontend/js/app.js`](https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/frontend/js/app.js) (Web application), [`ambedkar-archive/backend/server.js`](https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/backend/server.js) (Express application), [`ambedkar-archive/frontend/js/api.js`](https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/frontend/js/api.js) (API client), [`ambedkar-archive/backend/config/db.js`](https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/backend/config/db.js) (MongoDB)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Archive experience"]
  node_frontend["Web application<br/>[app.js]"]
  node_archive_ui["Works reader<br/>[archive.js]"]
  node_reader_ui["Document reader<br/>[reader.js]"]
  node_letters_ui["Letters browser<br/>[letters.js]"]
  node_media_ui["Speeches and media<br/>[media.js]"]
  node_search_ui["Archive search<br/>[search.js]"]
  node_assistant_ui["AI assistant<br/>[assistant.js]"]
  node_ocr_ui["Manuscript OCR<br/>[ocr.js]"]
  node_timeline_ui["Historical timeline<br/>[timeline.js]"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_api["API and domain"]
  node_server["Express application<br/>[server.js]"]
  node_documents["Document catalog<br/>[documents.js]"]
  node_document_service["Catalog service<br/>[documentService.js]"]
  node_search["Unified search<br/>[search.js]"]
  node_hybrid_search["Hybrid retrieval"]
  node_chat["Assistant endpoint<br/>[chat.js]"]
  node_feature_routes["Heritage features"]
end

subgraph group_identity["Identity and research"]
  node_auth_routes["Authentication routes<br/>[auth.js]"]
  node_user_service["User service<br/>[userService.js]"]
  node_auth_guard["JWT access control<br/>[auth.js]"]
  node_bookmarks["Bookmarks<br/>[bookmarks.js]"]
  node_progress["Reading progress<br/>[progress.js]"]
end

subgraph group_platform["Persistence and integrations"]
  node_database[("MongoDB<br/>[db.js]")]
  node_document_model["Document records<br/>[Document.js]"]
  node_user_model["User records<br/>[User.js]"]
  node_bookmark_model["Bookmark records<br/>[Bookmark.js]"]
  node_progress_model["Progress records<br/>[ReadingProgress.js]"]
end

node_visitor(("Archive visitor"))
node_gemini["Google Gemini"]

node_visitor -->|"uses"| node_frontend
node_frontend -->|"opens collection"| node_archive_ui
node_frontend -->|"opens reading"| node_reader_ui
node_frontend -->|"browses letters"| node_letters_ui
node_frontend -->|"browses media"| node_media_ui
node_frontend -->|"starts search"| node_search_ui
node_frontend -->|"asks questions"| node_assistant_ui
node_frontend -->|"digitizes pages"| node_ocr_ui
node_frontend -->|"explores events"| node_timeline_ui
node_archive_ui -->|"requests volumes"| node_api_client
node_reader_ui -->|"requests documents"| node_api_client
node_letters_ui -->|"requests letters"| node_api_client
node_media_ui -->|"requests media"| node_api_client
node_search_ui -->|"submits query"| node_api_client
node_assistant_ui -->|"submits question"| node_api_client
node_ocr_ui -->|"sends OCR request"| node_api_client
node_api_client -->|"calls API"| node_server
node_server -->|"dispatches"| node_documents
node_server -->|"dispatches"| node_search
node_server -->|"dispatches"| node_chat
node_server -->|"dispatches"| node_auth_routes
node_server -->|"dispatches"| node_bookmarks
node_server -->|"dispatches"| node_progress
node_server -->|"dispatches"| node_feature_routes
node_documents -->|"queries catalog"| node_document_service
node_search -->|"loads fallback catalog"| node_document_service
node_search -->|"queries records"| node_document_model
node_auth_routes -->|"manages accounts"| node_user_service
node_auth_guard -->|"resolves user"| node_user_service
node_bookmarks -->|"checks identity"| node_auth_guard
node_progress -->|"checks identity"| node_auth_guard
node_document_service -->|"reads records"| node_document_model
node_user_service -->|"reads and writes"| node_user_model
node_bookmarks -->|"stores bookmarks"| node_bookmark_model
node_progress -->|"stores progress"| node_progress_model
node_document_model -->|"persists"| node_database
node_user_model -->|"persists"| node_database
node_bookmark_model -->|"persists"| node_database
node_progress_model -->|"persists"| node_database
node_chat -.->|"requests generation"| node_gemini

click node_frontend "https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/frontend/js/app.js"
click node_archive_ui "https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/frontend/js/archive.js"
click node_reader_ui "https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/frontend/js/reader.js"
click node_letters_ui "https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/frontend/js/letters.js"
click node_media_ui "https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/frontend/js/media.js"
click node_search_ui "https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/frontend/js/search.js"
click node_assistant_ui "https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/frontend/js/assistant.js"
click node_ocr_ui "https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/frontend/js/ocr.js"
click node_timeline_ui "https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/frontend/js/timeline.js"
click node_api_client "https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/frontend/js/api.js"
click node_server "https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/backend/server.js"
click node_documents "https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/backend/routes/documents.js"
click node_document_service "https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/backend/services/documentService.js"
click node_search "https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/backend/routes/search.js"
click node_hybrid_search "https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/backend/services/hybridSearchService.js"
click node_chat "https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/backend/routes/chat.js"
click node_auth_routes "https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/backend/routes/auth.js"
click node_user_service "https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/backend/services/userService.js"
click node_auth_guard "https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/backend/middleware/auth.js"
click node_bookmarks "https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/backend/routes/bookmarks.js"
click node_progress "https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/backend/routes/progress.js"
click node_feature_routes "https://github.com/roxxsujal7/brambedkar/tree/main/ambedkar-archive/backend/routes"
click node_database "https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/backend/config/db.js"
click node_document_model "https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/backend/models/Document.js"
click node_user_model "https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/backend/models/User.js"
click node_bookmark_model "https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/backend/models/Bookmark.js"
click node_progress_model "https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/backend/models/ReadingProgress.js"

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_frontend,node_archive_ui,node_reader_ui,node_letters_ui,node_media_ui,node_search_ui,node_assistant_ui,node_ocr_ui,node_timeline_ui,node_api_client toneBlue
class node_server,node_documents,node_document_service,node_search,node_hybrid_search,node_chat,node_feature_routes toneAmber
class node_auth_routes,node_user_service,node_auth_guard,node_bookmarks,node_progress toneMint
class node_database,node_document_model,node_user_model,node_bookmark_model,node_progress_model toneRose
class node_visitor,node_gemini toneIndigo
```

## Components

### Archive experience

- [Web application](https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/frontend/js/app.js): `ambedkar-archive/frontend/js/app.js`
- [Works reader](https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/frontend/js/archive.js): `ambedkar-archive/frontend/js/archive.js`
- [Document reader](https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/frontend/js/reader.js): `ambedkar-archive/frontend/js/reader.js`
- [Letters browser](https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/frontend/js/letters.js): `ambedkar-archive/frontend/js/letters.js`
- [Speeches and media](https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/frontend/js/media.js): `ambedkar-archive/frontend/js/media.js`
- [Archive search](https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/frontend/js/search.js): `ambedkar-archive/frontend/js/search.js`
- [AI assistant](https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/frontend/js/assistant.js): `ambedkar-archive/frontend/js/assistant.js`
- [Manuscript OCR](https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/frontend/js/ocr.js): `ambedkar-archive/frontend/js/ocr.js`
- [Historical timeline](https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/frontend/js/timeline.js): `ambedkar-archive/frontend/js/timeline.js`
- [API client](https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/frontend/js/api.js): `ambedkar-archive/frontend/js/api.js`

### API and domain

- [Express application](https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/backend/server.js): `ambedkar-archive/backend/server.js`
- [Document catalog](https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/backend/routes/documents.js): `ambedkar-archive/backend/routes/documents.js`
- [Catalog service](https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/backend/services/documentService.js): `ambedkar-archive/backend/services/documentService.js`
- [Unified search](https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/backend/routes/search.js): `ambedkar-archive/backend/routes/search.js`
- [Hybrid retrieval](https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/backend/services/hybridSearchService.js): `ambedkar-archive/backend/services/hybridSearchService.js`
- [Assistant endpoint](https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/backend/routes/chat.js): `ambedkar-archive/backend/routes/chat.js`
- [Heritage features](https://github.com/roxxsujal7/brambedkar/tree/main/ambedkar-archive/backend/routes): `ambedkar-archive/backend/routes`

### Identity and research

- [Authentication routes](https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/backend/routes/auth.js): `ambedkar-archive/backend/routes/auth.js`
- [User service](https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/backend/services/userService.js): `ambedkar-archive/backend/services/userService.js`
- [JWT access control](https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/backend/middleware/auth.js): `ambedkar-archive/backend/middleware/auth.js`
- [Bookmarks](https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/backend/routes/bookmarks.js): `ambedkar-archive/backend/routes/bookmarks.js`
- [Reading progress](https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/backend/routes/progress.js): `ambedkar-archive/backend/routes/progress.js`

### Persistence and integrations

- [MongoDB](https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/backend/config/db.js): `ambedkar-archive/backend/config/db.js`
- [Document records](https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/backend/models/Document.js): `ambedkar-archive/backend/models/Document.js`
- [User records](https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/backend/models/User.js): `ambedkar-archive/backend/models/User.js`
- [Bookmark records](https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/backend/models/Bookmark.js): `ambedkar-archive/backend/models/Bookmark.js`
- [Progress records](https://github.com/roxxsujal7/brambedkar/blob/main/ambedkar-archive/backend/models/ReadingProgress.js): `ambedkar-archive/backend/models/ReadingProgress.js`

### Other components

- **Archive visitor**
- **Google Gemini**

## Connections

- Archive visitor → Web application: uses
- Web application → Works reader: opens collection
- Web application → Document reader: opens reading
- Web application → Letters browser: browses letters
- Web application → Speeches and media: browses media
- Web application → Archive search: starts search
- Web application → AI assistant: asks questions
- Web application → Manuscript OCR: digitizes pages
- Web application → Historical timeline: explores events
- Works reader → API client: requests volumes
- Document reader → API client: requests documents
- Letters browser → API client: requests letters
- Speeches and media → API client: requests media
- Archive search → API client: submits query
- AI assistant → API client: submits question
- Manuscript OCR → API client: sends OCR request
- API client → Express application: calls API
- Express application → Document catalog: dispatches
- Express application → Unified search: dispatches
- Express application → Assistant endpoint: dispatches
- Express application → Authentication routes: dispatches
- Express application → Bookmarks: dispatches
- Express application → Reading progress: dispatches
- Express application → Heritage features: dispatches
- Document catalog → Catalog service: queries catalog
- Unified search → Catalog service: loads fallback catalog
- Unified search → Document records: queries records
- Authentication routes → User service: manages accounts
- JWT access control → User service: resolves user
- Bookmarks → JWT access control: checks identity
- Reading progress → JWT access control: checks identity
- Catalog service → Document records: reads records
- User service → User records: reads and writes
- Bookmarks → Bookmark records: stores bookmarks
- Reading progress → Progress records: stores progress
- Document records → MongoDB: persists
- User records → MongoDB: persists
- Bookmark records → MongoDB: persists
- Progress records → MongoDB: persists
- Assistant endpoint → Google Gemini: requests generation
