How ankurdotio/interview-ai-yt works
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: app.routes.jsx Client routes · Protected.jsx Protected route gate · app.js Express app · interview.controller.js Interview controller
Components 21
React client
Vite single-page application.
- Vite runtime
Frontend/vite.config.js - Client entry
Frontend/src/main.jsx - App shell
Frontend/src/App.jsx - Client routes · Separates public authentication and interview views.
Frontend/src/app.routes.jsx - Protected route gate · Enforces client-side authenticated navigation.
Frontend/src/features/auth/components/Protected.jsx - Auth state and API · Central authentication state and request layer.
Frontend/src/features/auth/auth.context.jsx - Login and register
Frontend/src/features/auth/pages/Login.jsx - Interview state and API · Feature state and backend request layer.
Frontend/src/features/interview/interview.context.jsx - Interview views
Frontend/src/features/interview/pages/Interview.jsx
Express API
Node.js HTTP application and workflow orchestration.
- Server entry
Backend/server.js - Express app
Backend/src/app.js - Auth routes and controller · Handles authentication requests and token lifecycle.
Backend/src/routes/auth.routes.js - API auth middleware · Authenticates protected interview requests.
Backend/src/middlewares/auth.middleware.js - Interview routes
Backend/src/routes/interview.routes.js - File ingestion middleware
Backend/src/middlewares/file.middleware.js - Interview controller · Coordinates uploads, AI processing, and report persistence.
Backend/src/controllers/interview.controller.js - AI service · Isolates external AI-provider interactions.
Backend/src/services/ai.service.js
Infrastructure
Persisted data and external AI capability.
- Database connection
Backend/src/config/database.js - Users and token blacklist · Stores users and revoked authentication artifacts.
Backend/src/models/user.model.js - Interview reports
Backend/src/models/interviewReport.model.js - External AI provider
Connections 23
- 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