# maulikgupta27/seatmatrix architecture

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

- Interactive diagram: https://gitdiagram.com/maulikgupta27/seatmatrix
- Repository: https://github.com/maulikgupta27/seatmatrix

## Overview

SeatMatrix is a JoSAA counselling choice optimizer: students enter or save rank and eligibility details, receive rank-sensitive seat recommendations, then explore, compare, simulate upgrades, and manage an ordered shortlist for export. The React app calls an Express API whose domain services evaluate cutoffs and persist user data through Prisma. The README documents dual-rank routing, elasticity, geographic and branch filters, and CSAB guidance; some of those implementations were not sampled, so their internal links are not inferred here.

Main entry points: [`frontend/src/App.jsx`](https://github.com/maulikgupta27/seatmatrix/blob/main/frontend/src/App.jsx) (Application routes), [`backend/src/app.js`](https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/app.js) (HTTP API), [`backend/src/lib/prisma.js`](https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/lib/prisma.js) (Prisma client), [`backend/src/services/recommendation.service.js`](https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/services/recommendation.service.js) (Choice evaluation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Student application"]
  node_app["Application routes<br/>[App.jsx]"]
  node_authctx["Session and profile<br/>[AuthContext.jsx]"]
  node_api_client["API client<br/>[api.js]"]
  node_recommend_page["Recommendations"]
  node_sim_page["Simulator<br/>[SimulatorPage.jsx]"]
  node_compare_page["Comparison"]
  node_explorer_page["Institute explorer"]
  node_dashboard_page["Dashboard<br/>[DashboardPage.jsx]"]
  node_profile_page["Profile<br/>[ProfilePage.jsx]"]
  node_shortlist_ui["Choice basket"]
end

subgraph group_api["API and domain"]
  node_backend_app["HTTP API<br/>[app.js]"]
  node_auth_routes["Authentication routes<br/>[auth.routes.js]"]
  node_profile_routes["Profile routes<br/>[profile.routes.js]"]
  node_institute_routes["Institute routes"]
  node_recommend_routes["Recommendation routes"]
  node_sim_routes["Simulator routes"]
  node_shortlist_routes["Shortlist routes"]
  node_profile_controller["Profile handler"]
  node_institute_controller["Institute handler"]
  node_comparison_controller["Comparison handler"]
  node_recommend_controller["Recommendation handler"]
  node_sim_controller["Simulation handler"]
  node_shortlist_controller["Shortlist handler"]
  node_profile_service["Profile service<br/>[profile.service.js]"]
  node_institute_service["Institute service"]
  node_shortlist_service["Shortlist service"]
  node_auth_service["Account service<br/>[auth.service.js]"]
end

subgraph group_data["Persistence and integrations"]
  node_prisma["Prisma client<br/>[prisma.js]"]
  node_database[("PostgreSQL")]
end

subgraph group_logic["Evaluation logic"]
  node_comparison_service["Cutoff comparison"]
  node_recommend_service["Choice evaluation"]
  node_sim_service["Upgrade simulation"]
  node_geo_filters["State and zone filters<br/>[state.utils.js]"]
end

node_student(("Student"))

node_student -->|"uses"| node_app
node_app -->|"provides session"| node_authctx
node_app -->|"routes to"| node_recommend_page
node_app -->|"routes to"| node_sim_page
node_app -->|"routes to"| node_compare_page
node_app -->|"routes to"| node_explorer_page
node_app -->|"routes to"| node_dashboard_page
node_app -->|"routes to"| node_profile_page
node_authctx -->|"calls"| node_api_client
node_recommend_page -->|"requests results"| node_api_client
node_sim_page -->|"submits evaluation"| node_api_client
node_compare_page -->|"requests comparison"| node_api_client
node_shortlist_ui -.->|"manages choices"| node_api_client
node_api_client -->|"HTTP requests"| node_backend_app
node_backend_app -->|"mounts"| node_auth_routes
node_backend_app -->|"mounts"| node_profile_routes
node_backend_app -->|"mounts"| node_institute_routes
node_backend_app -->|"mounts"| node_recommend_routes
node_backend_app -->|"mounts"| node_sim_routes
node_backend_app -->|"mounts"| node_shortlist_routes
node_profile_routes -->|"dispatches"| node_profile_controller
node_institute_routes -->|"dispatches"| node_institute_controller
node_institute_routes -->|"dispatches"| node_comparison_controller
node_recommend_routes -->|"dispatches"| node_recommend_controller
node_sim_routes -->|"dispatches"| node_sim_controller
node_shortlist_routes -->|"dispatches"| node_shortlist_controller
node_profile_controller -->|"calls"| node_profile_service
node_institute_controller -->|"calls"| node_institute_service
node_comparison_controller -->|"calls"| node_comparison_service
node_recommend_controller -->|"calls"| node_recommend_service
node_sim_controller -->|"calls"| node_sim_service
node_shortlist_controller -->|"calls"| node_shortlist_service
node_profile_service -->|"reads and writes"| node_prisma
node_institute_service -->|"queries"| node_prisma
node_comparison_service -.->|"queries"| node_prisma
node_recommend_service -->|"loads cutoffs"| node_prisma
node_sim_service -->|"loads cutoff data"| node_prisma
node_shortlist_service -->|"persists choices"| node_prisma
node_prisma -->|"queries"| node_database
node_recommend_service -->|"loads student profile"| node_profile_service
node_sim_service -->|"loads student profile"| node_profile_service
node_recommend_service -->|"filters by location"| node_geo_filters
node_sim_service -->|"reuses evaluation"| node_recommend_service
node_student -.->|"registers or signs in"| node_auth_service
node_auth_service -->|"reads and creates users"| node_prisma
node_recommend_page -.->|"offers choice basket"| node_shortlist_ui
node_recommend_service -.->|"returns ranked choices"| node_student

click node_app "https://github.com/maulikgupta27/seatmatrix/blob/main/frontend/src/App.jsx"
click node_authctx "https://github.com/maulikgupta27/seatmatrix/blob/main/frontend/src/context/AuthContext.jsx"
click node_api_client "https://github.com/maulikgupta27/seatmatrix/blob/main/frontend/src/services/api.js"
click node_recommend_page "https://github.com/maulikgupta27/seatmatrix/blob/main/frontend/src/pages/RecommendationsPage.jsx"
click node_sim_page "https://github.com/maulikgupta27/seatmatrix/blob/main/frontend/src/pages/SimulatorPage.jsx"
click node_compare_page "https://github.com/maulikgupta27/seatmatrix/blob/main/frontend/src/pages/CollegeComparisonPage.jsx"
click node_explorer_page "https://github.com/maulikgupta27/seatmatrix/blob/main/frontend/src/pages/CollegeExplorerPage.jsx"
click node_dashboard_page "https://github.com/maulikgupta27/seatmatrix/blob/main/frontend/src/pages/DashboardPage.jsx"
click node_profile_page "https://github.com/maulikgupta27/seatmatrix/blob/main/frontend/src/pages/ProfilePage.jsx"
click node_shortlist_ui "https://github.com/maulikgupta27/seatmatrix/blob/main/frontend/src/components/common/CollegeMultiSelectBar.jsx"
click node_backend_app "https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/app.js"
click node_auth_routes "https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/routes/auth.routes.js"
click node_profile_routes "https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/routes/profile.routes.js"
click node_institute_routes "https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/routes/institute.routes.js"
click node_recommend_routes "https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/routes/recommendation.routes.js"
click node_sim_routes "https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/routes/simulator.routes.js"
click node_shortlist_routes "https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/routes/shortlist.routes.js"
click node_profile_controller "https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/controllers/profile.controller.js"
click node_institute_controller "https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/controllers/institute.controller.js"
click node_comparison_controller "https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/controllers/comparison.controller.js"
click node_recommend_controller "https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/controllers/recommendation.controller.js"
click node_sim_controller "https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/controllers/simulator.controller.js"
click node_shortlist_controller "https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/controllers/shortlist.controller.js"
click node_profile_service "https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/services/profile.service.js"
click node_institute_service "https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/services/institute.service.js"
click node_comparison_service "https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/services/comparison.service.js"
click node_recommend_service "https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/services/recommendation.service.js"
click node_sim_service "https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/services/simulator.service.js"
click node_shortlist_service "https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/services/shortlist.service.js"
click node_auth_service "https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/services/auth.service.js"
click node_prisma "https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/lib/prisma.js"
click node_geo_filters "https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/utils/state.utils.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_app,node_authctx,node_api_client,node_recommend_page,node_sim_page,node_compare_page,node_explorer_page,node_dashboard_page,node_profile_page,node_shortlist_ui toneBlue
class node_backend_app,node_auth_routes,node_profile_routes,node_institute_routes,node_recommend_routes,node_sim_routes,node_shortlist_routes,node_profile_controller,node_institute_controller,node_comparison_controller,node_recommend_controller,node_sim_controller,node_shortlist_controller,node_profile_service,node_institute_service,node_shortlist_service,node_auth_service toneAmber
class node_prisma,node_database toneMint
class node_comparison_service,node_recommend_service,node_sim_service,node_geo_filters toneRose
class node_student toneIndigo
```

## Components

### Student application

- [Application routes](https://github.com/maulikgupta27/seatmatrix/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Session and profile](https://github.com/maulikgupta27/seatmatrix/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [API client](https://github.com/maulikgupta27/seatmatrix/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`
- [Recommendations](https://github.com/maulikgupta27/seatmatrix/blob/main/frontend/src/pages/RecommendationsPage.jsx): `frontend/src/pages/RecommendationsPage.jsx`
- [Simulator](https://github.com/maulikgupta27/seatmatrix/blob/main/frontend/src/pages/SimulatorPage.jsx): `frontend/src/pages/SimulatorPage.jsx`
- [Comparison](https://github.com/maulikgupta27/seatmatrix/blob/main/frontend/src/pages/CollegeComparisonPage.jsx): `frontend/src/pages/CollegeComparisonPage.jsx`
- [Institute explorer](https://github.com/maulikgupta27/seatmatrix/blob/main/frontend/src/pages/CollegeExplorerPage.jsx): `frontend/src/pages/CollegeExplorerPage.jsx`
- [Dashboard](https://github.com/maulikgupta27/seatmatrix/blob/main/frontend/src/pages/DashboardPage.jsx): `frontend/src/pages/DashboardPage.jsx`
- [Profile](https://github.com/maulikgupta27/seatmatrix/blob/main/frontend/src/pages/ProfilePage.jsx): `frontend/src/pages/ProfilePage.jsx`
- [Choice basket](https://github.com/maulikgupta27/seatmatrix/blob/main/frontend/src/components/common/CollegeMultiSelectBar.jsx): `frontend/src/components/common/CollegeMultiSelectBar.jsx`

### API and domain

- [HTTP API](https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/app.js): `backend/src/app.js`
- [Authentication routes](https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/routes/auth.routes.js): `backend/src/routes/auth.routes.js`
- [Profile routes](https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/routes/profile.routes.js): `backend/src/routes/profile.routes.js`
- [Institute routes](https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/routes/institute.routes.js): `backend/src/routes/institute.routes.js`
- [Recommendation routes](https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/routes/recommendation.routes.js): `backend/src/routes/recommendation.routes.js`
- [Simulator routes](https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/routes/simulator.routes.js): `backend/src/routes/simulator.routes.js`
- [Shortlist routes](https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/routes/shortlist.routes.js): `backend/src/routes/shortlist.routes.js`
- [Profile handler](https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/controllers/profile.controller.js): `backend/src/controllers/profile.controller.js`
- [Institute handler](https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/controllers/institute.controller.js): `backend/src/controllers/institute.controller.js`
- [Comparison handler](https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/controllers/comparison.controller.js): `backend/src/controllers/comparison.controller.js`
- [Recommendation handler](https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/controllers/recommendation.controller.js): `backend/src/controllers/recommendation.controller.js`
- [Simulation handler](https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/controllers/simulator.controller.js): `backend/src/controllers/simulator.controller.js`
- [Shortlist handler](https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/controllers/shortlist.controller.js): `backend/src/controllers/shortlist.controller.js`
- [Profile service](https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/services/profile.service.js): `backend/src/services/profile.service.js`
- [Institute service](https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/services/institute.service.js): `backend/src/services/institute.service.js`
- [Shortlist service](https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/services/shortlist.service.js): `backend/src/services/shortlist.service.js`
- [Account service](https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/services/auth.service.js): `backend/src/services/auth.service.js`

### Persistence and integrations

- [Prisma client](https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/lib/prisma.js): `backend/src/lib/prisma.js`
- **PostgreSQL**

### Evaluation logic

- [Cutoff comparison](https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/services/comparison.service.js): `backend/src/services/comparison.service.js`
- [Choice evaluation](https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/services/recommendation.service.js): `backend/src/services/recommendation.service.js`
- [Upgrade simulation](https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/services/simulator.service.js): `backend/src/services/simulator.service.js`
- [State and zone filters](https://github.com/maulikgupta27/seatmatrix/blob/main/backend/src/utils/state.utils.js): `backend/src/utils/state.utils.js`

### Other components

- **Student**

## Connections

- Student → Application routes: uses (evidence: `frontend/src/App.jsx`)
- Application routes → Session and profile: provides session (evidence: `frontend/src/App.jsx`)
- Application routes → Recommendations: routes to (evidence: `frontend/src/App.jsx`)
- Application routes → Simulator: routes to (evidence: `frontend/src/App.jsx`)
- Application routes → Comparison: routes to (evidence: `frontend/src/App.jsx`)
- Application routes → Institute explorer: routes to (evidence: `frontend/src/App.jsx`)
- Application routes → Dashboard: routes to (evidence: `frontend/src/App.jsx`)
- Application routes → Profile: routes to (evidence: `frontend/src/App.jsx`)
- Session and profile → API client: calls (evidence: `frontend/src/context/AuthContext.jsx`)
- Recommendations → API client: requests results (evidence: `frontend/src/pages/RecommendationsPage.jsx`)
- Simulator → API client: submits evaluation (evidence: `frontend/src/pages/SimulatorPage.jsx`)
- Comparison → API client: requests comparison (evidence: `frontend/src/pages/CollegeComparisonPage.jsx`)
- Choice basket → API client: manages choices
- API client → HTTP API: HTTP requests (evidence: `frontend/src/services/api.js`)
- HTTP API → Authentication routes: mounts (evidence: `backend/src/app.js`)
- HTTP API → Profile routes: mounts (evidence: `backend/src/app.js`)
- HTTP API → Institute routes: mounts (evidence: `backend/src/app.js`)
- HTTP API → Recommendation routes: mounts (evidence: `backend/src/app.js`)
- HTTP API → Simulator routes: mounts (evidence: `backend/src/app.js`)
- HTTP API → Shortlist routes: mounts (evidence: `backend/src/app.js`)
- Profile routes → Profile handler: dispatches (evidence: `backend/src/routes/profile.routes.js`)
- Institute routes → Institute handler: dispatches (evidence: `backend/src/routes/institute.routes.js`)
- Institute routes → Comparison handler: dispatches (evidence: `backend/src/routes/institute.routes.js`)
- Recommendation routes → Recommendation handler: dispatches (evidence: `backend/src/routes/recommendation.routes.js`)
- Simulator routes → Simulation handler: dispatches (evidence: `backend/src/routes/simulator.routes.js`)
- Shortlist routes → Shortlist handler: dispatches (evidence: `backend/src/routes/shortlist.routes.js`)
- Profile handler → Profile service: calls (evidence: `backend/src/controllers/profile.controller.js`)
- Institute handler → Institute service: calls (evidence: `backend/src/controllers/institute.controller.js`)
- Comparison handler → Cutoff comparison: calls (evidence: `backend/src/controllers/comparison.controller.js`)
- Recommendation handler → Choice evaluation: calls (evidence: `backend/src/controllers/recommendation.controller.js`)
- Simulation handler → Upgrade simulation: calls (evidence: `backend/src/controllers/simulator.controller.js`)
- Shortlist handler → Shortlist service: calls (evidence: `backend/src/controllers/shortlist.controller.js`)
- Profile service → Prisma client: reads and writes (evidence: `backend/src/services/profile.service.js`)
- Institute service → Prisma client: queries (evidence: `backend/src/services/institute.service.js`)
- Cutoff comparison → Prisma client: queries
- Choice evaluation → Prisma client: loads cutoffs (evidence: `backend/src/services/recommendation.service.js`)
- Upgrade simulation → Prisma client: loads cutoff data (evidence: `backend/src/services/simulator.service.js`)
- Shortlist service → Prisma client: persists choices (evidence: `backend/src/services/shortlist.service.js`)
- Prisma client → PostgreSQL: queries (evidence: `backend/src/lib/prisma.js`)
- Choice evaluation → Profile service: loads student profile (evidence: `backend/src/services/recommendation.service.js`)
- Upgrade simulation → Profile service: loads student profile (evidence: `backend/src/services/simulator.service.js`)
- Choice evaluation → State and zone filters: filters by location (evidence: `backend/src/services/recommendation.service.js`)
- Upgrade simulation → Choice evaluation: reuses evaluation (evidence: `backend/src/services/simulator.service.js`)
- Student → Account service: registers or signs in
- Account service → Prisma client: reads and creates users (evidence: `backend/src/services/auth.service.js`)
- Recommendations → Choice basket: offers choice basket
- Choice evaluation → Student: returns ranked choices
