# namanjainakt/ai-resume-analyzer architecture

> Architecture diagram of the GitHub repository namanjainakt/ai-resume-analyzer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/namanjainakt/ai-resume-analyzer
- Repository: https://github.com/namanjainakt/ai-resume-analyzer

## Overview

1. **Overall shape**
   - This is a single React Router v7 SSR application, not a split frontend/backend repo.
   - The `app/routes` directory defines both page routes and server endpoints, while `app/lib/*.server.ts` holds the server-side integration layer.
   - The deployment model is serverless-friendly, with Vercel as the target runtime.

2. **Request boundary and app shell**
   - `app/root.tsx` is the top-level entry and likely wires global providers such as Clerk.
   - `app/routes.ts` and the route files define the navigation graph for the whole product.
   - Public pages (`home`, `auth`, `not-found`, `sitemap`) sit alongside authenticated application pages under `app.*`.

3. **Authentication boundary**
   - Clerk is the identity system and acts as the gate for the main product surfaces.
   - `app/lib/auth.server.ts` centralizes session/user checks on the server side.
   - The authenticated experience is split across routes like `app.profile`, `app.resumes`, `app.settings`, `app.tracker`, and the feature-specific tools.

4. **Core persistence layer**
   - MongoDB Atlas is the primary structured datastore, accessed through `app/lib/db.server.ts` and `app/models/Resume.server.ts`.
   - Resume metadata, analysis results, and user-related application state are stored here.
   - The database is the system of record for app state, while uploaded binary files are kept elsewhere.

5. **File storage strategy**
   - Uploaded PDFs are not stored in MongoDB; they are pushed to Telegram via `app/lib/telegram.server.ts`.
   - This makes Telegram the external file store for source resumes and related artifacts.
   - The architecture is unusual but important: metadata in MongoDB, files in Telegram, and the app reconstructs references between them.

6. **Upload and resume-analysis pipeline**
   - The upload flow is centered on `app/routes/Upload.tsx` and `app/routes/Upload.server.ts`.
   - The server side likely parses the PDF, extracts text, scores ATS fit, and stores the result in MongoDB.
   - Helper modules such as `app/lib/pdf.server.ts`, `app/lib/pdf2img.ts`, `app/lib/resume.server.ts`, and `app/lib/resumePdf.server.ts` support parsing, conversion, and downstream rendering.

7. **AI orchestration layer**
   - All model calls are funneled through `app/lib/ai.server.ts`, using Google AI via `@ai-sdk/google`.
   - The default model is configured centrally, so AI behavior is a platform-level concern rather than feature-specific ad hoc calls.
   - `constants/` likely contains prompt templates and scoring instructions that drive consistent outputs across tools.

8. **Feature modules built on the AI layer**
   - Several routes are thin feature shells over the AI service: `cover-letter`, `interview-prep`, `linkedin`, `tailor`, and parts of `build`.
   - These features likely share a pattern: collect user input on the client, run a server action, then render structured AI output back into the UI.
   - `app/components/AIChat.tsx`, `Summary.tsx`, `ATS.tsx`, `KeywordMatch.tsx`, and similar components render the analysis results.

9. **Resume builder and template system**
   - The builder is a separate subsystem from analysis, centered on `app/routes/build.tsx` and the template directories.
   - `app/templates/` contains both preview components and PDF-specific templates under `app/templates/pdf/`.
   - This split matters: interactive preview is rendered in React, while final export uses PDF rendering components, likely via `@react-pdf/renderer`.

10. **Search and learning resources**
   - Skill-gap learning is backed by `app/lib/search.server.ts` and the optional YouTube Data API integration.
   - This feature enriches analysis with external learning content rather than generating everything locally.
   - It is a secondary integration boundary: the app scores skills first, then fetches tutorials/resources for missing areas.

11. **Media, preview, and export surfaces**
   - `app/routes/api.pdf.tsx`, `app/routes/api.pdf.server.ts`, and `app/routes/api.og.tsx` expose generated artifacts for sharing/export.
   - `app/components/PDFPreview.tsx`, `PDFThumbnail.tsx`, and `ResumeCard.tsx` support visual browsing of resume assets.
   - There is also a PWA-like delivery layer in `public/` with a manifest and service worker.

12. **UI composition and stateful interaction**
   - `app/components/` contains the reusable UI building blocks for scores, comparison views, upload flows, navigation, and dashboards.
   - Components like `ScoreGauge`, `ScoreCircle`, `ScoreComparison`, `ResumeCompare`, and `CustomWeights` indicate the app presents analytical results visually, not just as text.
   - `AppShell`, `Navbar`, and `Sidebar`-style components likely provide the authenticated layout around the feature routes.

13. **Operational boundaries**
   - The app depends on external services that materially shape architecture: Clerk for auth, MongoDB for persistence, Telegram for file storage, Google AI for generation, and YouTube API for learning content.
   - `AI_PDF_MODE` suggests a configurable parsing strategy, which can change the analysis pipeline without changing the user-facing routes.
   - `scripts/verify-*.mjs` and the docs indicate the repo is built with deployment validation in mind, especially for third-party service connectivity.

Main entry points: [`app/routes/app._index.tsx`](https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/routes/app._index.tsx) (Dashboard), [`app/lib/ai.server.ts`](https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/lib/ai.server.ts) (AI Service), [`app/routes/Upload.server.ts`](https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/routes/Upload.server.ts) (Upload Server), [`app/routes.ts`](https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/routes.ts) (Routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_routing["Routing & Shell"]
  node_root["Root<br/>SSR entry<br/>[root.tsx]"]
  node_routes_config["Routes<br/>route map<br/>[routes.ts]"]
  node_home_route["Home<br/>public route<br/>[home.tsx]"]
  node_auth_route["Auth<br/>public route<br/>[auth.tsx]"]
  node_app_shell["App Shell<br/>protected shell<br/>[app.tsx]"]
  node_app_index["Dashboard<br/>protected route<br/>[app._index.tsx]"]
end

subgraph group_core["Core Services"]
  node_db[("MongoDB<br/>datastore<br/>[db.server.ts]")]
  node_auth(("Clerk Auth<br/>identity<br/>[auth.server.ts]"))
  node_ai{{"AI Service<br/>generation core<br/>[ai.server.ts]"}}
  node_telegram[("Telegram Store<br/>file storage<br/>[telegram.server.ts]")]
  node_pdf["PDF Tools<br/>processing<br/>[pdf.server.ts]"]
  node_search["Search<br/>external enrichment<br/>[search.server.ts]"]
  node_resume_model["Resume Model<br/>[Resume.server.ts]"]
end

subgraph group_features["Feature Surfaces"]
  node_upload["Upload Flow<br/>analysis pipeline<br/>[Upload.tsx]"]
  node_upload_server["Upload Server<br/>server action<br/>[Upload.server.ts]"]
  node_tailor["Tailor<br/>ai feature<br/>[app.tailor.tsx]"]
  node_cover_letter["Cover Letter<br/>ai feature<br/>[cover-letter.tsx]"]
  node_interview_prep["Interview Prep<br/>ai feature<br/>[interview-prep.tsx]"]
  node_linkedin["LinkedIn<br/>ai feature<br/>[linkedin.tsx]"]
  node_resumes["Resumes<br/>app section<br/>[app.resumes.tsx]"]
end

subgraph group_builder["Builder & Templates"]
  node_build["Builder<br/>[build.tsx]"]
  node_templates["Templates<br/>template system"]
end

subgraph group_delivery["Delivery & Public Assets"]
  node_api_pdf["PDF Export<br/>artifact endpoint<br/>[api.pdf.tsx]"]
  node_api_og["OG Image<br/>artifact endpoint<br/>[api.og.tsx]"]
  node_public["Public Assets<br/>static delivery"]
end

node_routes_config -->|"maps"| node_home_route
node_routes_config -->|"maps"| node_auth_route
node_routes_config -->|"maps"| node_app_shell
node_app_shell -->|"nests"| node_app_index
node_root -->|"loads"| node_routes_config
node_root -->|"wraps"| node_app_shell
node_app_shell -->|"guards"| node_auth
node_upload -->|"action"| node_upload_server
node_upload_server -->|"parses"| node_pdf
node_upload_server -->|"stores files"| node_telegram
node_upload_server -->|"persists"| node_db
node_upload_server -->|"uses"| node_resume_model
node_resume_model -->|"backed by"| node_db
node_tailor -->|"calls"| node_ai
node_cover_letter -->|"calls"| node_ai
node_interview_prep -->|"calls"| node_ai
node_linkedin -->|"calls"| node_ai
node_ai -->|"reads state"| node_db
node_ai -->|"enriches"| node_search
node_build -->|"renders"| node_templates
node_templates -->|"exports"| node_api_pdf
node_templates -->|"supports"| node_api_og
node_resumes -->|"lists"| node_resume_model
node_app_index -->|"routes to"| node_upload
node_app_index -->|"routes to"| node_resumes
node_app_index -->|"routes to"| node_build
node_app_index -->|"routes to"| node_tailor
node_app_index -->|"routes to"| node_cover_letter
node_app_index -->|"routes to"| node_interview_prep
node_app_index -->|"routes to"| node_linkedin
node_app_index -->|"shares assets"| node_public

click node_root "https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/root.tsx"
click node_routes_config "https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/routes.ts"
click node_home_route "https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/routes/home.tsx"
click node_auth_route "https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/routes/auth.tsx"
click node_app_shell "https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/routes/app.tsx"
click node_app_index "https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/routes/app._index.tsx"
click node_db "https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/lib/db.server.ts"
click node_auth "https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/lib/auth.server.ts"
click node_ai "https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/lib/ai.server.ts"
click node_telegram "https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/lib/telegram.server.ts"
click node_pdf "https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/lib/pdf.server.ts"
click node_search "https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/lib/search.server.ts"
click node_resume_model "https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/models/Resume.server.ts"
click node_upload "https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/routes/Upload.tsx"
click node_upload_server "https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/routes/Upload.server.ts"
click node_tailor "https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/routes/app.tailor.tsx"
click node_cover_letter "https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/routes/cover-letter.tsx"
click node_interview_prep "https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/routes/interview-prep.tsx"
click node_linkedin "https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/routes/linkedin.tsx"
click node_resumes "https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/routes/app.resumes.tsx"
click node_build "https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/routes/build.tsx"
click node_templates "https://github.com/namanjainakt/ai-resume-analyzer/tree/main/app/templates"
click node_api_pdf "https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/routes/api.pdf.tsx"
click node_api_og "https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/routes/api.og.tsx"
click node_public "https://github.com/namanjainakt/ai-resume-analyzer/tree/main/public"

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_root,node_routes_config,node_home_route,node_auth_route,node_app_shell,node_app_index toneBlue
class node_db,node_auth,node_ai,node_telegram,node_pdf,node_search,node_resume_model toneAmber
class node_upload,node_upload_server,node_tailor,node_cover_letter,node_interview_prep,node_linkedin,node_resumes toneMint
class node_build,node_templates toneRose
class node_api_pdf,node_api_og,node_public toneIndigo
```

## Components

### Routing & Shell

Top-level SSR app entry and route map

- [Root](https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/root.tsx): SSR entry · Top-level app entry that mounts providers and global layout · `app/root.tsx`
- [Routes](https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/routes.ts): route map · Central route configuration for the application · `app/routes.ts`
- [Home](https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/routes/home.tsx): public route · Public landing page · `app/routes/home.tsx`
- [Auth](https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/routes/auth.tsx): public route · Authentication entry surface · `app/routes/auth.tsx`
- [App Shell](https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/routes/app.tsx): protected shell · Authenticated layout and navigation wrapper · `app/routes/app.tsx`
- [Dashboard](https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/routes/app._index.tsx): protected route · Main authenticated landing page · `app/routes/app._index.tsx`

### Core Services

Server-side integrations and shared persistence

- [MongoDB](https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/lib/db.server.ts): datastore · Primary system of record for resume and user state · `app/lib/db.server.ts`
- [Clerk Auth](https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/lib/auth.server.ts): identity · Session and user access control boundary · `app/lib/auth.server.ts`
- [AI Service](https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/lib/ai.server.ts): generation core · Centralized Google AI orchestration layer · `app/lib/ai.server.ts`
- [Telegram Store](https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/lib/telegram.server.ts): file storage · External store for uploaded PDFs and artifacts · `app/lib/telegram.server.ts`
- [PDF Tools](https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/lib/pdf.server.ts): processing · PDF parsing and conversion utilities · `app/lib/pdf.server.ts`
- [Search](https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/lib/search.server.ts): external enrichment · Learning-resource lookup for skill gaps · `app/lib/search.server.ts`
- [Resume Model](https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/models/Resume.server.ts): model · Resume persistence and access abstraction · `app/models/Resume.server.ts`

### Feature Surfaces

Main authenticated and public product flows

- [Upload Flow](https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/routes/Upload.tsx): analysis pipeline · PDF upload, extraction, scoring, and persistence flow · `app/routes/Upload.tsx`
- [Upload Server](https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/routes/Upload.server.ts): server action · Server-side upload processing and resume analysis · `app/routes/Upload.server.ts`
- [Tailor](https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/routes/app.tailor.tsx): ai feature · Resume tailoring workflow and output · `app/routes/app.tailor.tsx`
- [Cover Letter](https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/routes/cover-letter.tsx): ai feature · AI-assisted cover letter generation surface · `app/routes/cover-letter.tsx`
- [Interview Prep](https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/routes/interview-prep.tsx): ai feature · Interview practice and preparation surface · `app/routes/interview-prep.tsx`
- [LinkedIn](https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/routes/linkedin.tsx): ai feature · LinkedIn-oriented profile and content generation · `app/routes/linkedin.tsx`
- [Resumes](https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/routes/app.resumes.tsx): app section · Resume management and browsing surface · `app/routes/app.resumes.tsx`

### Builder & Templates

Resume creation and export templates

- [Builder](https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/routes/build.tsx): resume builder · Interactive resume construction and template selection · `app/routes/build.tsx`
- [Templates](https://github.com/namanjainakt/ai-resume-analyzer/tree/main/app/templates): template system · Preview components and PDF export templates · `app/templates`

### Delivery & Public Assets

Generated artifacts and static delivery

- [PDF Export](https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/routes/api.pdf.tsx): artifact endpoint · Generated PDF artifact endpoint · `app/routes/api.pdf.tsx`
- [OG Image](https://github.com/namanjainakt/ai-resume-analyzer/blob/main/app/routes/api.og.tsx): artifact endpoint · Social preview image endpoint · `app/routes/api.og.tsx`
- [Public Assets](https://github.com/namanjainakt/ai-resume-analyzer/tree/main/public): static delivery · Manifest, service worker, icons, and robots delivery · `public`

## Connections

- Routes → Home: maps · Defines the public landing route
- Routes → Auth: maps · Defines authentication route
- Routes → App Shell: maps · Defines protected app shell
- App Shell → Dashboard: nests · Authenticated dashboard sits under the shell
- Root → Routes: loads · Bootstraps the full route tree
- Root → App Shell: wraps · Provides global providers and layout
- App Shell → Clerk Auth: guards · Checks session and user access
- Upload Flow → Upload Server: action · Client upload UI submits to server processing
- Upload Server → PDF Tools: parses · Extracts and converts uploaded PDFs
- Upload Server → Telegram Store: stores files · Pushes source PDFs to external file store
- Upload Server → MongoDB: persists · Stores metadata and analysis results
- Upload Server → Resume Model: uses · Writes through the resume data model
- Resume Model → MongoDB: backed by · MongoDB is the system of record
- Tailor → AI Service: calls · Uses centralized AI orchestration
- Cover Letter → AI Service: calls · Uses centralized AI orchestration
- Interview Prep → AI Service: calls · Uses centralized AI orchestration
- LinkedIn → AI Service: calls · Uses centralized AI orchestration
- AI Service → MongoDB: reads state · Uses stored resume and user context
- AI Service → Search: enriches · Fetches learning resources for gaps
- Builder → Templates: renders · Interactive builder previews templates
- Templates → PDF Export: exports · PDF templates support export endpoint
- Templates → OG Image: supports · Template visuals feed social previews
- Resumes → Resume Model: lists · Browses stored resume records
- Dashboard → Upload Flow: routes to · Main dashboard links into upload flow
- Dashboard → Resumes: routes to · Dashboard surfaces resume management
- Dashboard → Builder: routes to · Dashboard surfaces builder entry
- Dashboard → Tailor: routes to · Dashboard surfaces tailoring tools
- Dashboard → Cover Letter: routes to · Dashboard surfaces cover-letter tool
- Dashboard → Interview Prep: routes to · Dashboard surfaces interview prep tool
- Dashboard → LinkedIn: routes to · Dashboard surfaces LinkedIn tool
- Dashboard → Public Assets: shares assets · App can reference static delivery assets
