# darshan-sakdecha/interview-preparation-ai architecture

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

- Interactive diagram: https://gitdiagram.com/darshan-sakdecha/interview-preparation-ai
- Repository: https://github.com/darshan-sakdecha/interview-preparation-ai

## Overview

This is an AI interview-preparation application: users register or log in, submit a resume and job description, receive a generated interview report, browse saved reports, and can request a tailored resume PDF. The graph separates the browser experience, backend request handling, interview generation, and persistence. The sampled sources show backend routing and controller calls; the frontend-to-backend API links are dashed because the excerpts do not show their HTTP wiring.

Main entry points: [`Backend/src/routes/interview.routes.js`](https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Backend/src/routes/interview.routes.js) (Interview routes), [`Frontend/src/app.routes.jsx`](https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Frontend/src/app.routes.jsx) (Page routes), [`Frontend/src/features/auth/hooks/useAuth.js`](https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Frontend/src/features/auth/hooks/useAuth.js) (Auth actions), [`Backend/src/routes/auth.routes.js`](https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Backend/src/routes/auth.routes.js) (Auth routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["App providers<br/>[App.jsx]"]
  node_routes["Page routes<br/>[app.routes.jsx]"]
  node_interview_pages["Interview pages"]
end

subgraph group_identity["Authentication"]
  node_auth_pages["Login and register"]
  node_auth_guard["Protected routes<br/>[Protected.jsx]"]
  node_auth_hook["Auth actions<br/>[useAuth.js]"]
  node_auth_context["Auth state<br/>[auth.context.jsx]"]
  node_auth_api["Auth API client<br/>[auth.api.js]"]
end

subgraph group_backend["Backend API"]
  node_server["Server startup<br/>[server.js]"]
  node_app_server["HTTP application<br/>[app.js]"]
  node_auth_routes["Auth routes<br/>[auth.routes.js]"]
  node_interview_routes["Interview routes"]
  node_auth_controller["Auth operations<br/>[auth.controller.js]"]
  node_auth_middleware["Token validation<br/>[auth.middleware.js]"]
  node_file_middleware["Resume upload<br/>[file.middleware.js]"]
end

subgraph group_interview["Interview workflow"]
  node_interview_hook["Interview actions<br/>[useInterview.js]"]
  node_interview_context["Interview state"]
  node_interview_api["Interview API client<br/>[interview.api.js]"]
  node_interview_controller["Report operations"]
  node_ai_service["AI generation<br/>[ai.service.js]"]
end

subgraph group_storage["Persistence"]
  node_user_store[("User records<br/>[user.model.js]")]
  node_blacklist_store[("Token blacklist<br/>[blacklist.model.js]")]
  node_report_store[("Interview reports")]
  node_db_config["Database config<br/>[db.js]"]
end

node_candidate(("Candidate"))

node_candidate -->|"signs in"| node_auth_pages
node_candidate -->|"uses"| node_interview_pages
node_app -->|"provides router"| node_routes
node_routes -->|"routes to"| node_auth_pages
node_routes -->|"protects"| node_auth_guard
node_routes -->|"routes to"| node_interview_pages
node_auth_pages -->|"uses"| node_auth_hook
node_auth_guard -->|"checks access"| node_auth_hook
node_auth_hook -->|"calls"| node_auth_api
node_auth_hook -->|"updates state"| node_auth_context
node_auth_context -->|"loads identity"| node_auth_api
node_interview_pages -->|"uses"| node_interview_hook
node_interview_hook -->|"calls"| node_interview_api
node_interview_hook -->|"updates state"| node_interview_context
node_server -->|"starts"| node_app_server
node_app_server -->|"mounts"| node_auth_routes
node_app_server -->|"mounts"| node_interview_routes
node_auth_routes -->|"dispatches"| node_auth_controller
node_auth_routes -->|"guards requests"| node_auth_middleware
node_interview_routes -->|"guards requests"| node_auth_middleware
node_interview_routes -->|"parses uploads"| node_file_middleware
node_interview_routes -->|"dispatches"| node_interview_controller
node_auth_controller -->|"reads and writes"| node_user_store
node_auth_controller -->|"blacklists token"| node_blacklist_store
node_auth_middleware -->|"checks token"| node_blacklist_store
node_interview_controller -->|"generates content"| node_ai_service
node_interview_controller -->|"reads and writes"| node_report_store
node_auth_api -.->|"sends HTTP requests"| node_auth_routes
node_interview_api -.->|"sends HTTP requests"| node_interview_routes

click node_app "https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Frontend/src/App.jsx"
click node_routes "https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Frontend/src/app.routes.jsx"
click node_auth_pages "https://github.com/darshan-sakdecha/interview-preparation-ai/tree/main/Frontend/src/features/auth/pages"
click node_auth_guard "https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Frontend/src/features/auth/components/Protected.jsx"
click node_auth_hook "https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Frontend/src/features/auth/hooks/useAuth.js"
click node_auth_context "https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Frontend/src/features/auth/auth.context.jsx"
click node_auth_api "https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Frontend/src/features/auth/services/auth.api.js"
click node_interview_pages "https://github.com/darshan-sakdecha/interview-preparation-ai/tree/main/Frontend/src/features/interview/pages"
click node_interview_hook "https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Frontend/src/features/interview/hooks/useInterview.js"
click node_interview_context "https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Frontend/src/features/interview/interview.context.jsx"
click node_interview_api "https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Frontend/src/features/interview/services/interview.api.js"
click node_server "https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Backend/server.js"
click node_app_server "https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Backend/src/app.js"
click node_auth_routes "https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Backend/src/routes/auth.routes.js"
click node_interview_routes "https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Backend/src/routes/interview.routes.js"
click node_auth_controller "https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Backend/src/controllers/auth.controller.js"
click node_auth_middleware "https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Backend/src/middlewares/auth.middleware.js"
click node_file_middleware "https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Backend/src/middlewares/file.middleware.js"
click node_interview_controller "https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Backend/src/controllers/interview.controller.js"
click node_ai_service "https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Backend/src/services/ai.service.js"
click node_user_store "https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Backend/src/models/user.model.js"
click node_blacklist_store "https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Backend/src/models/blacklist.model.js"
click node_report_store "https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Backend/src/models/interviewReport.model.js"
click node_db_config "https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Backend/src/config/db.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_routes,node_interview_pages toneBlue
class node_auth_pages,node_auth_guard,node_auth_hook,node_auth_context,node_auth_api toneAmber
class node_server,node_app_server,node_auth_routes,node_interview_routes,node_auth_controller,node_auth_middleware,node_file_middleware toneMint
class node_interview_hook,node_interview_context,node_interview_api,node_interview_controller,node_ai_service toneRose
class node_user_store,node_blacklist_store,node_report_store,node_db_config,node_candidate toneIndigo
```

## Components

### Web application

- [App providers](https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Frontend/src/App.jsx): `Frontend/src/App.jsx`
- [Page routes](https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Frontend/src/app.routes.jsx): `Frontend/src/app.routes.jsx`
- [Interview pages](https://github.com/darshan-sakdecha/interview-preparation-ai/tree/main/Frontend/src/features/interview/pages): `Frontend/src/features/interview/pages`

### Authentication

- [Login and register](https://github.com/darshan-sakdecha/interview-preparation-ai/tree/main/Frontend/src/features/auth/pages): `Frontend/src/features/auth/pages`
- [Protected routes](https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Frontend/src/features/auth/components/Protected.jsx): `Frontend/src/features/auth/components/Protected.jsx`
- [Auth actions](https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Frontend/src/features/auth/hooks/useAuth.js): `Frontend/src/features/auth/hooks/useAuth.js`
- [Auth state](https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Frontend/src/features/auth/auth.context.jsx): `Frontend/src/features/auth/auth.context.jsx`
- [Auth API client](https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Frontend/src/features/auth/services/auth.api.js): `Frontend/src/features/auth/services/auth.api.js`

### Backend API

- [Server startup](https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Backend/server.js): `Backend/server.js`
- [HTTP application](https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Backend/src/app.js): `Backend/src/app.js`
- [Auth routes](https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Backend/src/routes/auth.routes.js): `Backend/src/routes/auth.routes.js`
- [Interview routes](https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Backend/src/routes/interview.routes.js): `Backend/src/routes/interview.routes.js`
- [Auth operations](https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Backend/src/controllers/auth.controller.js): `Backend/src/controllers/auth.controller.js`
- [Token validation](https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Backend/src/middlewares/auth.middleware.js): `Backend/src/middlewares/auth.middleware.js`
- [Resume upload](https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Backend/src/middlewares/file.middleware.js): `Backend/src/middlewares/file.middleware.js`

### Interview workflow

- [Interview actions](https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Frontend/src/features/interview/hooks/useInterview.js): `Frontend/src/features/interview/hooks/useInterview.js`
- [Interview state](https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Frontend/src/features/interview/interview.context.jsx): `Frontend/src/features/interview/interview.context.jsx`
- [Interview API client](https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Frontend/src/features/interview/services/interview.api.js): `Frontend/src/features/interview/services/interview.api.js`
- [Report operations](https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Backend/src/controllers/interview.controller.js): `Backend/src/controllers/interview.controller.js`
- [AI generation](https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Backend/src/services/ai.service.js): `Backend/src/services/ai.service.js`

### Persistence

- [User records](https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Backend/src/models/user.model.js): `Backend/src/models/user.model.js`
- [Token blacklist](https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Backend/src/models/blacklist.model.js): `Backend/src/models/blacklist.model.js`
- [Interview reports](https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Backend/src/models/interviewReport.model.js): `Backend/src/models/interviewReport.model.js`
- [Database config](https://github.com/darshan-sakdecha/interview-preparation-ai/blob/main/Backend/src/config/db.js): `Backend/src/config/db.js`

### Other components

- **Candidate**

## Connections

- Candidate → Login and register: signs in
- Candidate → Interview pages: uses
- App providers → Page routes: provides router (evidence: `Frontend/src/App.jsx`)
- Page routes → Login and register: routes to (evidence: `Frontend/src/app.routes.jsx`)
- Page routes → Protected routes: protects (evidence: `Frontend/src/app.routes.jsx`)
- Page routes → Interview pages: routes to (evidence: `Frontend/src/app.routes.jsx`)
- Login and register → Auth actions: uses (evidence: `Frontend/src/features/auth/pages/Login.jsx`)
- Protected routes → Auth actions: checks access (evidence: `Frontend/src/features/auth/components/Protected.jsx`)
- Auth actions → Auth API client: calls (evidence: `Frontend/src/features/auth/hooks/useAuth.js`)
- Auth actions → Auth state: updates state (evidence: `Frontend/src/features/auth/hooks/useAuth.js`)
- Auth state → Auth API client: loads identity (evidence: `Frontend/src/features/auth/auth.context.jsx`)
- Interview pages → Interview actions: uses (evidence: `Frontend/src/features/interview/pages/Home.jsx`)
- Interview actions → Interview API client: calls (evidence: `Frontend/src/features/interview/hooks/useInterview.js`)
- Interview actions → Interview state: updates state (evidence: `Frontend/src/features/interview/hooks/useInterview.js`)
- Server startup → HTTP application: starts (evidence: `Backend/server.js`)
- HTTP application → Auth routes: mounts (evidence: `Backend/src/app.js`)
- HTTP application → Interview routes: mounts (evidence: `Backend/src/app.js`)
- Auth routes → Auth operations: dispatches (evidence: `Backend/src/routes/auth.routes.js`)
- Auth routes → Token validation: guards requests (evidence: `Backend/src/routes/auth.routes.js`)
- Interview routes → Token validation: guards requests (evidence: `Backend/src/routes/interview.routes.js`)
- Interview routes → Resume upload: parses uploads (evidence: `Backend/src/routes/interview.routes.js`)
- Interview routes → Report operations: dispatches (evidence: `Backend/src/routes/interview.routes.js`)
- Auth operations → User records: reads and writes (evidence: `Backend/src/controllers/auth.controller.js`)
- Auth operations → Token blacklist: blacklists token (evidence: `Backend/src/controllers/auth.controller.js`)
- Token validation → Token blacklist: checks token (evidence: `Backend/src/middlewares/auth.middleware.js`)
- Report operations → AI generation: generates content (evidence: `Backend/src/controllers/interview.controller.js`)
- Report operations → Interview reports: reads and writes (evidence: `Backend/src/controllers/interview.controller.js`)
- Auth API client → Auth routes: sends HTTP requests
- Interview API client → Interview routes: sends HTTP requests
