# justmeetpatel/airesume architecture

> Architecture diagram of the GitHub repository justmeetpatel/airesume, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/justmeetpatel/airesume
- Repository: https://github.com/justmeetpatel/airesume

## Overview

##### Project type and purpose
- This is a full‑stack AI‑powered Resume Builder & ATS Checker.
- Frontend: Next.js 13 “App Router” with TypeScript and Tailwind CSS.
- Backend/API: Primarily implemented as Next.js API routes (`app/api`) plus an external Python FastAPI service (port 8000) that hosts the AI/ML resume analysis engine.
- Persistence: PostgreSQL (accessed via Prisma ORM).
- Auth: Custom auth machinery in `app/api/auth` (could optionally integrate Supabase or Auth.js).

##### File structure
Top‑level directories
- app/
– UI pages (home, FAQ, resume builder, resume checker)
– `(auth)/` subfolder with sign‑in, sign‑up, reset/forgot flows
– API routes under `app/api/auth/[...all]/route.ts` and `app/api/resume/route.ts`
– Global layouts and CSS
- components/ & components/ui/
– Reusable React components and low‑level UI primitives (accordion, button, dialog, etc.)
- lib/
– Business logic and utilities: `auth.ts`, `session.ts`, `resume.ts`, `prisma.ts`, `utils.ts`
- prisma/
– Database schema and migrations
- hooks/
– Custom React hooks (`use-mobile`, `use-toast`)
- Config files: `next.config.mjs`, `tailwind.config.ts`, `tsconfig.json`, lock files

##### README for additional insights
- Confirms separation of frontend (Next.js) and AI backend (FastAPI).
- Mentions AI model endpoints (e.g. POST `/analyze`).
- Suggests local development endpoints: Next.js on `:3000`, FastAPI on `:8000`.
- Describes tech stack layers.

##### Main components & relationships
A. End‑User Browser (Chrome/Firefox)
– Interacts with Next.js frontend over HTTPS (port 3000).
B. Next.js Frontend (React, Tailwind)
– SSR/SSG of UI pages (app/page.tsx, layouts)
– Client‑side hydration & real‑time preview
C. Next.js API Layer (app/api)
1. Auth routes (`/api/auth/*`): sign‑in, sign‑up, password reset
2. Resume routes (`/api/resume`): create, save, fetch resume data
– These handlers call into `lib/auth.ts`, `lib/session.ts`, `lib/resume.ts` and into Prisma client (`lib/prisma.ts`)
D. Database (PostgreSQL)
– Holds user accounts, sessions, resume records
– Accessed by Prisma ORM from Node
E. External AI Service (Python FastAPI on port 8000)
– Exposes endpoints like `/analyze`
– Runs NLP/ML models for ATS scoring, keyword extraction, feedback generation
– Deployed as a separate microservice (could be dockerized)
F. (Optional) External Auth Provider
– Supabase or Auth.js / OAuth flows if integrated

1. Browser → Next.js Frontend: page requests, form submissions
2. Frontend → Next.js API: fetch calls for auth and resume CRUD
3. Next.js API → PostgreSQL: read/write via Prisma
4. Next.js API (or directly frontend) → FastAPI AI Service: POST resume text → get ATS score & feedback
5. Responses propagate back to frontend → rendered in UI

##### Architectural patterns and design principles
- Layered architecture: UI layer (React) → API/Service layer (Next.js API + FastAPI) → Data layer (DB)
- Microservices for AI logic (separation of concerns, independent scaling)
- React “App Router” for file‑based routing and layout composition
- Use of Prisma migrations ensures schema evolution is version‑controlled
- Modular UI primitives in `components/ui` promote reuse and consistent styling

##### Capturing essential details
- Be granular: separate out Auth API vs. Resume API vs. AI Service
- Asynchronous flows (e.g., file uploads, AI analysis)
- Data stores and indicate which service writes or reads from them
- Don’t overthink—focus on clear separation of concerns and the main request paths

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Entities
    Browser["End-User Browser"]:::external

    %% Next.js Monolith
    subgraph "Next.js Monolith"
        subgraph "Frontend UI"
            CorePages["Core Pages & Layouts"]:::frontend
            BuildUI["Resume Builder UI"]:::frontend
            CheckUI["Resume Checker UI"]:::frontend
            FAQ["FAQ Page"]:::frontend
            AuthUI["Auth UI Flows"]:::frontend
            subgraph "Reusable Components"
                Components["components/"]:::frontend
                UIPrimitives["components/ui/"]:::frontend
            end
            subgraph "Custom Hooks"
                Hooks["hooks/"]:::frontend
            end
        end
        subgraph "API Layer"
            AuthAPI["Auth Routes"]:::backend
            ResumeAPI["Resume Routes"]:::backend
            subgraph "Business Logic & Utilities"
                Lib["lib/"]:::backend
            end
        end
    end

    %% Database Layer
    subgraph "Database Layer"
        PrismaClient["Prisma ORM"]:::backend
        Postgres["PostgreSQL"]:::database
    end

    %% External Services
    subgraph "External Services"
        AIService["AI Service (FastAPI)"]:::externalService
        AuthProvider["Auth Provider (Supabase/OAuth)"]:::external
    end

    %% Connections
    Browser -->|HTTPS:3000| CorePages
    Browser -->|HTTPS:3000| BuildUI
    Browser -->|HTTPS:3000| CheckUI
    Browser -->|HTTPS:3000| FAQ
    Browser -->|HTTPS:3000| AuthUI

    CorePages -->|imports| Components
    CorePages -->|imports| UIPrimitives
    BuildUI -->|calls| ResumeAPI
    CheckUI -->|calls| ResumeAPI
    FAQ -->|calls| ResumeAPI
    AuthUI -->|calls| AuthAPI

    AuthAPI -->|calls| Lib
    ResumeAPI -->|calls| Lib
    Lib -->|uses| PrismaClient
    PrismaClient -->|reads/writes| Postgres

    ResumeAPI -->|POST /analyze HTTPS:8000| AIService
    AuthAPI -->|optional OAuth| AuthProvider

    %% Click Events
    click CorePages "https://github.com/justmeetpatel/airesume/blob/main/app/layout.tsx"
    click BuildUI "https://github.com/justmeetpatel/airesume/blob/main/app/build-resume/page.tsx"
    click CheckUI "https://github.com/justmeetpatel/airesume/blob/main/app/check-resume/page.tsx"
    click FAQ "https://github.com/justmeetpatel/airesume/blob/main/app/faq/page.tsx"
    click AuthUI "https://github.com/justmeetpatel/airesume/blob/main/app/(auth)/layout.tsx"
    click Components "https://github.com/justmeetpatel/airesume/tree/main/components/"
    click UIPrimitives "https://github.com/justmeetpatel/airesume/tree/main/components/ui/"
    click Hooks "https://github.com/justmeetpatel/airesume/blob/main/hooks/use-mobile.tsx"
    click AuthAPI "https://github.com/justmeetpatel/airesume/blob/main/app/api/auth/[...all]/route.ts"
    click ResumeAPI "https://github.com/justmeetpatel/airesume/blob/main/app/api/resume/route.ts"
    click Lib "https://github.com/justmeetpatel/airesume/blob/main/lib/auth.ts"
    click PrismaClient "https://github.com/justmeetpatel/airesume/blob/main/lib/prisma.ts"

    %% Styles
    classDef frontend fill:#bbdefb,stroke:#2196f3,color:#000;
    classDef backend fill:#e1bee7,stroke:#9c27b0,color:#000;
    classDef database fill:#c8e6c9,stroke:#4caf50,color:#000;
    classDef externalService fill:#ffe0b2,stroke:#fb8c00,color:#000;
    classDef external fill:#eeeeee,stroke:#9e9e9e,color:#000;
```
