How jaskaran5109/ai-proctored-interview works
Purpose and Entry Points
This is a full-stack AI-proctored interview platform for candidate interviews, recruiter/session management, coding assessment, proctoring signals, and AI-assisted evaluation. The backend starts through backend/src/server.js, assembles Express application concerns in backend/src/app.js, and exposes APIs from backend/src/routes/index.js. The React frontend boots at frontend/src/index.tsx and selects application views in frontend/src/App.tsx.
Backend HTTP and Security Boundary
Express routes dispatch to domain controllers for authentication, interview/session operations, AI, and code execution: backend/src/controllers/auth.controller.js, backend/src/controllers/session.controller.js, and backend/src/controllers/code.controller.js. Authentication middleware protects applicable endpoints using JWT utilities, while rate limiting and centralized error translation form the request boundary: backend/src/middleware/auth.middleware.js, backend/src/middleware/rateLimit.middleware.js, backend/src/middleware/error.middleware.js.
Persistence and Domain Model
Database initialization is isolated in backend/src/config/db.js; model registration/relationships are centralized in backend/src/models/index.js. Controllers should use this model layer rather than directly coupling frontend workflows to storage. Seed support in backend/src/utils/seed.js indicates environment/bootstrap data may be required for usable interview flows.
Interview Orchestration
The interview lifecycle is coordinated as a service rather than embedded solely in controllers, with backend/src/services/interview-flow.service.js representing the primary workflow boundary. Session endpoints/controllers expose this lifecycle to clients through backend/src/controllers/session.controller.js. Live updates are likely supported through the socket utility, backend/src/utils/socket.js, separating real-time event wiring from REST request handling.
AI and Evaluation Integration
AI responsibilities are layered: backend/src/controllers/ai.controller.js accepts API-level requests, backend/src/services/ai.service.js implements application AI behavior, and backend/src/ai/ollama.client.js integrates with an Ollama runtime/service. This isolates prompts/model invocation from interview orchestration and enables AI assistance or evaluation without exposing the model provider directly to the frontend.
Code Assessment Execution
Code submission validation and execution are distinct from general interview orchestration: backend/src/validators/code.validator.js, backend/src/controllers/code.controller.js, and backend/src/services/code-execution.service.js. This is a material trust boundary because candidate-supplied code requires constrained execution infrastructure, even though the specific sandbox/runtime implementation is not represented in the tree.
Frontend Application Flows
The frontend uses page-level routes/views for authentication, dashboards, interview rooms, session details, and results: frontend/src/pages/AuthPage.tsx, frontend/src/pages/InterviewPage.tsx, and frontend/src/pages/ResultPage.tsx. API access is centralized through service modules such as frontend/src/services/http.ts, frontend/src/services/interview.ts, and frontend/src/services/sessions.ts, keeping UI components from owning transport details.
Client State and Interview Experience
Authentication bootstrap and persistent auth state are handled by frontend/src/hooks/useAuthBootstrap.ts and frontend/src/store/authStore.ts. Interview-specific monitoring and state are separated into frontend/src/hooks/useInterviewMonitor.ts and frontend/src/stores/interviewStore.js. The candidate/recruiter experience is composed from focused modules: live coding in frontend/src/components/interview/LiveCodingWorkspace.tsx, AI interaction in frontend/src/components/interview/AssistantPanel.tsx, and interview/session creation in frontend/src/components/dashboard/CreateInterviewWizard.tsx.
Main entry points: InterviewPage.tsx Interview room · index.js API routes · index.tsx Client bootstrap & views · interview-flow.service.js Interview lifecycle
Components 24
React Client
- Client bootstrap & views · Boots the app and selects page-level views.
frontend/src/index.tsx - Auth bootstrap & state
frontend/src/hooks/useAuthBootstrap.ts - HTTP & interview APIs · Centralizes frontend transport and interview/session calls.
frontend/src/services/http.ts - Interview monitoring
frontend/src/hooks/useInterviewMonitor.ts - Interview state
frontend/src/stores/interviewStore.js - Interview room · Composes the candidate live-interview experience.
frontend/src/pages/InterviewPage.tsx - Live coding workspace
frontend/src/components/interview/LiveCodingWorkspace.tsx - AI assistant panel
frontend/src/components/interview/AssistantPanel.tsx - Create interview wizard
frontend/src/components/dashboard/CreateInterviewWizard.tsx
Backend API
- Server entry
backend/src/server.js - Express application · Assembles API concerns and middleware.
backend/src/app.js - API routes
backend/src/routes/index.js - Auth, limits & errors · JWT protection, rate limiting, and centralized error translation.
backend/src/middleware/auth.middleware.js - Session controller
backend/src/controllers/session.controller.js - Interview lifecycle · Coordinates interview workflow beyond HTTP controllers.
backend/src/services/interview-flow.service.js - AI controller
backend/src/controllers/ai.controller.js - AI evaluation service
backend/src/services/ai.service.js - Code controller & validation · Validates candidate code before execution.
backend/src/controllers/code.controller.js - Code execution service · Trust boundary for candidate-supplied code.
backend/src/services/code-execution.service.js - Domain models · Registers persistence models and relationships.
backend/src/models/index.js
Runtime Integrations
- Application database
backend/src/config/db.js - Live socket events
backend/src/utils/socket.js - Ollama runtime · Model invocation is isolated behind a client.
backend/src/ai/ollama.client.js - Constrained execution runtime · Underlying sandbox implementation is not represented.
Connections 24
- Client bootstrap & views → Auth bootstrap & state: initializes
- Client bootstrap & views → Interview room: renders
- Client bootstrap & views → Create interview wizard: renders
- Interview room → Interview monitoring: uses
- Interview monitoring → Interview state: updates
- Interview room → Live coding workspace: composes
- Interview room → AI assistant panel: composes
- Auth bootstrap & state → HTTP & interview APIs: authenticates requests
- Interview state → HTTP & interview APIs: uses
- HTTP & interview APIs → Server entry: HTTPS API
- Server entry → Express application: starts
- Express application → Auth, limits & errors: applies
- Auth, limits & errors → API routes: protects
- API routes → Session controller: session endpoints
- API routes → AI controller: AI endpoints
- API routes → Code controller & validation: code endpoints
- Session controller → Interview lifecycle: drives
- Interview lifecycle → Domain models: persists lifecycle
- Domain models → Application database: reads and writes
- Interview lifecycle → Live socket events: publishes live updates
- AI controller → AI evaluation service: delegates
- AI evaluation service → Ollama runtime: invokes models
- Code controller & validation → Code execution service: submits validated code
- Code execution service → Constrained execution runtime: executes under constraints