# saadferozee/nexthire architecture

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

- Interactive diagram: https://gitdiagram.com/saadferozee/nexthire
- Repository: https://github.com/saadferozee/nexthire

## Overview

NextHire is an AI interview-preparation and job-search platform. Users enter through account and dashboard screens, then use resume scoring, job-description keyword analysis, interview practice, and application tracking; saved scores and sessions support history and analytics. The API routes implement the sampled AI and persistence flows, while Stripe handles subscription checkout and webhook updates. README capabilities and route names support the broader feature map, but UI-to-API wiring is not shown in the sampled source, so those connections are omitted.

Main entry points: [`lib/mongodb.ts`](https://github.com/saadferozee/nexthire/blob/main/lib/mongodb.ts) (MongoDB), [`app/api/stripe/checkout/route.ts`](https://github.com/saadferozee/nexthire/blob/main/app/api/stripe/checkout/route.ts) (Subscription checkout), [`app/api/resume-score/route.ts`](https://github.com/saadferozee/nexthire/blob/main/app/api/resume-score/route.ts) (Resume scoring), [`app/api/keyword-gap-analysis/route.ts`](https://github.com/saadferozee/nexthire/blob/main/app/api/keyword-gap-analysis/route.ts) (Keyword gap analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_auth["Sign in / sign up<br/>[page.tsx]"]
  node_dashboard["Dashboard<br/>[page.tsx]"]
  node_resumeui["Resume scorer<br/>[page.tsx]"]
  node_keywordui["Keyword analysis<br/>[page.tsx]"]
  node_interviewui["Mock interview<br/>[page.tsx]"]
  node_videoui["Video interview<br/>[page.tsx]"]
  node_trackerui["Application tracker<br/>[page.tsx]"]
end

subgraph group_career["Career preparation"]
  node_resumeapi["Resume scoring<br/>[route.ts]"]
  node_keywordapi["Keyword gap analysis<br/>[route.ts]"]
  node_mockapi["Mock interview API<br/>[route.ts]"]
  node_videoapi["Video interview API<br/>[route.ts]"]
  node_practiceapi["Practice questions<br/>[route.ts]"]
  node_transcribeapi["Speech transcription<br/>[route.ts]"]
  node_chatapi["Streaming chat<br/>[route.ts]"]
end

subgraph group_platform["Platform APIs"]
  node_historyapi["History and analytics<br/>[route.ts]"]
  node_trackerapi["Application records<br/>[route.ts]"]
  node_usersapi["User profile API<br/>[route.ts]"]
  node_checkout["Subscription checkout<br/>[route.ts]"]
  node_webhook["Subscription updates<br/>[route.ts]"]
end

subgraph group_state["Persistent state"]
  node_mongo[("MongoDB<br/>[mongodb.ts]")]
end

subgraph group_integrations["External services"]
  node_firebase["Firebase Auth<br/>[config.js]"]
  node_firebaseadmin["Firebase Admin<br/>[firebase-admin.ts]"]
  node_ai{{"AI model services"}}
  node_stripe["Stripe<br/>[stripe.ts]"]
end

node_jobseeker(("Job seeker"))

node_jobseeker -->|"signs in"| node_auth
node_jobseeker -->|"uses"| node_dashboard
node_jobseeker -->|"requests scoring"| node_resumeui
node_jobseeker -->|"compares resume"| node_keywordui
node_jobseeker -->|"practices"| node_interviewui
node_jobseeker -->|"practices aloud"| node_videoui
node_jobseeker -->|"tracks applications"| node_trackerui
node_resumeapi -->|"analyzes resume"| node_ai
node_resumeapi -->|"saves score"| node_mongo
node_keywordapi -->|"analyzes match"| node_ai
node_keywordapi -->|"saves analysis"| node_mongo
node_mockapi -->|"generates and evaluates"| node_ai
node_mockapi -->|"saves session"| node_mongo
node_videoapi -->|"generates and evaluates"| node_ai
node_videoapi -->|"saves session"| node_mongo
node_chatapi -->|"streams completion"| node_ai
node_historyapi -->|"reads scores"| node_mongo
node_trackerapi -->|"reads and writes"| node_mongo
node_usersapi -->|"reads and writes"| node_mongo
node_checkout -->|"verifies token"| node_firebaseadmin
node_checkout -->|"reads and updates user"| node_mongo
node_checkout -->|"creates checkout"| node_stripe
node_webhook -->|"verifies and retrieves"| node_stripe
node_webhook -->|"updates subscription"| node_mongo

click node_auth "https://github.com/saadferozee/nexthire/blob/main/app/(auth)/sign-in/page.tsx"
click node_dashboard "https://github.com/saadferozee/nexthire/blob/main/app/(dashboard)/dashboard/page.tsx"
click node_resumeui "https://github.com/saadferozee/nexthire/blob/main/app/(dashboard)/dashboard/resume-scorer/page.tsx"
click node_keywordui "https://github.com/saadferozee/nexthire/blob/main/app/(dashboard)/dashboard/keyword-gap-analysis/page.tsx"
click node_interviewui "https://github.com/saadferozee/nexthire/blob/main/app/(dashboard)/dashboard/mock-interview/page.tsx"
click node_videoui "https://github.com/saadferozee/nexthire/blob/main/app/(dashboard)/dashboard/video-interaction/page.tsx"
click node_trackerui "https://github.com/saadferozee/nexthire/blob/main/app/(dashboard)/dashboard/tracker/page.tsx"
click node_resumeapi "https://github.com/saadferozee/nexthire/blob/main/app/api/resume-score/route.ts"
click node_keywordapi "https://github.com/saadferozee/nexthire/blob/main/app/api/keyword-gap-analysis/route.ts"
click node_mockapi "https://github.com/saadferozee/nexthire/blob/main/app/api/mock-interview/route.ts"
click node_videoapi "https://github.com/saadferozee/nexthire/blob/main/app/api/video-interview/route.ts"
click node_practiceapi "https://github.com/saadferozee/nexthire/blob/main/app/api/practice_question/route.ts"
click node_transcribeapi "https://github.com/saadferozee/nexthire/blob/main/app/api/transcribe/route.ts"
click node_chatapi "https://github.com/saadferozee/nexthire/blob/main/app/api/chat/route.ts"
click node_historyapi "https://github.com/saadferozee/nexthire/blob/main/app/api/resume-history/route.ts"
click node_trackerapi "https://github.com/saadferozee/nexthire/blob/main/app/api/applications/route.ts"
click node_usersapi "https://github.com/saadferozee/nexthire/blob/main/app/api/users/route.ts"
click node_checkout "https://github.com/saadferozee/nexthire/blob/main/app/api/stripe/checkout/route.ts"
click node_webhook "https://github.com/saadferozee/nexthire/blob/main/app/api/stripe/webhook/route.ts"
click node_mongo "https://github.com/saadferozee/nexthire/blob/main/lib/mongodb.ts"
click node_firebase "https://github.com/saadferozee/nexthire/blob/main/app/firebase/config.js"
click node_firebaseadmin "https://github.com/saadferozee/nexthire/blob/main/lib/firebase-admin.ts"
click node_stripe "https://github.com/saadferozee/nexthire/blob/main/lib/stripe.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_auth,node_dashboard,node_resumeui,node_keywordui,node_interviewui,node_videoui,node_trackerui toneBlue
class node_resumeapi,node_keywordapi,node_mockapi,node_videoapi,node_practiceapi,node_transcribeapi,node_chatapi toneAmber
class node_historyapi,node_trackerapi,node_usersapi,node_checkout,node_webhook toneMint
class node_mongo toneRose
class node_firebase,node_firebaseadmin,node_ai,node_stripe,node_jobseeker toneIndigo
```

## Components

### User experience

- [Sign in / sign up](https://github.com/saadferozee/nexthire/blob/main/app/(auth)/sign-in/page.tsx): `app/(auth)/sign-in/page.tsx`
- [Dashboard](https://github.com/saadferozee/nexthire/blob/main/app/(dashboard)/dashboard/page.tsx): `app/(dashboard)/dashboard/page.tsx`
- [Resume scorer](https://github.com/saadferozee/nexthire/blob/main/app/(dashboard)/dashboard/resume-scorer/page.tsx): `app/(dashboard)/dashboard/resume-scorer/page.tsx`
- [Keyword analysis](https://github.com/saadferozee/nexthire/blob/main/app/(dashboard)/dashboard/keyword-gap-analysis/page.tsx): `app/(dashboard)/dashboard/keyword-gap-analysis/page.tsx`
- [Mock interview](https://github.com/saadferozee/nexthire/blob/main/app/(dashboard)/dashboard/mock-interview/page.tsx): `app/(dashboard)/dashboard/mock-interview/page.tsx`
- [Video interview](https://github.com/saadferozee/nexthire/blob/main/app/(dashboard)/dashboard/video-interaction/page.tsx): `app/(dashboard)/dashboard/video-interaction/page.tsx`
- [Application tracker](https://github.com/saadferozee/nexthire/blob/main/app/(dashboard)/dashboard/tracker/page.tsx): `app/(dashboard)/dashboard/tracker/page.tsx`

### Career preparation

- [Resume scoring](https://github.com/saadferozee/nexthire/blob/main/app/api/resume-score/route.ts): `app/api/resume-score/route.ts`
- [Keyword gap analysis](https://github.com/saadferozee/nexthire/blob/main/app/api/keyword-gap-analysis/route.ts): `app/api/keyword-gap-analysis/route.ts`
- [Mock interview API](https://github.com/saadferozee/nexthire/blob/main/app/api/mock-interview/route.ts): `app/api/mock-interview/route.ts`
- [Video interview API](https://github.com/saadferozee/nexthire/blob/main/app/api/video-interview/route.ts): `app/api/video-interview/route.ts`
- [Practice questions](https://github.com/saadferozee/nexthire/blob/main/app/api/practice_question/route.ts): `app/api/practice_question/route.ts`
- [Speech transcription](https://github.com/saadferozee/nexthire/blob/main/app/api/transcribe/route.ts): `app/api/transcribe/route.ts`
- [Streaming chat](https://github.com/saadferozee/nexthire/blob/main/app/api/chat/route.ts): `app/api/chat/route.ts`

### Platform APIs

- [History and analytics](https://github.com/saadferozee/nexthire/blob/main/app/api/resume-history/route.ts): `app/api/resume-history/route.ts`
- [Application records](https://github.com/saadferozee/nexthire/blob/main/app/api/applications/route.ts): `app/api/applications/route.ts`
- [User profile API](https://github.com/saadferozee/nexthire/blob/main/app/api/users/route.ts): `app/api/users/route.ts`
- [Subscription checkout](https://github.com/saadferozee/nexthire/blob/main/app/api/stripe/checkout/route.ts): `app/api/stripe/checkout/route.ts`
- [Subscription updates](https://github.com/saadferozee/nexthire/blob/main/app/api/stripe/webhook/route.ts): `app/api/stripe/webhook/route.ts`

### Persistent state

- [MongoDB](https://github.com/saadferozee/nexthire/blob/main/lib/mongodb.ts): `lib/mongodb.ts`

### External services

- [Firebase Auth](https://github.com/saadferozee/nexthire/blob/main/app/firebase/config.js): `app/firebase/config.js`
- [Firebase Admin](https://github.com/saadferozee/nexthire/blob/main/lib/firebase-admin.ts): `lib/firebase-admin.ts`
- **AI model services**
- [Stripe](https://github.com/saadferozee/nexthire/blob/main/lib/stripe.ts): `lib/stripe.ts`

### Other components

- **Job seeker**

## Connections

- Job seeker → Sign in / sign up: signs in
- Job seeker → Dashboard: uses
- Job seeker → Resume scorer: requests scoring
- Job seeker → Keyword analysis: compares resume
- Job seeker → Mock interview: practices
- Job seeker → Video interview: practices aloud
- Job seeker → Application tracker: tracks applications
- Resume scoring → AI model services: analyzes resume
- Resume scoring → MongoDB: saves score
- Keyword gap analysis → AI model services: analyzes match
- Keyword gap analysis → MongoDB: saves analysis
- Mock interview API → AI model services: generates and evaluates
- Mock interview API → MongoDB: saves session
- Video interview API → AI model services: generates and evaluates
- Video interview API → MongoDB: saves session
- Streaming chat → AI model services: streams completion
- History and analytics → MongoDB: reads scores
- Application records → MongoDB: reads and writes
- User profile API → MongoDB: reads and writes
- Subscription checkout → Firebase Admin: verifies token
- Subscription checkout → MongoDB: reads and updates user
- Subscription checkout → Stripe: creates checkout
- Subscription updates → Stripe: verifies and retrieves
- Subscription updates → MongoDB: updates subscription
