# ankurdotio/interview-ai-yt architecture

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

- Interactive diagram: https://gitdiagram.com/ankurdotio/interview-ai-yt
- Repository: https://github.com/ankurdotio/interview-ai-yt

## Overview

#### Purpose and Top-Level Entry Points
This is a full-stack interview application with authentication, protected interview workflows, AI-backed interview processing, and persisted interview reports. The backend starts from `Backend/server.js`, composes the Express application in `Backend/src/app.js`, and exposes auth/interview HTTP APIs. The Vite/React frontend starts at `Frontend/src/main.jsx`, renders `Frontend/src/App.jsx`, and selects pages through `Frontend/src/app.routes.jsx`.

#### Client Application and Navigation
The frontend is a React single-page application organized by domain feature. Routing separates public authentication views from authenticated interview views:
- Auth pages: `Frontend/src/features/auth/pages/Login.jsx`, `Frontend/src/features/auth/pages/Register.jsx`
- Interview pages: `Frontend/src/features/interview/pages/Home.jsx`, `Frontend/src/features/interview/pages/Interview.jsx`
- Access boundary: `Frontend/src/features/auth/components/Protected.jsx`

`Protected.jsx` is the client-side route gate; API authorization remains the backend’s responsibility.

#### Authentication Lifecycle
Authentication state is managed centrally in `Frontend/src/features/auth/auth.context.jsx` and consumed through `Frontend/src/features/auth/hooks/useAuth.js`. Requests are encapsulated in `Frontend/src/features/auth/services/auth.api.js`.

On the server, `Backend/src/routes/auth.routes.js` dispatches requests to `Backend/src/controllers/auth.controller.js`. User identity and token invalidation/persistence are represented by `Backend/src/models/user.model.js` and `Backend/src/models/blacklist.model.js`. `Backend/src/middlewares/auth.middleware.js` establishes the protected API boundary for downstream interview operations.

#### Interview Workflow
Interview state is feature-scoped in `Frontend/src/features/interview/interview.context.jsx`, with UI logic accessed through `Frontend/src/features/interview/hooks/useInterview.js`. The frontend calls backend endpoints through `Frontend/src/features/interview/services/interview.api.js`.

Backend interview routes in `Backend/src/routes/interview.routes.js` feed `Backend/src/controllers/interview.controller.js`. That controller is the orchestration layer for interview requests, uploaded material, AI processing, and report persistence.

#### AI and File-Handling Boundary
`Backend/src/services/ai.service.js` isolates AI-provider interactions from HTTP/controller logic. This is the external-service boundary for generating or evaluating interview content.

`Backend/src/middlewares/file.middleware.js` handles request file ingestion before interview controller execution. File processing therefore enters at middleware, is interpreted by the interview controller, and can be supplied to the AI service rather than being coupled directly to route definitions.

#### Persistence and Infrastructure
The backend uses a database connection configured in `Backend/src/config/database.js`. Its primary persisted aggregates are users, revoked/blacklisted authentication artifacts, and interview reports:
- `Backend/src/models/user.model.js`
- `Backend/src/models/blacklist.model.js`
- `Backend/src/models/interviewReport.model.js`

Runtime boundaries are Node.js/Express on the backend (`Backend/server.js`) and Vite/React in the browser (`Frontend/vite.config.js`, `Frontend/src/main.jsx`). The architecture depends materially on a database plus an external AI service, with credentials and connection details expected to be runtime configuration rather than frontend-owned state.

Main entry points: [`Frontend/src/app.routes.jsx`](https://github.com/ankurdotio/interview-ai-yt/blob/main/Frontend/src/app.routes.jsx) (Client routes), [`Frontend/src/features/auth/components/Protected.jsx`](https://github.com/ankurdotio/interview-ai-yt/blob/main/Frontend/src/features/auth/components/Protected.jsx) (Protected route gate), [`Backend/src/app.js`](https://github.com/ankurdotio/interview-ai-yt/blob/main/Backend/src/app.js) (Express app), [`Backend/src/controllers/interview.controller.js`](https://github.com/ankurdotio/interview-ai-yt/blob/main/Backend/src/controllers/interview.controller.js) (Interview controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React client"]
  node_vite{{"Vite runtime<br/>build runtime<br/>[vite.config.js]"}}
  node_client_entry["Client entry<br/>React bootstrap<br/>[main.jsx]"]
  node_client_app["App shell<br/>React app<br/>[App.jsx]"]
  node_client_routes["Client routes<br/>route map<br/>[app.routes.jsx]"]
  node_protected_route["Protected route gate<br/>route guard<br/>[Protected.jsx]"]
  node_auth_client["Auth state and API<br/>auth feature<br/>[auth.context.jsx]"]
  node_auth_pages["Login and register<br/>auth pages<br/>[Login.jsx]"]
  node_interview_client["Interview state and API<br/>interview feature"]
  node_interview_pages["Interview views<br/>interview pages<br/>[Interview.jsx]"]
end

subgraph group_backend["Express API"]
  node_server_entry{{"Server entry<br/>Node bootstrap<br/>[server.js]"}}
  node_express_app["Express app<br/>HTTP composition<br/>[app.js]"]
  node_auth_api["Auth routes and controller<br/>auth HTTP API<br/>[auth.routes.js]"]
  node_auth_guard["API auth middleware<br/>authorization boundary<br/>[auth.middleware.js]"]
  node_interview_routes["Interview routes<br/>interview HTTP API"]
  node_file_ingestion["File ingestion middleware<br/>upload boundary<br/>[file.middleware.js]"]
  node_interview_controller["Interview controller<br/>workflow orchestrator"]
  node_ai_service["AI service<br/>provider adapter<br/>[ai.service.js]"]
end

subgraph group_external["Infrastructure"]
  node_database_config[("Database connection<br/>database adapter<br/>[database.js]")]
  node_user_store[("Users and token blacklist<br/>identity persistence<br/>[user.model.js]")]
  node_report_store[("Interview reports<br/>report persistence")]
  node_ai_provider{{"External AI provider<br/>AI service"}}
end

node_vite -->|"serves"| node_client_entry
node_client_entry -->|"renders"| node_client_app
node_client_app -->|"uses"| node_client_routes
node_client_routes -->|"public routes"| node_auth_pages
node_client_routes -->|"authenticated routes"| node_protected_route
node_protected_route -->|"permits"| node_interview_pages
node_auth_pages -->|"sign-in requests"| node_auth_client
node_protected_route -->|"reads session"| node_auth_client
node_interview_pages -->|"drives workflow"| node_interview_client
node_auth_client -->|"HTTP"| node_auth_api
node_interview_client -->|"HTTP"| node_interview_routes
node_server_entry -->|"starts"| node_express_app
node_express_app -->|"mounts"| node_auth_api
node_express_app -->|"mounts"| node_interview_routes
node_auth_api -->|"identity and revocation"| node_user_store
node_interview_routes -->|"authenticates"| node_auth_guard
node_auth_guard -->|"allows uploads"| node_file_ingestion
node_file_ingestion -->|"supplies files"| node_interview_controller
node_interview_controller -->|"generates or evaluates"| node_ai_service
node_ai_service -->|"provider calls"| node_ai_provider
node_interview_controller -->|"persists reports"| node_report_store
node_database_config -->|"connects"| node_user_store
node_database_config -->|"connects"| node_report_store

click node_vite "https://github.com/ankurdotio/interview-ai-yt/blob/main/Frontend/vite.config.js"
click node_client_entry "https://github.com/ankurdotio/interview-ai-yt/blob/main/Frontend/src/main.jsx"
click node_client_app "https://github.com/ankurdotio/interview-ai-yt/blob/main/Frontend/src/App.jsx"
click node_client_routes "https://github.com/ankurdotio/interview-ai-yt/blob/main/Frontend/src/app.routes.jsx"
click node_protected_route "https://github.com/ankurdotio/interview-ai-yt/blob/main/Frontend/src/features/auth/components/Protected.jsx"
click node_auth_client "https://github.com/ankurdotio/interview-ai-yt/blob/main/Frontend/src/features/auth/auth.context.jsx"
click node_auth_pages "https://github.com/ankurdotio/interview-ai-yt/blob/main/Frontend/src/features/auth/pages/Login.jsx"
click node_interview_client "https://github.com/ankurdotio/interview-ai-yt/blob/main/Frontend/src/features/interview/interview.context.jsx"
click node_interview_pages "https://github.com/ankurdotio/interview-ai-yt/blob/main/Frontend/src/features/interview/pages/Interview.jsx"
click node_server_entry "https://github.com/ankurdotio/interview-ai-yt/blob/main/Backend/server.js"
click node_express_app "https://github.com/ankurdotio/interview-ai-yt/blob/main/Backend/src/app.js"
click node_auth_api "https://github.com/ankurdotio/interview-ai-yt/blob/main/Backend/src/routes/auth.routes.js"
click node_auth_guard "https://github.com/ankurdotio/interview-ai-yt/blob/main/Backend/src/middlewares/auth.middleware.js"
click node_interview_routes "https://github.com/ankurdotio/interview-ai-yt/blob/main/Backend/src/routes/interview.routes.js"
click node_file_ingestion "https://github.com/ankurdotio/interview-ai-yt/blob/main/Backend/src/middlewares/file.middleware.js"
click node_interview_controller "https://github.com/ankurdotio/interview-ai-yt/blob/main/Backend/src/controllers/interview.controller.js"
click node_ai_service "https://github.com/ankurdotio/interview-ai-yt/blob/main/Backend/src/services/ai.service.js"
click node_database_config "https://github.com/ankurdotio/interview-ai-yt/blob/main/Backend/src/config/database.js"
click node_user_store "https://github.com/ankurdotio/interview-ai-yt/blob/main/Backend/src/models/user.model.js"
click node_report_store "https://github.com/ankurdotio/interview-ai-yt/blob/main/Backend/src/models/interviewReport.model.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_vite,node_client_entry,node_client_app,node_client_routes,node_protected_route,node_auth_client,node_auth_pages,node_interview_client,node_interview_pages toneBlue
class node_server_entry,node_express_app,node_auth_api,node_auth_guard,node_interview_routes,node_file_ingestion,node_interview_controller,node_ai_service toneAmber
class node_database_config,node_user_store,node_report_store,node_ai_provider toneMint
```

## Components

### React client

Vite single-page application.

- [Vite runtime](https://github.com/ankurdotio/interview-ai-yt/blob/main/Frontend/vite.config.js): build runtime · `Frontend/vite.config.js`
- [Client entry](https://github.com/ankurdotio/interview-ai-yt/blob/main/Frontend/src/main.jsx): React bootstrap · `Frontend/src/main.jsx`
- [App shell](https://github.com/ankurdotio/interview-ai-yt/blob/main/Frontend/src/App.jsx): React app · `Frontend/src/App.jsx`
- [Client routes](https://github.com/ankurdotio/interview-ai-yt/blob/main/Frontend/src/app.routes.jsx): route map · Separates public authentication and interview views. · `Frontend/src/app.routes.jsx`
- [Protected route gate](https://github.com/ankurdotio/interview-ai-yt/blob/main/Frontend/src/features/auth/components/Protected.jsx): route guard · Enforces client-side authenticated navigation. · `Frontend/src/features/auth/components/Protected.jsx`
- [Auth state and API](https://github.com/ankurdotio/interview-ai-yt/blob/main/Frontend/src/features/auth/auth.context.jsx): auth feature · Central authentication state and request layer. · `Frontend/src/features/auth/auth.context.jsx`
- [Login and register](https://github.com/ankurdotio/interview-ai-yt/blob/main/Frontend/src/features/auth/pages/Login.jsx): auth pages · `Frontend/src/features/auth/pages/Login.jsx`
- [Interview state and API](https://github.com/ankurdotio/interview-ai-yt/blob/main/Frontend/src/features/interview/interview.context.jsx): interview feature · Feature state and backend request layer. · `Frontend/src/features/interview/interview.context.jsx`
- [Interview views](https://github.com/ankurdotio/interview-ai-yt/blob/main/Frontend/src/features/interview/pages/Interview.jsx): interview pages · `Frontend/src/features/interview/pages/Interview.jsx`

### Express API

Node.js HTTP application and workflow orchestration.

- [Server entry](https://github.com/ankurdotio/interview-ai-yt/blob/main/Backend/server.js): Node bootstrap · `Backend/server.js`
- [Express app](https://github.com/ankurdotio/interview-ai-yt/blob/main/Backend/src/app.js): HTTP composition · `Backend/src/app.js`
- [Auth routes and controller](https://github.com/ankurdotio/interview-ai-yt/blob/main/Backend/src/routes/auth.routes.js): auth HTTP API · Handles authentication requests and token lifecycle. · `Backend/src/routes/auth.routes.js`
- [API auth middleware](https://github.com/ankurdotio/interview-ai-yt/blob/main/Backend/src/middlewares/auth.middleware.js): authorization boundary · Authenticates protected interview requests. · `Backend/src/middlewares/auth.middleware.js`
- [Interview routes](https://github.com/ankurdotio/interview-ai-yt/blob/main/Backend/src/routes/interview.routes.js): interview HTTP API · `Backend/src/routes/interview.routes.js`
- [File ingestion middleware](https://github.com/ankurdotio/interview-ai-yt/blob/main/Backend/src/middlewares/file.middleware.js): upload boundary · `Backend/src/middlewares/file.middleware.js`
- [Interview controller](https://github.com/ankurdotio/interview-ai-yt/blob/main/Backend/src/controllers/interview.controller.js): workflow orchestrator · Coordinates uploads, AI processing, and report persistence. · `Backend/src/controllers/interview.controller.js`
- [AI service](https://github.com/ankurdotio/interview-ai-yt/blob/main/Backend/src/services/ai.service.js): provider adapter · Isolates external AI-provider interactions. · `Backend/src/services/ai.service.js`

### Infrastructure

Persisted data and external AI capability.

- [Database connection](https://github.com/ankurdotio/interview-ai-yt/blob/main/Backend/src/config/database.js): database adapter · `Backend/src/config/database.js`
- [Users and token blacklist](https://github.com/ankurdotio/interview-ai-yt/blob/main/Backend/src/models/user.model.js): identity persistence · Stores users and revoked authentication artifacts. · `Backend/src/models/user.model.js`
- [Interview reports](https://github.com/ankurdotio/interview-ai-yt/blob/main/Backend/src/models/interviewReport.model.js): report persistence · `Backend/src/models/interviewReport.model.js`
- **External AI provider**: AI service

## Connections

- Vite runtime → Client entry: serves
- Client entry → App shell: renders
- App shell → Client routes: uses
- Client routes → Login and register: public routes
- Client routes → Protected route gate: authenticated routes
- Protected route gate → Interview views: permits
- Login and register → Auth state and API: sign-in requests
- Protected route gate → Auth state and API: reads session
- Interview views → Interview state and API: drives workflow
- Auth state and API → Auth routes and controller: HTTP
- Interview state and API → Interview routes: HTTP
- Server entry → Express app: starts
- Express app → Auth routes and controller: mounts
- Express app → Interview routes: mounts
- Auth routes and controller → Users and token blacklist: identity and revocation
- Interview routes → API auth middleware: authenticates
- API auth middleware → File ingestion middleware: allows uploads
- File ingestion middleware → Interview controller: supplies files
- Interview controller → AI service: generates or evaluates
- AI service → External AI provider: provider calls
- Interview controller → Interview reports: persists reports
- Database connection → Users and token blacklist: connects
- Database connection → Interview reports: connects
