# saksham-goel1107/openresume architecture

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

- Interactive diagram: https://gitdiagram.com/saksham-goel1107/openresume
- Repository: https://github.com/saksham-goel1107/openresume

## Overview

##### Project Type and Purpose
- OpenResume is a full-stack, single-repository Next.js (v15) web application.
- Purpose: In-browser resume building (PDF generation) and resume parsing (AST readability check), plus an optional AI chat assistant.

##### File Structure
- src/app: Next.js App Router pages, components, API routes, global styles, and utilities.
- src/app/api/ai-chat/route.ts: serverless API route for AI chat.
- src/app/lib/parse-resume-from-pdf: client-side PDF parsing logic using PDF.js.
- src/app/components/ResumePDF & react-pdf: client-side PDF rendering.
- src/app/lib/redux: Redux Toolkit store for in-browser resume state.
- src/app/utils/redis.ts: Redis helper for caching or session storage in server functions.
- Dockerfile, CI workflows, docs/render-deployment.md: containerization and deployment configurations.

##### README Insights
- Tech stack: Next.js, React, TypeScript, Redux Toolkit, Tailwind CSS, PDF.js (parser), react-pdf (renderer).
- No user-account database; all builder state is local (Redux + browser localStorage).
- AI chat requires an external LLM API (Gemini/OpenAI) and Redis for key management.
- Hosted as a Dockerized web service (Render.com recommended).

##### Main Components & Their Interactions
a. Client (Browser)
- Renders Next.js pages (Home, /resume-import, /resume-builder, /resume-parser).
- Runs React components, Redux store, PDF parsing & rendering entirely in browser.
- Interacts with server only for AI chat features.
b. Next.js Server (Serverless Routes)
- Serves static assets and pre-renders pages (SSG/SSR).
- Handles /api/ai-chat route: accepts user prompts, fetches/stores conversation context in Redis, calls external LLM API, returns streamed responses.
c. External Services
- LLM API (Gemini/OpenAI) for AI chat.
- Redis instance for caching API keys or chat session data.
d. CI/CD & Deployment
- GitHub Actions for lint/test/scan.
- Docker container built via Dockerfile, deployed to Render.

##### Architectural Patterns & Design Principles
- Monorepo with Next.js App Router (colocates pages, components, and server routes).
- “Feature folder” structure: each page (resume-builder, parser, import) has its own directory.
- Client-heavy logic: parser & builder run entirely in browser for privacy.
- Serverless functions for “thin” API layer (AI chat).
- Redux Toolkit centralizes app state; localStorage persistence.

##### Essential Elements
- Labels: “Browser (React + Redux)”, “Next.js Serverless API”, “Redis Cache”, “LLM API”, “Static Assets CDN”.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Browser Layer
    subgraph "Browser (React + Redux)" 
        classDef frontend fill:#D6EAF8,stroke:#1B4F72,color:#1B2631
        subgraph "Pages"
            Home["Home (src/app/page.tsx)"] 
            Import["Resume Import (src/app/resume-import/page.tsx)"]
            Builder["Resume Builder (src/app/resume-builder/page.tsx)"]
            Parser["Resume Parser (src/app/resume-parser/page.tsx)"]
        end
        subgraph "Core UI Components"
            classDef ui fill:#AED6F1,stroke:#1B4F72
            ResumeForm["ResumeForm Components"] 
            Dropzone["ResumeDropzoneClient.tsx"]
            HooksUI["Resume Hooks (hooks.tsx)"]
            ControlBar["ResumeControlBar.tsx"]
            IFrame["ResumeIFrame.tsx"]
        end
        subgraph "Redux Store"
            classDef redux fill:#85C1E9,stroke:#1B4F72
            Store["store.ts"] 
            ResumeSlice["resumeSlice.ts"] 
            SettingsSlice["settingsSlice.ts"] 
            HooksRedux["hooks.tsx"] 
            LocalStorage["local-storage.ts"]
        end
        subgraph "PDF Parsing (PDF.js)"
            classDef parser fill:#AED6F1,stroke:#1B4F72
            ParseIndex["index.ts"]
            ReadPDF["read-pdf-modern.ts"]
            ExtractSections["extract-resume-from-sections/*"]
        end
        subgraph "PDF Rendering (react-pdf)"
            classDef renderer fill:#AED6F1,stroke:#1B4F72
            ResumePDFIndex["index.tsx"]
            CustomPDF["ResumePDFCustom.tsx"]
            EducationPDF["ResumePDFEducation.tsx"]
            ProfilePDF["ResumePDFProfile.tsx"]
            ProjectPDF["ResumePDFProject.tsx"]
            SkillsPDF["ResumePDFSkills.tsx"]
            WorkPDF["ResumePDFWorkExperience.tsx"]
            CommonPDF["common/*"]
        end
        subgraph "Global Providers & Styles"
            Providers["Providers.tsx"]
            GlobalsCSS["globals.css"]
            GlobalsTS["globals-css.ts"]
        end
    end

    %% Serverless API
    subgraph "Next.js Serverless API"
        classDef api fill:#D5F5E3,stroke:#145A32,color:#145A32
        AIChat["/api/ai-chat (route.ts)"]
        RedisHelper["redis.ts"]
    end

    %% External Services
    subgraph "External Services"
        classDef external fill:#FDEBD0,stroke:#7E5109
        LLM["LLM API (Gemini/OpenAI)"]
        Redis["Redis Cache"]:::storage
        StaticAssets["Static Assets CDN"]
    end

    %% Deployment & CI/CD
    subgraph "Deployment & CI/CD"
        classDef deploy fill:#E8DAEF,stroke:#512E5F
        Dockerfile["Dockerfile"]
        RenderDoc["render-deployment.md"]
        CI1[".github/workflows/ci.yml"]
        CI2[".github/workflows/test.yml"]
        CI3[".github/workflows/codeql.yml"]
        CI4[".github/workflows/snyk.yml"]
    end

    %% Data Flows
    Home -->|uses| Store
    Import -->|dispatch| Store
    Builder -->|dispatch| Store
    Parser -->|dispatch| Store

    Store -->|provides state| ResumeForm
    Store -->|provides state| Dropzone
    Store -->|provides state| HooksUI
    Store -->|provides state| ControlBar
    Store -->|provides state| IFrame

    Builder -->|parse PDF| ParseIndex
    ParseIndex --> ReadPDF
    ParseIndex --> ExtractSections

    Builder -->|render PDF| ResumePDFIndex
    ResumePDFIndex --> CustomPDF
    ResumePDFIndex --> EducationPDF
    ResumePDFIndex --> ProfilePDF
    ResumePDFIndex --> ProjectPDF
    ResumePDFIndex --> SkillsPDF
    ResumePDFIndex --> WorkPDF
    ResumePDFIndex --> CommonPDF

    %% AI Chat Flow
    Builder -->|"start chat"| AIChat
    AIChat -->|get/store session| Redis
    AIChat -->|call LLM API| LLM
    LLM -->|stream response| AIChat
    AIChat -->|stream response| Builder

    %% Static Assets
    Home --> StaticAssets
    Import --> StaticAssets
    Builder --> StaticAssets
    Parser --> StaticAssets

    %% API uses Redis helper
    AIChat --> RedisHelper

    %% Styles & Providers used by all pages
    Providers --> Home
    Providers --> Import
    Providers --> Builder
    Providers --> Parser
    GlobalsCSS --> Providers
    GlobalsTS --> Providers

    %% Deployment connections
    Dockerfile --> RenderDoc
    Dockerfile --> CI1
    Dockerfile --> CI2
    Dockerfile --> CI3
    Dockerfile --> CI4

    %% Click Events
    click Home "https://github.com/saksham-goel1107/openresume/blob/main/src/app/page.tsx"
    click Import "https://github.com/saksham-goel1107/openresume/blob/main/src/app/resume-import/page.tsx"
    click Builder "https://github.com/saksham-goel1107/openresume/blob/main/src/app/resume-builder/page.tsx"
    click Parser "https://github.com/saksham-goel1107/openresume/blob/main/src/app/resume-parser/page.tsx"
    click AIChat "https://github.com/saksham-goel1107/openresume/blob/main/src/app/api/ai-chat/route.ts"
    click ParseIndex "https://github.com/saksham-goel1107/openresume/blob/main/src/app/lib/parse-resume-from-pdf/index.ts"
    click ReadPDF "https://github.com/saksham-goel1107/openresume/blob/main/src/app/lib/parse-resume-from-pdf/read-pdf-modern.ts"
    click ExtractSections "https://github.com/saksham-goel1107/openresume/tree/main/src/app/lib/parse-resume-from-pdf/extract-resume-from-sections/"
    click ResumePDFIndex "https://github.com/saksham-goel1107/openresume/blob/main/src/app/components/Resume/ResumePDF/index.tsx"
    click CustomPDF "https://github.com/saksham-goel1107/openresume/blob/main/src/app/components/Resume/ResumePDF/ResumePDFCustom.tsx"
    click EducationPDF "https://github.com/saksham-goel1107/openresume/blob/main/src/app/components/Resume/ResumePDF/ResumePDFEducation.tsx"
    click ProfilePDF "https://github.com/saksham-goel1107/openresume/blob/main/src/app/components/Resume/ResumePDF/ResumePDFProfile.tsx"
    click ProjectPDF "https://github.com/saksham-goel1107/openresume/blob/main/src/app/components/Resume/ResumePDF/ResumePDFProject.tsx"
    click SkillsPDF "https://github.com/saksham-goel1107/openresume/blob/main/src/app/components/Resume/ResumePDF/ResumePDFSkills.tsx"
    click WorkPDF "https://github.com/saksham-goel1107/openresume/blob/main/src/app/components/Resume/ResumePDF/ResumePDFWorkExperience.tsx"
    click CommonPDF "https://github.com/saksham-goel1107/openresume/tree/main/src/app/components/Resume/ResumePDF/common/"
    click Store "https://github.com/saksham-goel1107/openresume/blob/main/src/app/lib/redux/store.ts"
    click ResumeSlice "https://github.com/saksham-goel1107/openresume/blob/main/src/app/lib/redux/resumeSlice.ts"
    click SettingsSlice "https://github.com/saksham-goel1107/openresume/blob/main/src/app/lib/redux/settingsSlice.ts"
    click HooksRedux "https://github.com/saksham-goel1107/openresume/blob/main/src/app/lib/redux/hooks.tsx"
    click LocalStorage "https://github.com/saksham-goel1107/openresume/blob/main/src/app/lib/redux/local-storage.ts"
    click RedisHelper "https://github.com/saksham-goel1107/openresume/blob/main/src/app/utils/redis.ts"
    click Providers "https://github.com/saksham-goel1107/openresume/blob/main/src/app/Providers.tsx"
    click GlobalsCSS "https://github.com/saksham-goel1107/openresume/blob/main/src/app/globals.css"
    click GlobalsTS "https://github.com/saksham-goel1107/openresume/blob/main/src/app/globals-css.ts"

    %% Class assignments
    class Home,Import,Builder,Parser frontend
    class ResumeForm,Dropzone,HooksUI,ControlBar,IFrame ui
    class Store,ResumeSlice,SettingsSlice,HooksRedux,LocalStorage redux
    class ParseIndex,ReadPDF,ExtractSections parser
    class ResumePDFIndex,CustomPDF,EducationPDF,ProfilePDF,ProjectPDF,SkillsPDF,WorkPDF,CommonPDF renderer
    class AIChat,RedisHelper api
    class LLM,StaticAssets external
    class Redis storage
    class Dockerfile,RenderDoc,CI1,CI2,CI3,CI4 deploy
```
