# sadique-mohammed/rizz-interviews architecture

> Architecture diagram of the GitHub repository sadique-mohammed/rizz-interviews, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sadique-mohammed/rizz-interviews
- Repository: https://github.com/sadique-mohammed/rizz-interviews

## Overview

#### Purpose and runtime
This is a Next.js App Router application for AI-assisted interview practice. It combines public role-selection/landing pages, authenticated interview sessions, dashboard/history views, and server-side APIs for interview orchestration. The primary runtime is Next.js/React with TypeScript; deployment is Vercel-compatible per the README.

Key roots: `src/app/layout.tsx`, `src/app/page.tsx`, `next.config.ts`.

#### User-facing entry points and access boundary
The public landing page leads users into practice flows, while authenticated/main-area routes expose dashboard and history. A catch-all auth route and application middleware establish the authentication boundary; a demo-login endpoint supports non-production/demo access.

Paths: `src/app/practice/[role]/page.tsx`, `src/app/(main)/dashboard/page.tsx`, `src/app/auth/[[...rest]]/page.tsx`, `src/middleware.ts`, `src/app/api/demo-login/route.ts`.

#### Interview session lifecycle
Interview sessions are initiated through the interviews API and rendered at a session-specific route. The frontend interview canvas/drawer drives an interactive workflow backed by granular server endpoints: fetch the next question, submit answers, chat, save a draft, complete, or abandon the session.

Paths: `src/app/api/interviews/route.ts`, `src/app/api/interviews/[sessionId]/next-question/route.ts`, `src/app/api/interviews/[sessionId]/answers/route.ts`, `src/app/api/interviews/[sessionId]/complete/route.ts`, `src/app/interview/[sessionId]/page.tsx`, `src/components/interview/interview-canvas.tsx`.

#### AI orchestration and evaluation
Server-side AI modules encapsulate provider configuration, provider clients, interview chat generation, answer evaluation, input validation, and fallback/mock behavior. Interview API routes should be the control boundary between clients and these AI services, keeping model/provider concerns out of UI components.

Paths: `src/lib/ai/config.ts`, `src/lib/ai/gemini.ts`, `src/lib/ai/groq.ts`, `src/lib/ai/interview-chat.ts`, `src/lib/ai/evaluate-answer.ts`, `src/lib/ai/mock.ts`.

#### Persistence, transient state, and scoring
Drizzle-backed database code defines durable application entities, likely including users and interview history. Redis-specific modules manage interview/session state separately from durable records. Scoring and streak logic transform completed-session results into dashboard/history-facing aggregates.

Paths: `src/db/index.ts`, `src/db/schema.ts`, `drizzle.config.ts`, `src/lib/redis.ts`, `src/lib/interview-redis.ts`, `src/lib/scoring.ts`, `src/lib/streak.ts`.

#### Dashboard and history read models
The dashboard API supplies active/recent/streak-oriented data to the main dashboard. History has collection and detail APIs/pages, separating list retrieval from an individual interview record. These views are likely consumers of completed durable sessions rather than direct AI providers.

Paths: `src/app/api/dashboard/route.ts`, `src/app/api/history/route.ts`, `src/app/api/history/[id]/route.ts`, `src/app/(main)/history/page.tsx`, `src/app/(main)/history/[id]/page.tsx`.

#### Content, SEO, and external integration
Role metadata is local JSON and feeds role-specific practice pages and SEO generation. The webhook endpoint is the explicit inbound external-service boundary. Environment-driven configuration is expected for AI, database, Redis, auth, and webhook dependencies.

Paths: `src/data/seo-roles.json`, `src/app/robots.ts`, `src/app/sitemap.ts`, `src/app/api/webhooks/route.ts`, `.env.sample`.

Main entry points: [`src/app/api/interviews/route.ts`](https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/app/api/interviews/route.ts) (Interview lifecycle API), [`src/db/index.ts`](https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/db/index.ts) (Durable interview data), [`src/app/practice/[role]/page.tsx`](https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/app/practice/%5Brole%5D/page.tsx) (Role practice page), [`src/app/api/dashboard/route.ts`](https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/app/api/dashboard/route.ts) (Dashboard API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Web UI"]
  node_landing["Landing page<br/>Next.js page<br/>[page.tsx]"]
  node_practice["Role practice page<br/>Next.js page<br/>[page.tsx]"]
  node_auth["Auth route<br/>Next.js page<br/>[page.tsx]"]
  node_middleware{{"Auth middleware<br/>Next.js middleware<br/>[middleware.ts]"}}
  node_interview_page["Interview session page<br/>Next.js page<br/>[page.tsx]"]
  node_interview_canvas["Interview canvas<br/>React component"]
  node_dashboard_page["Dashboard<br/>Next.js page<br/>[page.tsx]"]
  node_history_page["History views<br/>Next.js pages<br/>[page.tsx]"]
end

subgraph group_api["Server APIs"]
  node_interviews_api["Interview lifecycle API<br/>Route handlers<br/>[route.ts]"]
  node_dashboard_api["Dashboard API<br/>Route handler<br/>[route.ts]"]
  node_history_api["History API<br/>Route handlers<br/>[route.ts]"]
  node_demo_login["Demo login API<br/>Route handler<br/>[route.ts]"]
  node_webhook{{"Webhook API<br/>Route handler<br/>[route.ts]"}}
end

subgraph group_services["Interview Services"]
  node_ai_orchestration["AI interview orchestration<br/>AI service<br/>[interview-chat.ts]"]
  node_ai_providers["AI providers<br/>Provider clients<br/>[gemini.ts]"]
  node_session_state[("Interview session state<br/>Redis service<br/>[interview-redis.ts]")]
  node_scoring["Scoring &amp; streaks<br/>Domain service<br/>[scoring.ts]"]
end

subgraph group_data["Data &amp; Content"]
  node_database[("Durable interview data<br/>Drizzle database<br/>[index.ts]")]
  node_role_content["Role SEO content<br/>JSON content<br/>[seo-roles.json]"]
  node_seo["SEO routes<br/>Next.js metadata routes<br/>[robots.ts]"]
end

node_landing -->|"starts practice"| node_practice
node_practice -->|"loads role metadata"| node_role_content
node_practice -->|"creates session"| node_interviews_api
node_middleware -.->|"routes unauthenticated users"| node_auth
node_demo_login -.->|"supports demo access"| node_auth
node_interview_page -->|"renders"| node_interview_canvas
node_interview_canvas -->|"questions, answers, chat, completion"| node_interviews_api
node_interviews_api -->|"orchestrates interview"| node_ai_orchestration
node_ai_orchestration -->|"uses models and fallback"| node_ai_providers
node_interviews_api -->|"reads and updates state"| node_session_state
node_interviews_api -->|"persists sessions"| node_database
node_interviews_api -->|"scores completion"| node_scoring
node_scoring -->|"stores results"| node_database
node_dashboard_page -->|"loads aggregates"| node_dashboard_api
node_dashboard_api -->|"reads active and recent data"| node_database
node_dashboard_api -->|"uses streak aggregates"| node_scoring
node_history_page -->|"loads list and detail"| node_history_api
node_history_api -->|"reads completed sessions"| node_database
node_seo -->|"indexes role pages"| node_role_content

click node_landing "https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/app/page.tsx"
click node_practice "https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/app/practice/%5Brole%5D/page.tsx"
click node_auth "https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/app/auth/%5B%5B...rest%5D%5D/page.tsx"
click node_middleware "https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/middleware.ts"
click node_interview_page "https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/app/interview/%5BsessionId%5D/page.tsx"
click node_interview_canvas "https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/components/interview/interview-canvas.tsx"
click node_dashboard_page "https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/app/(main)/dashboard/page.tsx"
click node_history_page "https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/app/(main)/history/page.tsx"
click node_interviews_api "https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/app/api/interviews/route.ts"
click node_dashboard_api "https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/app/api/dashboard/route.ts"
click node_history_api "https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/app/api/history/route.ts"
click node_demo_login "https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/app/api/demo-login/route.ts"
click node_webhook "https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/app/api/webhooks/route.ts"
click node_ai_orchestration "https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/lib/ai/interview-chat.ts"
click node_ai_providers "https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/lib/ai/gemini.ts"
click node_session_state "https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/lib/interview-redis.ts"
click node_scoring "https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/lib/scoring.ts"
click node_database "https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/db/index.ts"
click node_role_content "https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/data/seo-roles.json"
click node_seo "https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/app/robots.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_landing,node_practice,node_auth,node_middleware,node_interview_page,node_interview_canvas,node_dashboard_page,node_history_page toneBlue
class node_interviews_api,node_dashboard_api,node_history_api,node_demo_login,node_webhook toneAmber
class node_ai_orchestration,node_ai_providers,node_session_state,node_scoring toneMint
class node_database,node_role_content,node_seo toneRose
```

## Components

### Web UI

- [Landing page](https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/app/page.tsx): Next.js page · Public entry into practice flows. · `src/app/page.tsx`
- [Role practice page](https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/app/practice/%5Brole%5D/page.tsx): Next.js page · `src/app/practice/[role]/page.tsx`
- [Auth route](https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/app/auth/%5B%5B...rest%5D%5D/page.tsx): Next.js page · `src/app/auth/[[...rest]]/page.tsx`
- [Auth middleware](https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/middleware.ts): Next.js middleware · Protects application routes. · `src/middleware.ts`
- [Interview session page](https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/app/interview/%5BsessionId%5D/page.tsx): Next.js page · `src/app/interview/[sessionId]/page.tsx`
- [Interview canvas](https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/components/interview/interview-canvas.tsx): React component · Interactive question, answer, and chat workflow. · `src/components/interview/interview-canvas.tsx`
- [Dashboard](https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/app/(main)/dashboard/page.tsx): Next.js page · `src/app/(main)/dashboard/page.tsx`
- [History views](https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/app/(main)/history/page.tsx): Next.js pages · Interview list and record detail views. · `src/app/(main)/history/page.tsx`

### Server APIs

- [Interview lifecycle API](https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/app/api/interviews/route.ts): Route handlers · Creates sessions and handles questions, answers, completion, and session actions. · `src/app/api/interviews/route.ts`
- [Dashboard API](https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/app/api/dashboard/route.ts): Route handler · `src/app/api/dashboard/route.ts`
- [History API](https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/app/api/history/route.ts): Route handlers · Serves history collections and interview details. · `src/app/api/history/route.ts`
- [Demo login API](https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/app/api/demo-login/route.ts): Route handler · `src/app/api/demo-login/route.ts`
- [Webhook API](https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/app/api/webhooks/route.ts): Route handler · Inbound external-service boundary. · `src/app/api/webhooks/route.ts`

### Interview Services

- [AI interview orchestration](https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/lib/ai/interview-chat.ts): AI service · Generates interview chat and evaluates submitted answers. · `src/lib/ai/interview-chat.ts`
- [AI providers](https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/lib/ai/gemini.ts): Provider clients · Gemini, Groq, configuration, and mock fallback. · `src/lib/ai/gemini.ts`
- [Interview session state](https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/lib/interview-redis.ts): Redis service · Transient interview and session state. · `src/lib/interview-redis.ts`
- [Scoring & streaks](https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/lib/scoring.ts): Domain service · Transforms completed results into dashboard aggregates. · `src/lib/scoring.ts`

### Data & Content

- [Durable interview data](https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/db/index.ts): Drizzle database · Users, sessions, history, and durable records. · `src/db/index.ts`
- [Role SEO content](https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/data/seo-roles.json): JSON content · Role metadata for practice pages and SEO. · `src/data/seo-roles.json`
- [SEO routes](https://github.com/sadique-mohammed/rizz-interviews/blob/main/src/app/robots.ts): Next.js metadata routes · Robots and sitemap generation. · `src/app/robots.ts`

## Connections

- Landing page → Role practice page: starts practice
- Role practice page → Role SEO content: loads role metadata
- Role practice page → Interview lifecycle API: creates session
- Auth middleware → Auth route: routes unauthenticated users
- Demo login API → Auth route: supports demo access
- Interview session page → Interview canvas: renders
- Interview canvas → Interview lifecycle API: questions, answers, chat, completion
- Interview lifecycle API → AI interview orchestration: orchestrates interview
- AI interview orchestration → AI providers: uses models and fallback
- Interview lifecycle API → Interview session state: reads and updates state
- Interview lifecycle API → Durable interview data: persists sessions
- Interview lifecycle API → Scoring & streaks: scores completion
- Scoring & streaks → Durable interview data: stores results
- Dashboard → Dashboard API: loads aggregates
- Dashboard API → Durable interview data: reads active and recent data
- Dashboard API → Scoring & streaks: uses streak aggregates
- History views → History API: loads list and detail
- History API → Durable interview data: reads completed sessions
- SEO routes → Role SEO content: indexes role pages
