# srikarshetkar/barabari-collective-2 architecture

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

- Interactive diagram: https://gitdiagram.com/srikarshetkar/barabari-collective-2
- Repository: https://github.com/srikarshetkar/barabari-collective-2

## Overview

Barabari is a role-based digital-skills platform for students, mentors, clients, and administrators. Users work through dashboards to manage projects, requirements, tasks, files, feedback, and support; the backend exposes authenticated APIs and persists product records in Google Sheets. Sampark Saathi provides an AI assistant backed by approved knowledge and historical Q&A retrieval, with mentor escalation. The graph reflects the supplied tree and sampled excerpts; internal wiring for several domain controllers and the Sampark service is not shown, so those links are omitted.

Main entry points: [`backend/routes`](https://github.com/srikarshetkar/barabari-collective-2/tree/main/backend/routes) (Domain routes), [`backend/services/sheetService.js`](https://github.com/srikarshetkar/barabari-collective-2/blob/main/backend/services/sheetService.js) (Sheet data service), [`ai/src/handlers/ragHandler.js`](https://github.com/srikarshetkar/barabari-collective-2/blob/main/ai/src/handlers/ragHandler.js) (Knowledge answering), [`ai/src/handlers/semanticSearchHandler.js`](https://github.com/srikarshetkar/barabari-collective-2/blob/main/ai/src/handlers/semanticSearchHandler.js) (Semantic search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Role-based application"]
  node_frontend_app["Frontend shell<br/>[App.tsx]"]
  node_frontend_routes["Role routes<br/>[AppRoutes.tsx]"]
  node_role_workspaces["Role workspaces"]
  node_frontend_api["API client<br/>[client.ts]"]
end

subgraph group_backend["Platform API"]
  node_backend_app["HTTP application<br/>[app.js]"]
  node_domain_routes["Domain routes"]
  node_auth_middleware["Authentication<br/>[authMiddleware.js]"]
  node_project_controller["Project management"]
  node_requirement_controller["Requirements"]
  node_task_controller["Tasks and progress<br/>[taskController.js]"]
  node_support_controllers["Support and knowledge"]
  node_file_controller["File management<br/>[fileController.js]"]
  node_sampark_routes["Sampark endpoint<br/>[samparkRoutes.js]"]
  node_sampark_service["Sampark service<br/>[samparkService.js]"]
end

subgraph group_assistant["Sampark assistant"]
  node_ai_compose["AI composition<br/>[compose.js]"]
  node_ai_handlers["Query handlers"]
  node_rag_handler["Knowledge answering<br/>[ragHandler.js]"]
  node_semantic_handler["Semantic search"]
  node_retrieval["Approved retrieval<br/>[retrieval.js]"]
  node_rag_db[("Retrieval database<br/>[database.js]")]
end

subgraph group_data["Persistence and integrations"]
  node_sheet_service["Sheet data service<br/>[sheetService.js]"]
  node_google_sheets[("Google Sheets<br/>[googleSheets.js]")]
  node_drive_service["Drive file service<br/>[driveService.js]"]
end

node_users(("Platform users"))
node_google_drive[("Google Drive")]
node_llm(("LLM provider"))
node_mentor(("Human mentor"))

node_users -->|"use"| node_frontend_app
node_frontend_app -->|"renders"| node_frontend_routes
node_frontend_routes -->|"routes to"| node_role_workspaces
node_role_workspaces -->|"requests data"| node_frontend_api
node_frontend_api -->|"calls API"| node_backend_app
node_backend_app -->|"mounts routes"| node_domain_routes
node_domain_routes -->|"applies auth"| node_auth_middleware
node_domain_routes -->|"dispatches"| node_project_controller
node_domain_routes -->|"dispatches"| node_requirement_controller
node_domain_routes -->|"dispatches"| node_task_controller
node_domain_routes -->|"dispatches"| node_support_controllers
node_domain_routes -->|"dispatches"| node_file_controller
node_project_controller -->|"reads/writes"| node_sheet_service
node_requirement_controller -->|"reads/writes"| node_sheet_service
node_task_controller -->|"reads/writes"| node_sheet_service
node_support_controllers -->|"uses"| node_sheet_service
node_file_controller -->|"uses"| node_drive_service
node_drive_service -->|"stores files"| node_google_drive
node_backend_app -->|"mounts endpoint"| node_sampark_routes
node_sampark_routes -->|"dispatches"| node_sampark_service
node_rag_handler -->|"queries"| node_retrieval
node_semantic_handler -->|"queries"| node_retrieval
node_rag_handler -->|"generates answer"| node_llm
node_semantic_handler -->|"normalizes/generates"| node_llm
node_retrieval -->|"reads"| node_rag_db
node_sheet_service -->|"reads/writes"| node_google_sheets
node_rag_handler -.->|"flags escalation"| node_mentor
node_semantic_handler -.->|"flags escalation"| node_mentor

click node_frontend_app "https://github.com/srikarshetkar/barabari-collective-2/blob/main/frontend/src/App.tsx"
click node_frontend_routes "https://github.com/srikarshetkar/barabari-collective-2/blob/main/frontend/src/routes/AppRoutes.tsx"
click node_role_workspaces "https://github.com/srikarshetkar/barabari-collective-2/tree/main/frontend/src/features"
click node_frontend_api "https://github.com/srikarshetkar/barabari-collective-2/blob/main/frontend/src/api/client.ts"
click node_backend_app "https://github.com/srikarshetkar/barabari-collective-2/blob/main/backend/app.js"
click node_domain_routes "https://github.com/srikarshetkar/barabari-collective-2/tree/main/backend/routes"
click node_auth_middleware "https://github.com/srikarshetkar/barabari-collective-2/blob/main/backend/middleware/authMiddleware.js"
click node_project_controller "https://github.com/srikarshetkar/barabari-collective-2/blob/main/backend/controllers/projectController.js"
click node_requirement_controller "https://github.com/srikarshetkar/barabari-collective-2/blob/main/backend/controllers/requirementController.js"
click node_task_controller "https://github.com/srikarshetkar/barabari-collective-2/blob/main/backend/controllers/taskController.js"
click node_support_controllers "https://github.com/srikarshetkar/barabari-collective-2/tree/main/backend/controllers"
click node_file_controller "https://github.com/srikarshetkar/barabari-collective-2/blob/main/backend/controllers/fileController.js"
click node_sampark_routes "https://github.com/srikarshetkar/barabari-collective-2/blob/main/backend/routes/samparkRoutes.js"
click node_sampark_service "https://github.com/srikarshetkar/barabari-collective-2/blob/main/backend/services/samparkService.js"
click node_ai_compose "https://github.com/srikarshetkar/barabari-collective-2/blob/main/ai/src/compose.js"
click node_ai_handlers "https://github.com/srikarshetkar/barabari-collective-2/tree/main/ai/src/handlers"
click node_rag_handler "https://github.com/srikarshetkar/barabari-collective-2/blob/main/ai/src/handlers/ragHandler.js"
click node_semantic_handler "https://github.com/srikarshetkar/barabari-collective-2/blob/main/ai/src/handlers/semanticSearchHandler.js"
click node_retrieval "https://github.com/srikarshetkar/barabari-collective-2/blob/main/rag/src/services/retrieval.js"
click node_rag_db "https://github.com/srikarshetkar/barabari-collective-2/blob/main/rag/src/db/database.js"
click node_sheet_service "https://github.com/srikarshetkar/barabari-collective-2/blob/main/backend/services/sheetService.js"
click node_google_sheets "https://github.com/srikarshetkar/barabari-collective-2/blob/main/backend/config/googleSheets.js"
click node_drive_service "https://github.com/srikarshetkar/barabari-collective-2/blob/main/backend/services/driveService.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_app,node_frontend_routes,node_role_workspaces,node_frontend_api,node_users toneBlue
class node_backend_app,node_domain_routes,node_auth_middleware,node_project_controller,node_requirement_controller,node_task_controller,node_support_controllers,node_file_controller,node_sampark_routes,node_sampark_service,node_google_drive toneAmber
class node_ai_compose,node_ai_handlers,node_rag_handler,node_semantic_handler,node_retrieval,node_rag_db toneMint
class node_sheet_service,node_google_sheets,node_drive_service toneRose
class node_llm,node_mentor toneIndigo
```

## Components

### Role-based application

- [Frontend shell](https://github.com/srikarshetkar/barabari-collective-2/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Role routes](https://github.com/srikarshetkar/barabari-collective-2/blob/main/frontend/src/routes/AppRoutes.tsx): `frontend/src/routes/AppRoutes.tsx`
- [Role workspaces](https://github.com/srikarshetkar/barabari-collective-2/tree/main/frontend/src/features): `frontend/src/features`
- [API client](https://github.com/srikarshetkar/barabari-collective-2/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`

### Platform API

- [HTTP application](https://github.com/srikarshetkar/barabari-collective-2/blob/main/backend/app.js): `backend/app.js`
- [Domain routes](https://github.com/srikarshetkar/barabari-collective-2/tree/main/backend/routes): `backend/routes`
- [Authentication](https://github.com/srikarshetkar/barabari-collective-2/blob/main/backend/middleware/authMiddleware.js): `backend/middleware/authMiddleware.js`
- [Project management](https://github.com/srikarshetkar/barabari-collective-2/blob/main/backend/controllers/projectController.js): `backend/controllers/projectController.js`
- [Requirements](https://github.com/srikarshetkar/barabari-collective-2/blob/main/backend/controllers/requirementController.js): `backend/controllers/requirementController.js`
- [Tasks and progress](https://github.com/srikarshetkar/barabari-collective-2/blob/main/backend/controllers/taskController.js): `backend/controllers/taskController.js`
- [Support and knowledge](https://github.com/srikarshetkar/barabari-collective-2/tree/main/backend/controllers): `backend/controllers`
- [File management](https://github.com/srikarshetkar/barabari-collective-2/blob/main/backend/controllers/fileController.js): `backend/controllers/fileController.js`
- [Sampark endpoint](https://github.com/srikarshetkar/barabari-collective-2/blob/main/backend/routes/samparkRoutes.js): `backend/routes/samparkRoutes.js`
- [Sampark service](https://github.com/srikarshetkar/barabari-collective-2/blob/main/backend/services/samparkService.js): `backend/services/samparkService.js`

### Sampark assistant

- [AI composition](https://github.com/srikarshetkar/barabari-collective-2/blob/main/ai/src/compose.js): `ai/src/compose.js`
- [Query handlers](https://github.com/srikarshetkar/barabari-collective-2/tree/main/ai/src/handlers): `ai/src/handlers`
- [Knowledge answering](https://github.com/srikarshetkar/barabari-collective-2/blob/main/ai/src/handlers/ragHandler.js): `ai/src/handlers/ragHandler.js`
- [Semantic search](https://github.com/srikarshetkar/barabari-collective-2/blob/main/ai/src/handlers/semanticSearchHandler.js): `ai/src/handlers/semanticSearchHandler.js`
- [Approved retrieval](https://github.com/srikarshetkar/barabari-collective-2/blob/main/rag/src/services/retrieval.js): `rag/src/services/retrieval.js`
- [Retrieval database](https://github.com/srikarshetkar/barabari-collective-2/blob/main/rag/src/db/database.js): `rag/src/db/database.js`

### Persistence and integrations

- [Sheet data service](https://github.com/srikarshetkar/barabari-collective-2/blob/main/backend/services/sheetService.js): `backend/services/sheetService.js`
- [Google Sheets](https://github.com/srikarshetkar/barabari-collective-2/blob/main/backend/config/googleSheets.js): `backend/config/googleSheets.js`
- [Drive file service](https://github.com/srikarshetkar/barabari-collective-2/blob/main/backend/services/driveService.js): `backend/services/driveService.js`

### Other components

- **Platform users**
- **Google Drive**
- **LLM provider**
- **Human mentor**

## Connections

- Platform users → Frontend shell: use
- Frontend shell → Role routes: renders
- Role routes → Role workspaces: routes to
- Role workspaces → API client: requests data
- API client → HTTP application: calls API
- HTTP application → Domain routes: mounts routes
- Domain routes → Authentication: applies auth
- Domain routes → Project management: dispatches
- Domain routes → Requirements: dispatches
- Domain routes → Tasks and progress: dispatches
- Domain routes → Support and knowledge: dispatches
- Domain routes → File management: dispatches
- Project management → Sheet data service: reads/writes
- Requirements → Sheet data service: reads/writes
- Tasks and progress → Sheet data service: reads/writes
- Support and knowledge → Sheet data service: uses
- File management → Drive file service: uses
- Drive file service → Google Drive: stores files
- HTTP application → Sampark endpoint: mounts endpoint
- Sampark endpoint → Sampark service: dispatches
- Knowledge answering → Approved retrieval: queries
- Semantic search → Approved retrieval: queries
- Knowledge answering → LLM provider: generates answer
- Semantic search → LLM provider: normalizes/generates
- Approved retrieval → Retrieval database: reads
- Sheet data service → Google Sheets: reads/writes
- Knowledge answering → Human mentor: flags escalation
- Semantic search → Human mentor: flags escalation
