# ashusingh25/job-prep-ai architecture

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

- Interactive diagram: https://gitdiagram.com/ashusingh25/job-prep-ai
- Repository: https://github.com/ashusingh25/job-prep-ai

## Overview

Job Prep AI is a resume-based interview preparation app. Users register or log in, submit a resume PDF with self- and job descriptions, and receive an AI-generated report with interview-preparation results; they can later revisit reports and request a tailored resume PDF. The frontend routes and feature hooks manage authentication and report state, while Express routes dispatch requests through authentication and upload middleware to controllers. Controllers parse resumes, invoke AI generation, and store or retrieve reports. The README documents Gemini, MongoDB, validation, skill-gap analysis, and structured responses; unsampled details and their internal links are omitted where source evidence is unavailable.

Main entry points: [`Frontend/src/app.routes.jsx`](https://github.com/ashusingh25/job-prep-ai/blob/main/Frontend/src/app.routes.jsx) (App routes), [`Frontend/src/features/auth/hooks/useAuth.js`](https://github.com/ashusingh25/job-prep-ai/blob/main/Frontend/src/features/auth/hooks/useAuth.js) (Auth actions), [`Frontend/src/App.jsx`](https://github.com/ashusingh25/job-prep-ai/blob/main/Frontend/src/App.jsx) (React app), [`Backend/src/routes/interview.routes.js`](https://github.com/ashusingh25/job-prep-ai/blob/main/Backend/src/routes/interview.routes.js) (Interview routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_app["React app<br/>[App.jsx]"]
  node_router["App routes<br/>[app.routes.jsx]"]
end

subgraph group_auth["Authentication"]
  node_login["Login page<br/>[Login.jsx]"]
  node_register["Register page<br/>[Register.jsx]"]
  node_authstate["Auth state<br/>[auth.context.jsx]"]
  node_authhook["Auth actions<br/>[useAuth.js]"]
  node_authapi["Auth API client<br/>[auth.api.js]"]
  node_protected["Protected routes<br/>[Protected.jsx]"]
end

subgraph group_interview["Interview preparation"]
  node_home["Preparation home<br/>[Home.jsx]"]
  node_interviewpage["Report view<br/>[Interview.jsx]"]
  node_interviewstate["Report state"]
  node_interviewhook["Report actions<br/>[useInterview.js]"]
  node_interviewapi["Interview API client<br/>[interview.api.js]"]
end

subgraph group_backend["Backend API"]
  node_express["Express app<br/>[app.js]"]
  node_authroutes["Auth routes<br/>[auth.routes.js]"]
  node_interviewroutes["Interview routes"]
  node_authcontroller["Auth controller<br/>[auth.controller.js]"]
  node_authmw["JWT middleware<br/>[auth.middleware.js]"]
  node_upload["Resume upload<br/>[file.middleware.js]"]
  node_interviewcontroller["Report controller"]
end

subgraph group_persistence["Persistence and AI"]
  node_userdb[("User records<br/>[user.model.js]")]
  node_blacklist[("Token blacklist<br/>[blacklist.model.js]")]
  node_reports[("Interview reports")]
  node_aiservice["AI generation<br/>[ai.service.js]"]
end

node_user(("User"))
node_gemini{{"Google Gemini"}}
node_pdfparser{{"PDF parser"}}
node_mongodb[("MongoDB")]

node_user -->|"uses"| node_app
node_app -->|"provides routes"| node_router
node_router -->|"routes to"| node_login
node_router -->|"routes to"| node_register
node_router -->|"guards pages"| node_protected
node_router -->|"routes to"| node_home
node_router -->|"routes to"| node_interviewpage
node_app -->|"provides state"| node_authstate
node_app -->|"provides state"| node_interviewstate
node_login -->|"uses"| node_authhook
node_register -->|"uses"| node_authhook
node_protected -->|"checks session"| node_authhook
node_authhook -->|"reads and updates"| node_authstate
node_authhook -->|"calls"| node_authapi
node_authapi -->|"sends auth requests"| node_express
node_home -->|"uses"| node_interviewhook
node_interviewpage -->|"uses"| node_interviewhook
node_interviewhook -->|"reads and updates"| node_interviewstate
node_interviewhook -->|"calls"| node_interviewapi
node_interviewapi -->|"sends report requests"| node_express
node_express -->|"mounts"| node_authroutes
node_express -->|"mounts"| node_interviewroutes
node_authroutes -->|"dispatches"| node_authcontroller
node_authroutes -->|"protects profile route"| node_authmw
node_interviewroutes -->|"authenticates"| node_authmw
node_interviewroutes -->|"uploads resume"| node_upload
node_interviewroutes -->|"dispatches"| node_interviewcontroller
node_authcontroller -->|"reads and writes"| node_userdb
node_authcontroller -->|"blacklists token"| node_blacklist
node_authmw -->|"checks token"| node_blacklist
node_interviewcontroller -->|"extracts resume text"| node_pdfparser
node_interviewcontroller -->|"requests generation"| node_aiservice
node_aiservice -.->|"generates responses"| node_gemini
node_interviewcontroller -->|"creates and fetches"| node_reports
node_userdb -.->|"stores records"| node_mongodb
node_reports -.->|"stores reports"| node_mongodb

click node_app "https://github.com/ashusingh25/job-prep-ai/blob/main/Frontend/src/App.jsx"
click node_router "https://github.com/ashusingh25/job-prep-ai/blob/main/Frontend/src/app.routes.jsx"
click node_login "https://github.com/ashusingh25/job-prep-ai/blob/main/Frontend/src/features/auth/pages/Login.jsx"
click node_register "https://github.com/ashusingh25/job-prep-ai/blob/main/Frontend/src/features/auth/pages/Register.jsx"
click node_authstate "https://github.com/ashusingh25/job-prep-ai/blob/main/Frontend/src/features/auth/auth.context.jsx"
click node_authhook "https://github.com/ashusingh25/job-prep-ai/blob/main/Frontend/src/features/auth/hooks/useAuth.js"
click node_authapi "https://github.com/ashusingh25/job-prep-ai/blob/main/Frontend/src/features/auth/services/auth.api.js"
click node_protected "https://github.com/ashusingh25/job-prep-ai/blob/main/Frontend/src/features/auth/components/Protected.jsx"
click node_home "https://github.com/ashusingh25/job-prep-ai/blob/main/Frontend/src/features/interview/pages/Home.jsx"
click node_interviewpage "https://github.com/ashusingh25/job-prep-ai/blob/main/Frontend/src/features/interview/pages/Interview.jsx"
click node_interviewstate "https://github.com/ashusingh25/job-prep-ai/blob/main/Frontend/src/features/interview/interview.context.jsx"
click node_interviewhook "https://github.com/ashusingh25/job-prep-ai/blob/main/Frontend/src/features/interview/hooks/useInterview.js"
click node_interviewapi "https://github.com/ashusingh25/job-prep-ai/blob/main/Frontend/src/features/interview/services/interview.api.js"
click node_express "https://github.com/ashusingh25/job-prep-ai/blob/main/Backend/src/app.js"
click node_authroutes "https://github.com/ashusingh25/job-prep-ai/blob/main/Backend/src/routes/auth.routes.js"
click node_interviewroutes "https://github.com/ashusingh25/job-prep-ai/blob/main/Backend/src/routes/interview.routes.js"
click node_authcontroller "https://github.com/ashusingh25/job-prep-ai/blob/main/Backend/src/controllers/auth.controller.js"
click node_authmw "https://github.com/ashusingh25/job-prep-ai/blob/main/Backend/src/middlewares/auth.middleware.js"
click node_upload "https://github.com/ashusingh25/job-prep-ai/blob/main/Backend/src/middlewares/file.middleware.js"
click node_interviewcontroller "https://github.com/ashusingh25/job-prep-ai/blob/main/Backend/src/controllers/interview.controller.js"
click node_userdb "https://github.com/ashusingh25/job-prep-ai/blob/main/Backend/src/models/user.model.js"
click node_blacklist "https://github.com/ashusingh25/job-prep-ai/blob/main/Backend/src/models/blacklist.model.js"
click node_reports "https://github.com/ashusingh25/job-prep-ai/blob/main/Backend/src/models/interviewReport.model.js"
click node_aiservice "https://github.com/ashusingh25/job-prep-ai/blob/main/Backend/src/services/ai.service.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_router,node_user toneBlue
class node_login,node_register,node_authstate,node_authhook,node_authapi,node_protected,node_mongodb toneAmber
class node_home,node_interviewpage,node_interviewstate,node_interviewhook,node_interviewapi toneMint
class node_express,node_authroutes,node_interviewroutes,node_authcontroller,node_authmw,node_upload,node_interviewcontroller toneRose
class node_userdb,node_blacklist,node_reports,node_aiservice,node_gemini,node_pdfparser toneIndigo
```

## Components

### Frontend

- [React app](https://github.com/ashusingh25/job-prep-ai/blob/main/Frontend/src/App.jsx): `Frontend/src/App.jsx`
- [App routes](https://github.com/ashusingh25/job-prep-ai/blob/main/Frontend/src/app.routes.jsx): `Frontend/src/app.routes.jsx`

### Authentication

- [Login page](https://github.com/ashusingh25/job-prep-ai/blob/main/Frontend/src/features/auth/pages/Login.jsx): `Frontend/src/features/auth/pages/Login.jsx`
- [Register page](https://github.com/ashusingh25/job-prep-ai/blob/main/Frontend/src/features/auth/pages/Register.jsx): `Frontend/src/features/auth/pages/Register.jsx`
- [Auth state](https://github.com/ashusingh25/job-prep-ai/blob/main/Frontend/src/features/auth/auth.context.jsx): `Frontend/src/features/auth/auth.context.jsx`
- [Auth actions](https://github.com/ashusingh25/job-prep-ai/blob/main/Frontend/src/features/auth/hooks/useAuth.js): `Frontend/src/features/auth/hooks/useAuth.js`
- [Auth API client](https://github.com/ashusingh25/job-prep-ai/blob/main/Frontend/src/features/auth/services/auth.api.js): `Frontend/src/features/auth/services/auth.api.js`
- [Protected routes](https://github.com/ashusingh25/job-prep-ai/blob/main/Frontend/src/features/auth/components/Protected.jsx): `Frontend/src/features/auth/components/Protected.jsx`

### Interview preparation

- [Preparation home](https://github.com/ashusingh25/job-prep-ai/blob/main/Frontend/src/features/interview/pages/Home.jsx): `Frontend/src/features/interview/pages/Home.jsx`
- [Report view](https://github.com/ashusingh25/job-prep-ai/blob/main/Frontend/src/features/interview/pages/Interview.jsx): `Frontend/src/features/interview/pages/Interview.jsx`
- [Report state](https://github.com/ashusingh25/job-prep-ai/blob/main/Frontend/src/features/interview/interview.context.jsx): `Frontend/src/features/interview/interview.context.jsx`
- [Report actions](https://github.com/ashusingh25/job-prep-ai/blob/main/Frontend/src/features/interview/hooks/useInterview.js): `Frontend/src/features/interview/hooks/useInterview.js`
- [Interview API client](https://github.com/ashusingh25/job-prep-ai/blob/main/Frontend/src/features/interview/services/interview.api.js): `Frontend/src/features/interview/services/interview.api.js`

### Backend API

- [Express app](https://github.com/ashusingh25/job-prep-ai/blob/main/Backend/src/app.js): `Backend/src/app.js`
- [Auth routes](https://github.com/ashusingh25/job-prep-ai/blob/main/Backend/src/routes/auth.routes.js): `Backend/src/routes/auth.routes.js`
- [Interview routes](https://github.com/ashusingh25/job-prep-ai/blob/main/Backend/src/routes/interview.routes.js): `Backend/src/routes/interview.routes.js`
- [Auth controller](https://github.com/ashusingh25/job-prep-ai/blob/main/Backend/src/controllers/auth.controller.js): `Backend/src/controllers/auth.controller.js`
- [JWT middleware](https://github.com/ashusingh25/job-prep-ai/blob/main/Backend/src/middlewares/auth.middleware.js): `Backend/src/middlewares/auth.middleware.js`
- [Resume upload](https://github.com/ashusingh25/job-prep-ai/blob/main/Backend/src/middlewares/file.middleware.js): `Backend/src/middlewares/file.middleware.js`
- [Report controller](https://github.com/ashusingh25/job-prep-ai/blob/main/Backend/src/controllers/interview.controller.js): `Backend/src/controllers/interview.controller.js`

### Persistence and AI

- [User records](https://github.com/ashusingh25/job-prep-ai/blob/main/Backend/src/models/user.model.js): `Backend/src/models/user.model.js`
- [Token blacklist](https://github.com/ashusingh25/job-prep-ai/blob/main/Backend/src/models/blacklist.model.js): `Backend/src/models/blacklist.model.js`
- [Interview reports](https://github.com/ashusingh25/job-prep-ai/blob/main/Backend/src/models/interviewReport.model.js): `Backend/src/models/interviewReport.model.js`
- [AI generation](https://github.com/ashusingh25/job-prep-ai/blob/main/Backend/src/services/ai.service.js): `Backend/src/services/ai.service.js`

### Other components

- **User**
- **Google Gemini**
- **PDF parser**
- **MongoDB**

## Connections

- User → React app: uses (evidence: `README.md`)
- React app → App routes: provides routes (evidence: `Frontend/src/App.jsx`)
- App routes → Login page: routes to (evidence: `Frontend/src/app.routes.jsx`)
- App routes → Register page: routes to (evidence: `Frontend/src/app.routes.jsx`)
- App routes → Protected routes: guards pages (evidence: `Frontend/src/app.routes.jsx`)
- App routes → Preparation home: routes to (evidence: `Frontend/src/app.routes.jsx`)
- App routes → Report view: routes to (evidence: `Frontend/src/app.routes.jsx`)
- React app → Auth state: provides state (evidence: `Frontend/src/App.jsx`)
- React app → Report state: provides state (evidence: `Frontend/src/App.jsx`)
- Login page → Auth actions: uses (evidence: `Frontend/src/features/auth/pages/Login.jsx`)
- Register page → Auth actions: uses (evidence: `Frontend/src/features/auth/pages/Register.jsx`)
- Protected routes → Auth actions: checks session (evidence: `Frontend/src/features/auth/components/Protected.jsx`)
- Auth actions → Auth state: reads and updates (evidence: `Frontend/src/features/auth/hooks/useAuth.js`)
- Auth actions → Auth API client: calls (evidence: `Frontend/src/features/auth/hooks/useAuth.js`)
- Auth API client → Express app: sends auth requests (evidence: `README.md`)
- Preparation home → Report actions: uses (evidence: `Frontend/src/features/interview/pages/Home.jsx`)
- Report view → Report actions: uses (evidence: `Frontend/src/features/interview/pages/Interview.jsx`)
- Report actions → Report state: reads and updates (evidence: `Frontend/src/features/interview/hooks/useInterview.js`)
- Report actions → Interview API client: calls (evidence: `Frontend/src/features/interview/hooks/useInterview.js`)
- Interview API client → Express app: sends report requests (evidence: `README.md`)
- Express app → Auth routes: mounts (evidence: `Backend/src/app.js`)
- Express app → Interview routes: mounts (evidence: `Backend/src/app.js`)
- Auth routes → Auth controller: dispatches (evidence: `Backend/src/routes/auth.routes.js`)
- Auth routes → JWT middleware: protects profile route (evidence: `Backend/src/routes/auth.routes.js`)
- Interview routes → JWT middleware: authenticates (evidence: `Backend/src/routes/interview.routes.js`)
- Interview routes → Resume upload: uploads resume (evidence: `Backend/src/routes/interview.routes.js`)
- Interview routes → Report controller: dispatches (evidence: `Backend/src/routes/interview.routes.js`)
- Auth controller → User records: reads and writes (evidence: `Backend/src/controllers/auth.controller.js`)
- Auth controller → Token blacklist: blacklists token (evidence: `Backend/src/controllers/auth.controller.js`)
- JWT middleware → Token blacklist: checks token (evidence: `Backend/src/middlewares/auth.middleware.js`)
- Report controller → PDF parser: extracts resume text (evidence: `Backend/src/controllers/interview.controller.js`)
- Report controller → AI generation: requests generation (evidence: `Backend/src/controllers/interview.controller.js`)
- AI generation → Google Gemini: generates responses (evidence: `README.md`)
- Report controller → Interview reports: creates and fetches (evidence: `Backend/src/controllers/interview.controller.js`)
- User records → MongoDB: stores records (evidence: `README.md`)
- Interview reports → MongoDB: stores reports (evidence: `README.md`)
