# wizardgeeky/job-recommendation-system architecture

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

- Interactive diagram: https://gitdiagram.com/wizardgeeky/job-recommendation-system
- Repository: https://github.com/wizardgeeky/job-recommendation-system

## Overview

##### Project Type & Purpose
- The system is a full-stack web application built with Next.js, aimed at facilitating job search, resume management, and job recommendations.
- It combines user authentication (signup, login, password management, OTP, JWT). It also integrates external job APIs (e.g., Remote OK) for job listings, along with resume upload and skills extraction functionalities.
- The tech stack includes Next.js (frontend and backend), TypeScript, Tailwind CSS, MongoDB, Nodemailer, and JWT.

##### File Structure
- The project is organized in a Next.js structure. Under the “app” directory, you have:
- API Routes: Located in app/api/auth with subdirectories for various authentication endpoints and a jobs route (which likely handles jobs fetching or management).
- Components: UI elements like dashboards, job pages, navbar, recommendation pages, and resume upload pages.
- Configuration: Database and email configurations in app/config.
- Models: Representing data schemas (JobModel, Otp, UserModel), suggesting Mongoose/MongoDB is used.
- Utilities: Helper functions for token creation, ciphering, and skills extraction.
- This directory structure clearly separates API endpoints from UI components, implying an MVC-like separation between frontend rendering and backend API logic.

##### Key Components
a. Frontend:
- Next.js Pages & Components (Found in app/page.tsx and app/components/* directories).
- User Interface for Dashboard, Job listings, Resume upload, Recommendations, and Navbar.
b. API/Backend:
- Next.js API Routes (inside app/api/auth, including various endpoints for login, signup, OTP verification, password management, recommendations, and job-related operations).
c. Business Logic:
- Controllers/Handlers in your API routes interacting with models and util functions.
- Authentication management (JWT and session handling).
- Skills extraction from resumes.
d. Database:
- MongoDB integration with connections configured in app/config/database-config.ts.
- Models representing users, jobs, OTPs.
e. External Services & Integrations:
- Remote Job API integration to fetch remote job listings.
- Email Service (via Nodemailer) for password recovery and OTP validations.
f. Utilities & Configurations:
- Utility functions (app/util) for tasks like token generation and data encryption/decryption.
- Configuration files for email and database connections.
g. Deployment:
- The project is hosted on Vercel.

- The Frontend makes API calls to the Backend (shown as Next.js API endpoints) for authentication, job management, and resume upload operations.
- The API layer communicates with the MongoDB database (for user data, job data, session details).
- There’s an integration link between the backend API and the external Remote Job API for retrieving job listings.
- Email/OTP processes are handled by another connection from the API layer to an Email Service (using Nodemailer).

##### Architectural Patterns & Design Principles
- Client-Server Architecture: Separation between client (Next.js pages/components) and server (API routes).
- MVC-like Structure: Presentation layer (components), business logic (API endpoints and utilities), and data (MongoDB models).
- RESTful API: Each API route (e.g., route.ts files in auth/login, auth/jobs, etc.) adheres to HTTP methods to interact with the data layer.
- Modular design: The clear separation of concerns (authentication, job management, external API integration) allows extensibility.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client Layer"
        Browser["Browser/Client"]:::external
    end

    %% Frontend UI Layer
    subgraph "Frontend UI (Next.js Pages & Components)"
        A1["Home Page"]:::frontend
        A2["Password Page"]:::frontend
        A3["Dashboard"]:::frontend
        A4["Job Listings"]:::frontend
        A5["Navbar"]:::frontend
        A6["Recommendations"]:::frontend
        A7["Resume Upload"]:::frontend
    end

    %% API Layer
    subgraph "API Layer (Next.js API Routes)"
        B1["Login Endpoint"]:::api
        B2["Signup Endpoint"]:::api
        B3["OTP Endpoint"]:::api
        B4["OTP Verification Endpoint"]:::api
        B5["Password Management Endpoint"]:::api
        B6["Job Handling Endpoint"]:::api
        B7["Recommendation Endpoint"]:::api
        B8["Suggestion Endpoint"]:::api
        B9["Resume Upload Endpoint"]:::api
    end

    %% Business Logic Layer
    subgraph "Business Logic (Utilities)"
        C1["Token Utility"]:::logic
        C2["Cipher Utility"]:::logic
        C3["Skills Extraction Utility"]:::logic
    end

    %% Database Layer
    subgraph "Database (MongoDB)"
        D1["Database Config"]:::database
        D2["Job Model"]:::database
        D3["OTP Model"]:::database
        D4["User Model"]:::database
    end

    %% External Services
    subgraph "External Services"
        E1["Email Service"]:::external
        E2["Remote Job API"]:::external
    end

    %% Connections from Client to Frontend
    Browser -->|"accesses"| A1

    %% Connections from Frontend to API Layer
    A1 -->|"triggers signup"| B2
    A2 -->|"triggers password reset"| B5
    A3 -->|"triggers login"| B1
    A4 -->|"fetches jobs"| B6
    A6 -->|"requests recommendations"| B7
    A7 -->|"uploads resume"| B9

    %% Connections from API Layer to Business Logic
    B1 -->|"generates JWT"| C1
    B3 -->|"encrypts OTP"| C2
    B7 -->|"processes skills"| C3

    %% Connections from API Layer to Database
    B1 -->|"verifies user"| D4
    B2 -->|"creates user"| D4
    B6 -->|"stores/fetches jobs"| D2
    B4 -->|"validates OTP"| D3
    B5 -->|"updates password"| D4
    B9 -->|"associates resume with user"| D4

    %% Connections from API Layer to External Services
    B5 -->|"sends email"| E1
    B6 -->|"retrieves remote jobs"| E2

    %% Styles
    classDef frontend fill:#BBDEFB,stroke:#000,stroke-width:1px;
    classDef api fill:#C8E6C9,stroke:#000,stroke-width:1px;
    classDef logic fill:#F0F4C3,stroke:#000,stroke-width:1px;
    classDef database fill:#FFCDD2,stroke:#000,stroke-width:1px;
    classDef external fill:#E1BEE7,stroke:#000,stroke-width:1px;

    %% Click Events for Frontend UI
    click A1 "https://github.com/wizardgeeky/job-recommendation-system/blob/main/app/page.tsx"
    click A2 "https://github.com/wizardgeeky/job-recommendation-system/blob/main/app/password/page.tsx"
    click A3 "https://github.com/wizardgeeky/job-recommendation-system/blob/main/app/components/dashboard/page.tsx"
    click A4 "https://github.com/wizardgeeky/job-recommendation-system/blob/main/app/components/job/page.tsx"
    click A5 "https://github.com/wizardgeeky/job-recommendation-system/blob/main/app/components/navbar/navbar.tsx"
    click A6 "https://github.com/wizardgeeky/job-recommendation-system/blob/main/app/components/recommendation/page.tsx"
    click A7 "https://github.com/wizardgeeky/job-recommendation-system/blob/main/app/components/upload/page.tsx"

    %% Click Events for API Endpoints
    click B1 "https://github.com/wizardgeeky/job-recommendation-system/blob/main/app/api/auth/login/route.ts"
    click B2 "https://github.com/wizardgeeky/job-recommendation-system/blob/main/app/api/auth/signup/route.ts"
    click B3 "https://github.com/wizardgeeky/job-recommendation-system/blob/main/app/api/auth/otp/route.ts"
    click B4 "https://github.com/wizardgeeky/job-recommendation-system/blob/main/app/api/auth/otp/verify/route.ts"
    click B5 "https://github.com/wizardgeeky/job-recommendation-system/blob/main/app/api/auth/password/route.ts"
    click B6 "https://github.com/wizardgeeky/job-recommendation-system/blob/main/app/api/auth/jobs/route.ts"
    click B7 "https://github.com/wizardgeeky/job-recommendation-system/blob/main/app/api/auth/recommendation/route.ts"
    click B8 "https://github.com/wizardgeeky/job-recommendation-system/blob/main/app/api/auth/suggestion/route.ts"
    click B9 "https://github.com/wizardgeeky/job-recommendation-system/blob/main/app/api/auth/upload/route.ts"

    %% Click Events for Business Logic Utilities
    click C1 "https://github.com/wizardgeeky/job-recommendation-system/blob/main/app/util/token.ts"
    click C2 "https://github.com/wizardgeeky/job-recommendation-system/blob/main/app/util/cipher.ts"
    click C3 "https://github.com/wizardgeeky/job-recommendation-system/blob/main/app/util/extractskills.ts"

    %% Click Events for Database Integration
    click D1 "https://github.com/wizardgeeky/job-recommendation-system/blob/main/app/config/database-config.ts"
    click D2 "https://github.com/wizardgeeky/job-recommendation-system/blob/main/app/model/JobModel.ts"
    click D3 "https://github.com/wizardgeeky/job-recommendation-system/blob/main/app/model/Otp.ts"
    click D4 "https://github.com/wizardgeeky/job-recommendation-system/blob/main/app/model/UserModel.ts"

    %% Click Event for External Email Service
    click E1 "https://github.com/wizardgeeky/job-recommendation-system/blob/main/app/config/email-config.ts"
```
