# abdulhamidalthaljy/resume-generator-with-ai-full-system architecture

> Architecture diagram of the GitHub repository abdulhamidalthaljy/resume-generator-with-ai-full-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abdulhamidalthaljy/resume-generator-with-ai-full-system
- Repository: https://github.com/abdulhamidalthaljy/resume-generator-with-ai-full-system

## Overview

##### Project Type & Purpose
- Full-stack web application for resume creation
- Frontend: Angular SPA (real-time preview, AI generation, template selection)
- Backend: Node.js/Express API (REST + Socket.io), Google OAuth, JWT auth, MongoDB persistence
- External integrations: Google Gemini AI, Google OAuth2, MongoDB Atlas

##### File Structure
Top-level directories:
- resume-builder-angular/ → Angular 17 app
- resume-builder-backend/ → Node.js/Express API
Key patterns:
- Frontend: component-based UI, services for API, Socket.io, AI, PDF, route guards
- Backend: MVC-style (controllers, models, routes), middleware (auth guard), services (PDF generator), utils (JWT), config (passport)
Config & deployment files:
- Railway/Terraform (railway.json), Vercel (vercel.json), nixpacks.toml
- Environment config (.env, environment.ts)

##### Extract Architecture Insights from README
- Frontend calls `/api` for CRUD, uses Socket.io events for real-time updates
- Backend exposes REST endpoints under `/api` and WebSocket namespace for events (`resume:created`, etc.)
- Google OAuth2 flow for login, JWT issued to client, stored in local storage & sent on API calls
- AI integration: backend calls Google Gemini Flash API; frontend calls AI endpoints via ai.service.ts
- PDF generation: fronted uses browser’s print-to-PDF; backend offers optional server-side PDF generator

##### Main Components & Interactions
A. Frontend (Angular SPA)
- UI Components (Dashboard, Resume-Builder, Activity-Feed, Template-Selector, etc.)
- Angular Services (HttpClient for REST, SocketService for WS, AiService for AI calls, TemplateService)
- Route Guard (AuthGuard)
- Environment module for API URLs
B. Backend (Node.js/Express)
- Express App (app.js / index.js)
- Routes (/api/auth, /api/resumes, /api/pdf)
- Controllers (resumeController.js)
- Services (pdfGeneratorService.js)
- Models (User.js, Resume.js)
- Middleware (ensureAuth.js)
- Auth Config (Passport.js + JWT util)
- Socket.io Server
C. Database
- MongoDB Atlas (Mongoose ODM)
D. External Services
- Google OAuth2 (Passport)
- Google Gemini API
- Vercel (Frontend deployment)
- Railway (Backend deployment)

##### Architectural Patterns & Principles
- Separation of concerns: UI vs. business logic vs. data access
- MVC on backend: controllers → services → models
- Component-based UI on frontend
- Reactive data flow (RxJS + Socket.io) for real-time updates
- Stateless JWT authentication for cross-origin requests

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    subgraph "Client (Browser/Angular SPA)"
        direction TB
        UI["UI Components"]:::frontend
        Services["Angular Services"]:::frontend
        Guard["AuthGuard"]:::frontend
        Env["Environment Config"]:::frontend
        Core["App Module & Routing"]:::frontend
    end

    %% Server Layer
    subgraph "API Server (Node.js/Express + Socket.io)"
        direction TB
        Index["Index Bootstrap\n(index.js)"]:::backend
        AppSetup["Express App Setup\n(app.js)"]:::backend
        Server["HTTP Server & Socket.io\n(server.js)"]:::backend
        subgraph "Routes"
            direction TB
            AuthRoutes["Auth Routes"]:::backend
            ResumeRoutes["Resume Routes"]:::backend
            PDFRoutes["PDF Routes"]:::backend
            CombinedAuth["Combined Auth Endpoints"]:::backend
        end
        Controller["Resume Controller"]:::backend
        Service["PDF Generator Service"]:::backend
        subgraph "Models"
            direction TB
            UserModel["User Model"]:::backend
            ModelIndex["Model Index"]:::backend
        end
        Middleware["ensureAuth Middleware"]:::backend
        Config["Passport Config"]:::backend
        Utils["JWT Utility"]:::backend
    end

    %% Database Layer
    subgraph "Database"
        DB["MongoDB Atlas"]:::database
    end

    %% External Services
    subgraph "External Services"
        direction TB
        GoogleOAuth["Google OAuth2"]:::external
        GoogleAI["Google Gemini API"]:::external
    end

    %% Deployment
    subgraph "Deployment"
        direction TB
        VercelFE["Vercel (Frontend)"]:::deployment
        RailwayBE["Railway (Backend)"]:::deployment
    end

    %% Connections
    UI -->|uses| Services
    UI -->|protected by| Guard
    UI -->|reads| Env
    UI -->|bootstraps| Core

    Services -->|HTTP REST calls| AppSetup
    Services -->|WebSocket connection| Server
    Guard -->|checks JWT| Utils

    AppSetup -->|uses middleware| Middleware
    AppSetup -->|registers routes| AuthRoutes
    AppSetup -->|registers routes| ResumeRoutes
    AppSetup -->|registers routes| PDFRoutes
    AppSetup -->|registers routes| CombinedAuth
    Server -->|binds to| AppSetup

    AuthRoutes -->|calls| Controller
    ResumeRoutes -->|calls| Controller
    PDFRoutes -->|calls| Service
    CombinedAuth -->|calls| AuthRoutes

    Controller -->|queries| ModelIndex
    ModelIndex -->|includes| UserModel
    Controller -->|emits event| Server
    Service -->|writes| PDFRoutes

    AppSetup -->|configures| Config
    Config -->|uses| GoogleOAuth
    AppSetup -->|uses| Utils

    Controller -->|calls| GoogleAI

    AppSetup -->|connects| DB
    Utils -->|signs tokens| DB

    UI -->|deployed on| VercelFE
    AppSetup -->|deployed on| RailwayBE

    GoogleOAuth -->|redirect flow| UI
    UI -->|OAuth callback| AuthRoutes

    %% Click Events
    click UI "https://github.com/abdulhamidalthaljy/resume-generator-with-ai-full-system/tree/main/resume-builder-angular/src/app/components"
    click Services "https://github.com/abdulhamidalthaljy/resume-generator-with-ai-full-system/tree/main/resume-builder-angular/src/app/services"
    click Guard "https://github.com/abdulhamidalthaljy/resume-generator-with-ai-full-system/blob/main/resume-builder-angular/src/app/guards/auth.guard.ts"
    click Env "https://github.com/abdulhamidalthaljy/resume-generator-with-ai-full-system/blob/main/resume-builder-angular/src/environments/environment.ts"
    click Core "https://github.com/abdulhamidalthaljy/resume-generator-with-ai-full-system/blob/main/resume-builder-angular/src/app/app.module.ts"
    click Core "https://github.com/abdulhamidalthaljy/resume-generator-with-ai-full-system/blob/main/resume-builder-angular/src/app/app-routing.module.ts"
    click Index "https://github.com/abdulhamidalthaljy/resume-generator-with-ai-full-system/blob/main/resume-builder-backend/src/index.js"
    click AppSetup "https://github.com/abdulhamidalthaljy/resume-generator-with-ai-full-system/blob/main/resume-builder-backend/src/app.js"
    click Server "https://github.com/abdulhamidalthaljy/resume-generator-with-ai-full-system/blob/main/resume-builder-backend/src/server.js"
    click AuthRoutes "https://github.com/abdulhamidalthaljy/resume-generator-with-ai-full-system/blob/main/resume-builder-backend/src/routes/auth.js"
    click ResumeRoutes "https://github.com/abdulhamidalthaljy/resume-generator-with-ai-full-system/blob/main/resume-builder-backend/src/routes/resumeRoutes.js"
    click PDFRoutes "https://github.com/abdulhamidalthaljy/resume-generator-with-ai-full-system/blob/main/resume-builder-backend/src/routes/pdfRoutes.js"
    click CombinedAuth "https://github.com/abdulhamidalthaljy/resume-generator-with-ai-full-system/blob/main/resume-builder-backend/src/routes/authRoutes.js"
    click Controller "https://github.com/abdulhamidalthaljy/resume-generator-with-ai-full-system/blob/main/resume-builder-backend/src/controllers/resumeController.js"
    click Service "https://github.com/abdulhamidalthaljy/resume-generator-with-ai-full-system/blob/main/resume-builder-backend/src/services/pdfGeneratorService.js"
    click UserModel "https://github.com/abdulhamidalthaljy/resume-generator-with-ai-full-system/blob/main/resume-builder-backend/src/models/User.js"
    click ModelIndex "https://github.com/abdulhamidalthaljy/resume-generator-with-ai-full-system/blob/main/resume-builder-backend/src/models/index.js"
    click Middleware "https://github.com/abdulhamidalthaljy/resume-generator-with-ai-full-system/blob/main/resume-builder-backend/src/middleware/ensureAuth.js"
    click Config "https://github.com/abdulhamidalthaljy/resume-generator-with-ai-full-system/blob/main/resume-builder-backend/src/config/passport.js"
    click Utils "https://github.com/abdulhamidalthaljy/resume-generator-with-ai-full-system/blob/main/resume-builder-backend/src/utils/jwt.js"
    click VercelFE "https://github.com/abdulhamidalthaljy/resume-generator-with-ai-full-system/blob/main/resume-builder-angular/vercel.json"
    click RailwayBE "https://github.com/abdulhamidalthaljy/resume-generator-with-ai-full-system/blob/main/resume-builder-backend/railway.json"

    %% Styles
    classDef frontend fill:#E3F2FD,stroke:#42A5F5,color:#0D47A1;
    classDef backend fill:#E8F5E9,stroke:#66BB6A,color:#1B5E20;
    classDef database fill:#FFF3E0,stroke:#FFA726,color:#E65100,stroke-dasharray: 5 5,shape:cylinder;
    classDef external fill:#F3E5F5,stroke:#AB47BC,color:#4A148C;
    classDef deployment fill:#ECEFF1,stroke:#78909C,color:#263238;
```
