# devanshukoli/interviewlab architecture

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

- Interactive diagram: https://gitdiagram.com/devanshukoli/interviewlab
- Repository: https://github.com/devanshukoli/interviewlab

## Overview

#### Purpose and entry points
InterviewOps is a full-stack technical-interview simulator for systems/SRE/architecture candidates. A React/Vite client drives authenticated REST workflows; a TypeScript Express modular monolith runs AI pipelines, persistence, and telemetry. Client boot is `src/main.tsx` and stateful UI routing is `src/App.tsx`; server boot initializes instrumentation before application startup through `server.ts`, `server/index.ts`, and `server/bootstrap.ts`.

#### Client application
The browser client presents the interview lifecycle rather than a generic web shell: create a session, answer questions, inspect evaluations, and review longitudinal progress. `src/components/NewInterviewFlow.tsx` initiates resume/JD-based setup; `src/components/ActiveInterviewSession.tsx` handles active responses; `src/components/EvaluationReportView.tsx` renders results. Authenticated API access and token lifecycle are centralized at `src/lib/auth.ts`.

#### HTTP composition and security boundary
`server/app.ts` configures Express concerns and mounts the master API router in `server/api/index.ts`. Domain modules use route → controller → service layering, notably `server/api/interview/interview.routes.ts`, `server/api/interview/interview.controller.ts`, and `server/api/interview/interview.service.ts`. DTO validation, JWT/user-context enforcement, uploads, rate limits, and global errors form the request boundary in `server/middleware/validation.ts`, `server/middleware/jwt.middleware.ts`, and `server/middleware/upload.ts`. Authentication additionally supports credentials, OAuth-related flows, and TOTP via `server/api/auth/auth.service.ts` and `server/services/totp.ts`.

#### Interview generation pipeline
Session setup transforms a submitted resume plus job description into targeted questions. Orchestration resides in `server/api/interview/interview-pipeline.service.ts` (with corresponding shared service layer at `server/services/interview-pipeline.service.ts`). Specialized agents parse the resume and JD, identify gaps, then synthesize questions: `server/modules/agents/resume-agent.ts`, `server/modules/agents/jd-agent.ts`, `server/modules/agents/gap-agent.ts`, and `server/modules/agents/question-agent.ts`. Pipeline execution is synchronous within the API request lifecycle.

#### Evaluation and coaching pipeline
Candidate answers flow through evaluation and coaching orchestration in `server/api/interview/evaluation-pipeline.service.ts` and `server/services/evaluation-pipeline.service.ts`. `server/modules/agents/evaluation-agent.ts` produces rubric-based answer feedback; `server/modules/agents/coach-agent.ts` turns session outcomes into recommendations and informs progress. Session history and skill metrics are subsequently exposed through `server/api/history/history.service.ts` and `server/api/progress/progress.service.ts`.

#### AI, data, and provider boundaries
Agents depend on a provider-neutral LLM layer at `server/services/llm.ts`, with prompt construction isolated in `server/services/prompt.service.ts`; configured providers are Gemini, OpenAI, and Anthropic. Data access is mediated by `server/db.ts`, using Supabase when configured and an in-memory fallback otherwise. Production relational schema, user-scoped RLS, resume updates, security/2FA, and BYOK support are represented in `sql/01_schema.sql`, `sql/02_rls_policies.sql`, and `sql/06_byok.sql`; Supabase integration begins at `server/services/supabase.ts`.

#### Observability and runtime infrastructure
The Node/Express runtime exports OpenTelemetry spans through setup in `server/observability/instrumentation.ts`, with request/pipeline trace buffering in `server/observability.ts`. Buffered traces are surfaced as an API capability via `server/api/telemetry/telemetry.routes.ts` and `server/api/telemetry/telemetry.service.ts`, while OTLP collectors such as Jaeger, SigNoz, or Datadog are external optional sinks. Deployment expects Node, environment-validated configuration (`server/config.ts`), optional Supabase PostgreSQL, an LLM provider API, and an optional OTLP endpoint.

Main entry points: [`server/api/index.ts`](https://github.com/devanshukoli/interviewlab/blob/main/server/api/index.ts) (Master API router), [`server/db.ts`](https://github.com/devanshukoli/interviewlab/blob/main/server/db.ts) (Data access), [`server/api/interview/interview.service.ts`](https://github.com/devanshukoli/interviewlab/blob/main/server/api/interview/interview.service.ts) (Interview API), [`server/api/interview/evaluation-pipeline.service.ts`](https://github.com/devanshukoli/interviewlab/blob/main/server/api/interview/evaluation-pipeline.service.ts) (Evaluation & coaching pipeline)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser client"]
  node_client_boot["Client boot &amp; routing<br/>React/Vite<br/>[main.tsx]"]
  node_interview_ui["Interview lifecycle UI<br/>React components"]
  node_client_auth["Auth client<br/>token lifecycle<br/>[auth.ts]"]
end

subgraph group_api["Node API"]
  node_runtime_boot["Server bootstrap<br/>Node startup<br/>[server.ts]"]
  node_express_app["Express application<br/>HTTP composition<br/>[app.ts]"]
  node_request_boundary["Request security boundary<br/>middleware<br/>[validation.ts]"]
  node_api_router["Master API router<br/>Express router<br/>[index.ts]"]
  node_interview_api["Interview API<br/>route/controller/service"]
  node_auth_service["Authentication service<br/>auth domain<br/>[auth.service.ts]"]
  node_history_progress["History &amp; progress<br/>read models<br/>[history.service.ts]"]
end

subgraph group_ai["AI pipelines"]
  node_setup_pipeline["Interview setup pipeline<br/>orchestrator"]
  node_setup_agents["Resume/JD/gap agents<br/>specialized agents<br/>[resume-agent.ts]"]
  node_question_agent["Question agent<br/>specialized agent<br/>[question-agent.ts]"]
  node_evaluation_pipeline["Evaluation &amp; coaching pipeline<br/>orchestrator"]
  node_evaluation_agents["Evaluation &amp; coach agents<br/>specialized agents"]
  node_llm_layer{{"Provider-neutral LLM<br/>LLM gateway<br/>[llm.ts]"}}
end

subgraph group_platform["Data &amp; observability"]
  node_data_access["Data access<br/>database adapter<br/>[db.ts]"]
  node_supabase[("Supabase PostgreSQL<br/>external data platform<br/>[supabase.ts]")]
  node_instrumentation["OpenTelemetry setup<br/>instrumentation<br/>[instrumentation.ts]"]
  node_telemetry_api["Telemetry API<br/>trace buffer access"]
  node_otlp_sink{{"OTLP collector<br/>optional external sink"}}
end

node_client_boot -->|"renders"| node_interview_ui
node_interview_ui -->|"uses"| node_client_auth
node_client_auth -->|"authenticated REST"| node_express_app
node_runtime_boot -->|"initializes first"| node_instrumentation
node_runtime_boot -->|"starts"| node_express_app
node_express_app -->|"applies"| node_request_boundary
node_request_boundary -->|"admits requests"| node_api_router
node_api_router -->|"mounts"| node_interview_api
node_api_router -->|"mounts"| node_auth_service
node_api_router -->|"mounts"| node_history_progress
node_api_router -->|"mounts"| node_telemetry_api
node_interview_api -->|"session setup"| node_setup_pipeline
node_interview_api -->|"answer evaluation"| node_evaluation_pipeline
node_setup_pipeline -->|"analyzes inputs"| node_setup_agents
node_setup_agents -->|"supplies gaps"| node_question_agent
node_question_agent -->|"generates via"| node_llm_layer
node_evaluation_pipeline -->|"orchestrates"| node_evaluation_agents
node_evaluation_agents -->|"evaluates via"| node_llm_layer
node_interview_api -->|"persists sessions"| node_data_access
node_evaluation_pipeline -->|"stores outcomes"| node_data_access
node_history_progress -->|"reads metrics"| node_data_access
node_auth_service -->|"manages users"| node_data_access
node_data_access -.->|"when configured"| node_supabase
node_instrumentation -.->|"exports spans"| node_otlp_sink
node_telemetry_api -->|"reads buffered traces"| node_instrumentation

click node_client_boot "https://github.com/devanshukoli/interviewlab/blob/main/src/main.tsx"
click node_interview_ui "https://github.com/devanshukoli/interviewlab/blob/main/src/components/NewInterviewFlow.tsx"
click node_client_auth "https://github.com/devanshukoli/interviewlab/blob/main/src/lib/auth.ts"
click node_runtime_boot "https://github.com/devanshukoli/interviewlab/blob/main/server.ts"
click node_express_app "https://github.com/devanshukoli/interviewlab/blob/main/server/app.ts"
click node_request_boundary "https://github.com/devanshukoli/interviewlab/blob/main/server/middleware/validation.ts"
click node_api_router "https://github.com/devanshukoli/interviewlab/blob/main/server/api/index.ts"
click node_interview_api "https://github.com/devanshukoli/interviewlab/blob/main/server/api/interview/interview.service.ts"
click node_auth_service "https://github.com/devanshukoli/interviewlab/blob/main/server/api/auth/auth.service.ts"
click node_history_progress "https://github.com/devanshukoli/interviewlab/blob/main/server/api/history/history.service.ts"
click node_setup_pipeline "https://github.com/devanshukoli/interviewlab/blob/main/server/api/interview/interview-pipeline.service.ts"
click node_setup_agents "https://github.com/devanshukoli/interviewlab/blob/main/server/modules/agents/resume-agent.ts"
click node_question_agent "https://github.com/devanshukoli/interviewlab/blob/main/server/modules/agents/question-agent.ts"
click node_evaluation_pipeline "https://github.com/devanshukoli/interviewlab/blob/main/server/api/interview/evaluation-pipeline.service.ts"
click node_evaluation_agents "https://github.com/devanshukoli/interviewlab/blob/main/server/modules/agents/evaluation-agent.ts"
click node_llm_layer "https://github.com/devanshukoli/interviewlab/blob/main/server/services/llm.ts"
click node_data_access "https://github.com/devanshukoli/interviewlab/blob/main/server/db.ts"
click node_supabase "https://github.com/devanshukoli/interviewlab/blob/main/server/services/supabase.ts"
click node_instrumentation "https://github.com/devanshukoli/interviewlab/blob/main/server/observability/instrumentation.ts"
click node_telemetry_api "https://github.com/devanshukoli/interviewlab/blob/main/server/api/telemetry/telemetry.routes.ts"

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_boot,node_interview_ui,node_client_auth toneBlue
class node_runtime_boot,node_express_app,node_request_boundary,node_api_router,node_interview_api,node_auth_service,node_history_progress toneAmber
class node_setup_pipeline,node_setup_agents,node_question_agent,node_evaluation_pipeline,node_evaluation_agents,node_llm_layer toneMint
class node_data_access,node_supabase,node_instrumentation,node_telemetry_api,node_otlp_sink toneRose
```

## Components

### Browser client

- [Client boot & routing](https://github.com/devanshukoli/interviewlab/blob/main/src/main.tsx): React/Vite · `src/main.tsx`
- [Interview lifecycle UI](https://github.com/devanshukoli/interviewlab/blob/main/src/components/NewInterviewFlow.tsx): React components · Creates sessions, captures answers, and displays reports. · `src/components/NewInterviewFlow.tsx`
- [Auth client](https://github.com/devanshukoli/interviewlab/blob/main/src/lib/auth.ts): token lifecycle · `src/lib/auth.ts`

### Node API

- [Server bootstrap](https://github.com/devanshukoli/interviewlab/blob/main/server.ts): Node startup · Initializes instrumentation before the application. · `server.ts`
- [Express application](https://github.com/devanshukoli/interviewlab/blob/main/server/app.ts): HTTP composition · `server/app.ts`
- [Request security boundary](https://github.com/devanshukoli/interviewlab/blob/main/server/middleware/validation.ts): middleware · Validates DTOs and applies JWT context, uploads, limits, and error handling. · `server/middleware/validation.ts`
- [Master API router](https://github.com/devanshukoli/interviewlab/blob/main/server/api/index.ts): Express router · `server/api/index.ts`
- [Interview API](https://github.com/devanshukoli/interviewlab/blob/main/server/api/interview/interview.service.ts): route/controller/service · `server/api/interview/interview.service.ts`
- [Authentication service](https://github.com/devanshukoli/interviewlab/blob/main/server/api/auth/auth.service.ts): auth domain · Supports credentials, OAuth-related flows, and TOTP. · `server/api/auth/auth.service.ts`
- [History & progress](https://github.com/devanshukoli/interviewlab/blob/main/server/api/history/history.service.ts): read models · Exposes session history and skill metrics. · `server/api/history/history.service.ts`

### AI pipelines

- [Interview setup pipeline](https://github.com/devanshukoli/interviewlab/blob/main/server/api/interview/interview-pipeline.service.ts): orchestrator · Synchronously turns resume and job description into a targeted session. · `server/api/interview/interview-pipeline.service.ts`
- [Resume/JD/gap agents](https://github.com/devanshukoli/interviewlab/blob/main/server/modules/agents/resume-agent.ts): specialized agents · `server/modules/agents/resume-agent.ts`
- [Question agent](https://github.com/devanshukoli/interviewlab/blob/main/server/modules/agents/question-agent.ts): specialized agent · `server/modules/agents/question-agent.ts`
- [Evaluation & coaching pipeline](https://github.com/devanshukoli/interviewlab/blob/main/server/api/interview/evaluation-pipeline.service.ts): orchestrator · `server/api/interview/evaluation-pipeline.service.ts`
- [Evaluation & coach agents](https://github.com/devanshukoli/interviewlab/blob/main/server/modules/agents/evaluation-agent.ts): specialized agents · Produces rubric feedback and session recommendations. · `server/modules/agents/evaluation-agent.ts`
- [Provider-neutral LLM](https://github.com/devanshukoli/interviewlab/blob/main/server/services/llm.ts): LLM gateway · Uses isolated prompt construction and configured model providers. · `server/services/llm.ts`

### Data & observability

- [Data access](https://github.com/devanshukoli/interviewlab/blob/main/server/db.ts): database adapter · Uses Supabase when configured, otherwise an in-memory fallback. · `server/db.ts`
- [Supabase PostgreSQL](https://github.com/devanshukoli/interviewlab/blob/main/server/services/supabase.ts): external data platform · Production persistence with user-scoped RLS and BYOK schema support. · `server/services/supabase.ts`
- [OpenTelemetry setup](https://github.com/devanshukoli/interviewlab/blob/main/server/observability/instrumentation.ts): instrumentation · `server/observability/instrumentation.ts`
- [Telemetry API](https://github.com/devanshukoli/interviewlab/blob/main/server/api/telemetry/telemetry.routes.ts): trace buffer access · Surfaces buffered request and pipeline traces. · `server/api/telemetry/telemetry.routes.ts`
- **OTLP collector**: optional external sink · Jaeger, SigNoz, or Datadog.

## Connections

- Client boot & routing → Interview lifecycle UI: renders
- Interview lifecycle UI → Auth client: uses
- Auth client → Express application: authenticated REST
- Server bootstrap → OpenTelemetry setup: initializes first
- Server bootstrap → Express application: starts
- Express application → Request security boundary: applies
- Request security boundary → Master API router: admits requests
- Master API router → Interview API: mounts
- Master API router → Authentication service: mounts
- Master API router → History & progress: mounts
- Master API router → Telemetry API: mounts
- Interview API → Interview setup pipeline: session setup
- Interview API → Evaluation & coaching pipeline: answer evaluation
- Interview setup pipeline → Resume/JD/gap agents: analyzes inputs
- Resume/JD/gap agents → Question agent: supplies gaps
- Question agent → Provider-neutral LLM: generates via
- Evaluation & coaching pipeline → Evaluation & coach agents: orchestrates
- Evaluation & coach agents → Provider-neutral LLM: evaluates via
- Interview API → Data access: persists sessions
- Evaluation & coaching pipeline → Data access: stores outcomes
- History & progress → Data access: reads metrics
- Authentication service → Data access: manages users
- Data access → Supabase PostgreSQL: when configured
- OpenTelemetry setup → OTLP collector: exports spans
- Telemetry API → OpenTelemetry setup: reads buffered traces
