# tejasxkoder/genai-project architecture

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

- Interactive diagram: https://gitdiagram.com/tejasxkoder/genai-project
- Repository: https://github.com/tejasxkoder/genai-project

## Overview

#### Purpose and Entry Points
This is a full-stack interview application with authentication, protected client routes, interview execution, AI-backed processing, uploaded-file handling, and persisted interview reports.

- Backend process: `Backend/server.js`, `Backend/src/app.js`
- Frontend bootstrap and root composition: `Frontend/src/main.jsx`, `Frontend/src/App.jsx`
- Client route definition: `Frontend/src/app.routes.jsx`

#### Backend HTTP Application
The Node.js backend separates application setup from process startup. Route modules expose authentication and interview APIs; controllers implement request-level orchestration.

- Application/server boundary: `Backend/server.js`, `Backend/src/app.js`
- Auth API surface: `Backend/src/routes/auth.routes.js`, `Backend/src/controllers/auth.controller.js`
- Interview API surface: `Backend/src/routes/interview.routes.js`, `Backend/src/controllers/interview.controller.js`

Primary flow is HTTP request → route → middleware where applicable → controller → model/service → HTTP response.

#### Identity and Access Control
Authentication is a cross-cutting backend/frontend concern. Users are persisted server-side, invalidated credentials/tokens are tracked separately, and protected frontend content is gated through auth context and a protection component.

- Server identity state: `Backend/src/models/user.model.js`, `Backend/src/models/blacklist.model.js`
- Request authorization boundary: `Backend/src/middlewares/auth.middleware.js`
- Client auth state and protected routes: `Frontend/src/features/auth/auth.context.jsx`, `Frontend/src/features/auth/components/protected.jsx`, `Frontend/src/features/auth/hooks/useAuth.js`

Client auth calls are isolated behind `Frontend/src/features/auth/services/auth.api.js`.

#### Interview Workflow and AI Boundary
Interview functionality is organized as its own frontend feature and backend route/controller pair. The backend controller is the workflow coordinator and delegates AI-specific behavior to a dedicated service, keeping external AI integration outside HTTP routing.

- Backend orchestration: `Backend/src/controllers/interview.controller.js`, `Backend/src/routes/interview.routes.js`
- AI integration boundary: `Backend/src/services/ai.service.js`
- Client interview screens/API boundary: `Frontend/src/features/auth/pages/interview.jsx`, `Frontend/src/features/interview/pages/home.jsx`, `Frontend/src/features/interview/services/interview.api.js`

Likely flow: authenticated client initiates/submits interview activity → interview API → controller invokes AI service and persistence → client renders interview/home state.

#### Persistence and File Handling
The backend has a centralized database configuration and three principal persistence domains: users, token/credential blacklist records, and interview reports. File upload parsing is deliberately isolated as middleware before interview controller handling.

- Database integration: `Backend/src/config/database.js`
- Interview-report persistence: `Backend/src/models/interviewReport.model.js`
- Upload boundary: `Backend/src/middlewares/file.middleware.js`

This establishes a material trust boundary: uploaded content should be processed only after file middleware and, for protected operations, authentication middleware.

#### Frontend Composition
The frontend is a React application built with Vite. Features are grouped primarily by auth and interview domain, with pages consuming feature-local API clients rather than directly coupling UI to backend endpoints.

- Vite/client runtime configuration: `Frontend/vite.config.js`, `Frontend/package.json`
- Auth pages: `Frontend/src/features/auth/pages/Login.jsx`, `Frontend/src/features/auth/pages/Register.jsx`
- Interview presentation: `Frontend/src/features/interview/pages/home.jsx`, `Frontend/src/features/interview/style/interview.scss`

The frontend’s main control flow is bootstrap → app/routes → auth provider/protected route checks → feature page → feature API service → backend HTTP API.

Main entry points: [`Backend/src/routes/interview.routes.js`](https://github.com/tejasxkoder/genai-project/blob/main/Backend/src/routes/interview.routes.js) (Interview API), [`Backend/src/controllers/interview.controller.js`](https://github.com/tejasxkoder/genai-project/blob/main/Backend/src/controllers/interview.controller.js) (Interview workflow), [`Backend/src/config/database.js`](https://github.com/tejasxkoder/genai-project/blob/main/Backend/src/config/database.js) (Database connection), [`Frontend/src/app.routes.jsx`](https://github.com/tejasxkoder/genai-project/blob/main/Frontend/src/app.routes.jsx) (Client routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React client"]
  node_client_bootstrap["Client bootstrap<br/>React entry<br/>[main.jsx]"]
  node_client_app["App composition<br/>React root<br/>[App.jsx]"]
  node_client_routes["Client routes<br/>route map<br/>[app.routes.jsx]"]
  node_auth_context["Auth state<br/>context<br/>[auth.context.jsx]"]
  node_protected_routes["Protected route gate<br/>route guard<br/>[protected.jsx]"]
  node_auth_pages["Login and registration<br/>auth pages<br/>[Login.jsx]"]
  node_auth_api["Auth API client<br/>HTTP client<br/>[auth.api.js]"]
  node_interview_ui["Interview UI<br/>feature pages<br/>[home.jsx]"]
  node_interview_api["Interview API client<br/>HTTP client<br/>[interview.api.js]"]
end

subgraph group_backend["Node API"]
  node_server_process["Server process<br/>Node entry<br/>[server.js]"]
  node_http_app["HTTP application<br/>Express app<br/>[app.js]"]
  node_auth_routes["Auth API<br/>route module<br/>[auth.routes.js]"]
  node_auth_controller["Auth controller<br/>request controller<br/>[auth.controller.js]"]
  node_interview_routes["Interview API<br/>route module"]
  node_access_upload["Access and upload checks<br/>middleware<br/>[auth.middleware.js]"]
  node_interview_controller["Interview workflow<br/>request controller"]
  node_ai_service{{"AI integration<br/>AI service<br/>[ai.service.js]"}}
end

subgraph group_persistence["Persistence"]
  node_database_config[("Database connection<br/>database config<br/>[database.js]")]
  node_user_model[("Users<br/>data model<br/>[user.model.js]")]
  node_blacklist_model[("Invalidated tokens<br/>data model<br/>[blacklist.model.js]")]
  node_report_model[("Interview reports<br/>data model")]
end

node_client_bootstrap -->|"mounts"| node_client_app
node_client_app -->|"renders"| node_client_routes
node_client_routes -->|"uses"| node_auth_context
node_client_routes -->|"guards"| node_protected_routes
node_protected_routes -->|"admits authenticated users"| node_interview_ui
node_auth_pages -->|"auth requests"| node_auth_api
node_auth_api -->|"HTTP"| node_auth_routes
node_interview_ui -->|"interview requests"| node_interview_api
node_interview_api -->|"HTTP"| node_interview_routes
node_server_process -->|"starts"| node_http_app
node_http_app -->|"mounts"| node_auth_routes
node_http_app -->|"mounts"| node_interview_routes
node_auth_routes -->|"dispatches"| node_auth_controller
node_interview_routes -->|"runs before controller"| node_access_upload
node_access_upload -->|"validated request"| node_interview_controller
node_interview_routes -.->|"dispatches"| node_interview_controller
node_auth_controller -->|"manages identities"| node_user_model
node_auth_controller -->|"tracks invalidation"| node_blacklist_model
node_access_upload -->|"checks token state"| node_blacklist_model
node_interview_controller -->|"delegates processing"| node_ai_service
node_interview_controller -->|"persists reports"| node_report_model
node_database_config -->|"connects"| node_user_model
node_database_config -->|"connects"| node_blacklist_model
node_database_config -->|"connects"| node_report_model

click node_client_bootstrap "https://github.com/tejasxkoder/genai-project/blob/main/Frontend/src/main.jsx"
click node_client_app "https://github.com/tejasxkoder/genai-project/blob/main/Frontend/src/App.jsx"
click node_client_routes "https://github.com/tejasxkoder/genai-project/blob/main/Frontend/src/app.routes.jsx"
click node_auth_context "https://github.com/tejasxkoder/genai-project/blob/main/Frontend/src/features/auth/auth.context.jsx"
click node_protected_routes "https://github.com/tejasxkoder/genai-project/blob/main/Frontend/src/features/auth/components/protected.jsx"
click node_auth_pages "https://github.com/tejasxkoder/genai-project/blob/main/Frontend/src/features/auth/pages/Login.jsx"
click node_auth_api "https://github.com/tejasxkoder/genai-project/blob/main/Frontend/src/features/auth/services/auth.api.js"
click node_interview_ui "https://github.com/tejasxkoder/genai-project/blob/main/Frontend/src/features/interview/pages/home.jsx"
click node_interview_api "https://github.com/tejasxkoder/genai-project/blob/main/Frontend/src/features/interview/services/interview.api.js"
click node_server_process "https://github.com/tejasxkoder/genai-project/blob/main/Backend/server.js"
click node_http_app "https://github.com/tejasxkoder/genai-project/blob/main/Backend/src/app.js"
click node_auth_routes "https://github.com/tejasxkoder/genai-project/blob/main/Backend/src/routes/auth.routes.js"
click node_auth_controller "https://github.com/tejasxkoder/genai-project/blob/main/Backend/src/controllers/auth.controller.js"
click node_interview_routes "https://github.com/tejasxkoder/genai-project/blob/main/Backend/src/routes/interview.routes.js"
click node_access_upload "https://github.com/tejasxkoder/genai-project/blob/main/Backend/src/middlewares/auth.middleware.js"
click node_interview_controller "https://github.com/tejasxkoder/genai-project/blob/main/Backend/src/controllers/interview.controller.js"
click node_ai_service "https://github.com/tejasxkoder/genai-project/blob/main/Backend/src/services/ai.service.js"
click node_database_config "https://github.com/tejasxkoder/genai-project/blob/main/Backend/src/config/database.js"
click node_user_model "https://github.com/tejasxkoder/genai-project/blob/main/Backend/src/models/user.model.js"
click node_blacklist_model "https://github.com/tejasxkoder/genai-project/blob/main/Backend/src/models/blacklist.model.js"
click node_report_model "https://github.com/tejasxkoder/genai-project/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_client_bootstrap,node_client_app,node_client_routes,node_auth_context,node_protected_routes,node_auth_pages,node_auth_api,node_interview_ui,node_interview_api toneBlue
class node_server_process,node_http_app,node_auth_routes,node_auth_controller,node_interview_routes,node_access_upload,node_interview_controller,node_ai_service toneAmber
class node_database_config,node_user_model,node_blacklist_model,node_report_model toneMint
```

## Components

### React client

- [Client bootstrap](https://github.com/tejasxkoder/genai-project/blob/main/Frontend/src/main.jsx): React entry · `Frontend/src/main.jsx`
- [App composition](https://github.com/tejasxkoder/genai-project/blob/main/Frontend/src/App.jsx): React root · `Frontend/src/App.jsx`
- [Client routes](https://github.com/tejasxkoder/genai-project/blob/main/Frontend/src/app.routes.jsx): route map · `Frontend/src/app.routes.jsx`
- [Auth state](https://github.com/tejasxkoder/genai-project/blob/main/Frontend/src/features/auth/auth.context.jsx): context · `Frontend/src/features/auth/auth.context.jsx`
- [Protected route gate](https://github.com/tejasxkoder/genai-project/blob/main/Frontend/src/features/auth/components/protected.jsx): route guard · `Frontend/src/features/auth/components/protected.jsx`
- [Login and registration](https://github.com/tejasxkoder/genai-project/blob/main/Frontend/src/features/auth/pages/Login.jsx): auth pages · `Frontend/src/features/auth/pages/Login.jsx`
- [Auth API client](https://github.com/tejasxkoder/genai-project/blob/main/Frontend/src/features/auth/services/auth.api.js): HTTP client · `Frontend/src/features/auth/services/auth.api.js`
- [Interview UI](https://github.com/tejasxkoder/genai-project/blob/main/Frontend/src/features/interview/pages/home.jsx): feature pages · `Frontend/src/features/interview/pages/home.jsx`
- [Interview API client](https://github.com/tejasxkoder/genai-project/blob/main/Frontend/src/features/interview/services/interview.api.js): HTTP client · `Frontend/src/features/interview/services/interview.api.js`

### Node API

- [Server process](https://github.com/tejasxkoder/genai-project/blob/main/Backend/server.js): Node entry · `Backend/server.js`
- [HTTP application](https://github.com/tejasxkoder/genai-project/blob/main/Backend/src/app.js): Express app · `Backend/src/app.js`
- [Auth API](https://github.com/tejasxkoder/genai-project/blob/main/Backend/src/routes/auth.routes.js): route module · `Backend/src/routes/auth.routes.js`
- [Auth controller](https://github.com/tejasxkoder/genai-project/blob/main/Backend/src/controllers/auth.controller.js): request controller · `Backend/src/controllers/auth.controller.js`
- [Interview API](https://github.com/tejasxkoder/genai-project/blob/main/Backend/src/routes/interview.routes.js): route module · `Backend/src/routes/interview.routes.js`
- [Access and upload checks](https://github.com/tejasxkoder/genai-project/blob/main/Backend/src/middlewares/auth.middleware.js): middleware · Authenticates protected requests and parses uploaded files before interview handling. · `Backend/src/middlewares/auth.middleware.js`
- [Interview workflow](https://github.com/tejasxkoder/genai-project/blob/main/Backend/src/controllers/interview.controller.js): request controller · Coordinates interview processing, AI calls, and report persistence. · `Backend/src/controllers/interview.controller.js`
- [AI integration](https://github.com/tejasxkoder/genai-project/blob/main/Backend/src/services/ai.service.js): AI service · `Backend/src/services/ai.service.js`

### Persistence

- [Database connection](https://github.com/tejasxkoder/genai-project/blob/main/Backend/src/config/database.js): database config · `Backend/src/config/database.js`
- [Users](https://github.com/tejasxkoder/genai-project/blob/main/Backend/src/models/user.model.js): data model · `Backend/src/models/user.model.js`
- [Invalidated tokens](https://github.com/tejasxkoder/genai-project/blob/main/Backend/src/models/blacklist.model.js): data model · `Backend/src/models/blacklist.model.js`
- [Interview reports](https://github.com/tejasxkoder/genai-project/blob/main/Backend/src/models/interviewReport.model.js): data model · `Backend/src/models/interviewReport.model.js`

## Connections

- Client bootstrap → App composition: mounts
- App composition → Client routes: renders
- Client routes → Auth state: uses
- Client routes → Protected route gate: guards
- Protected route gate → Interview UI: admits authenticated users
- Login and registration → Auth API client: auth requests
- Auth API client → Auth API: HTTP
- Interview UI → Interview API client: interview requests
- Interview API client → Interview API: HTTP
- Server process → HTTP application: starts
- HTTP application → Auth API: mounts
- HTTP application → Interview API: mounts
- Auth API → Auth controller: dispatches
- Interview API → Access and upload checks: runs before controller
- Access and upload checks → Interview workflow: validated request
- Interview API → Interview workflow: dispatches
- Auth controller → Users: manages identities
- Auth controller → Invalidated tokens: tracks invalidation
- Access and upload checks → Invalidated tokens: checks token state
- Interview workflow → AI integration: delegates processing
- Interview workflow → Interview reports: persists reports
- Database connection → Users: connects
- Database connection → Invalidated tokens: connects
- Database connection → Interview reports: connects
