# exclusiveabhi/react-job-portal architecture

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

- Interactive diagram: https://gitdiagram.com/exclusiveabhi/react-job-portal
- Repository: https://github.com/exclusiveabhi/react-job-portal

## Overview

##### Project Type and Purpose
- This is a full-stack MERN (MongoDB, Express, React, Node.js) job portal application.
- Purpose: allow job seekers to browse/list jobs, apply and manage applications; allow employers to post jobs and review applications.

##### File Structure
- Top-level split into two folders:
- backend/ – Node.js + Express REST API
- frontend/ – React SPA built with Vite
- backend/ contains:
- app.js / server.js – Express app setup and server entry point
- controllers/ – request handlers (user, job, application)
- routes/ – Express routers mapping endpoints to controllers
- models/ – Mongoose schemas for User, Job, Application
- middlewares/ – auth check, error handling, async wrapper
- database/ – MongoDB connection logic
- utils/ – JWT token generation
- .env (config.env) – env vars for DB, JWT, Cloudinary, CORS
- frontend/ contains:
- src/ – React components organized by feature (Auth, Home, Job, Application, Layout)
- main.jsx – app bootstrap, React Router setup
- public/CVs – temporary storage for resume uploads
- Vite config, ESLint, package files

##### README Insights
- Technologies: React, Express, MongoDB Atlas, JWT, Bcrypt, Cloudinary
- Deployment: Vercel for frontend, Render for backend, MongoDB Atlas
- Features: authentication, job listings, application management, responsive UI

##### Main Components
a. Frontend (React SPA)
- Browser / Client
- React Router / UI components
- HTTP client (fetch or axios)
b. Backend API (Node.js + Express)
- API Gateway (Express server)
- Route handlers → Controllers
- Middleware layers (Auth, Error Handler)
c. Database Layer
- MongoDB Atlas cluster
- Mongoose ODM mapping to schemas
d. External Services
- Cloudinary for file/image uploads (resumes, company logos)
- JWT authentication service (stateless tokens)
e. Deployment & Infrastructure
- Vercel hosting for front end
- Render.com hosting for back end
- Environment variables injection

##### Relationships and Data Flows
- User interacts with React SPA in browser
- SPA → HTTP(S) calls to Express API endpoints (GET /jobs, POST /applications, POST /login, etc.)
- Express middlewares authenticate (JWT via HTTP header or cookie)
- Controllers call Mongoose models → CRUD on MongoDB Atlas
- On file upload endpoints, Express uploads files to Cloudinary, returns URL → stored in MongoDB
- Responses return JSON to front end → update UI state

##### Architectural Patterns & Design Principles
- Layered architecture: Presentation (React), API (Express Controllers + Middleware), Data (MongoDB)
- RESTful API design for job, user, application resources
- MVC-inspired separation in backend (models/controllers/routes)
- Stateless JWT auth for horizontal scalability
- Single Page Application on front end for seamless UX

##### Detail Without Overthinking
- Essential elements: file storage, token generation, database connection.
- Someone reading it can trace “Login → Auth Middleware → User Model → JWT Token → Client” end-to-end.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Frontend Section
    subgraph "Frontend (Vercel)"
        direction TB
        Browser["User Browser"]:::external
        MainEntry["Main (main.jsx)"]:::frontend
        App["App Setup (App.jsx)"]:::frontend
        subgraph "Auth Components"
            direction TB
            Login["Login"]:::frontend
            Register["Register"]:::frontend
        end
        subgraph "Home Components"
            direction TB
            Hero["Hero Section"]:::frontend
            HowItWorks["How It Works"]:::frontend
            PopularCat["Popular Categories"]:::frontend
            PopularComp["Popular Companies"]:::frontend
            HomePage["Home Page"]:::frontend
        end
        subgraph "Job Module"
            direction TB
            Jobs["Jobs Listing"]:::frontend
            JobDetails["Job Details"]:::frontend
            PostJob["Post Job"]:::frontend
            MyJobs["My Jobs"]:::frontend
        end
        subgraph "Application Module"
            direction TB
            ApplicationComp["Apply"]:::frontend
            MyApplications["My Applications"]:::frontend
            ResumeModal["Resume Modal"]:::frontend
        end
        subgraph "Layout"
            direction TB
            Navbar["Navbar"]:::frontend
            Footer["Footer"]:::frontend
        end
        NotFound["NotFound"]:::frontend
    end

    %% Backend Section
    subgraph "Backend (Render)"
        direction TB
        Express["Express Server"]:::backend
        subgraph "Middleware"
            direction TB
            AuthMW["Auth Middleware"]:::backend
            ErrorMW["Error Handler"]:::backend
            CatchAsync["CatchAsync Wrapper"]:::backend
        end
        subgraph "Routes"
            direction TB
            UserRoutes["User Routes"]:::backend
            JobRoutes["Job Routes"]:::backend
            AppRoutes["Application Routes"]:::backend
        end
        subgraph "Controllers"
            direction TB
            UserCtl["User Controller"]:::backend
            JobCtl["Job Controller"]:::backend
            AppCtl["Application Controller"]:::backend
        end
        subgraph "Models"
            direction TB
            UserModel["User Model"]:::backend
            JobModel["Job Model"]:::backend
            AppModel["Application Model"]:::backend
        end
        DBConn["DB Connection"]:::backend
        JWTUtil["JWT Utility"]:::backend

        Express -->|uses| AuthMW
        Express -->|uses| ErrorMW
        Express -->|uses| CatchAsync
        Express -->|routes| UserRoutes
        Express -->|routes| JobRoutes
        Express -->|routes| AppRoutes
        UserRoutes -->|calls| UserCtl
        JobRoutes -->|calls| JobCtl
        AppRoutes -->|calls| AppCtl
        UserCtl -->|uses| UserModel
        JobCtl -->|uses| JobModel
        AppCtl -->|uses| AppModel
        UserModel -->|connects| DBConn
        JobModel -->|connects| DBConn
        AppModel -->|connects| DBConn
        UserCtl -->|generates| JWTUtil
    end

    %% External Services
    Cloudinary["Cloudinary"]:::external
    MongoDB["MongoDB Atlas"]:::database

    %% Data Flows
    Browser -->|HTTP/HTTPS| Express
    Express -->|CRUD| MongoDB
    Express -->|upload/download| Cloudinary

    %% Click Events - Frontend
    click MainEntry "https://github.com/exclusiveabhi/react-job-portal/blob/main/frontend/src/main.jsx"
    click App "https://github.com/exclusiveabhi/react-job-portal/blob/main/frontend/src/App.jsx"
    click Login "https://github.com/exclusiveabhi/react-job-portal/blob/main/frontend/src/components/Auth/Login.jsx"
    click Register "https://github.com/exclusiveabhi/react-job-portal/blob/main/frontend/src/components/Auth/Register.jsx"
    click Hero "https://github.com/exclusiveabhi/react-job-portal/blob/main/frontend/src/components/Home/HeroSection.jsx"
    click HowItWorks "https://github.com/exclusiveabhi/react-job-portal/blob/main/frontend/src/components/Home/HowItWorks.jsx"
    click PopularCat "https://github.com/exclusiveabhi/react-job-portal/blob/main/frontend/src/components/Home/PopularCategories.jsx"
    click PopularComp "https://github.com/exclusiveabhi/react-job-portal/blob/main/frontend/src/components/Home/PopularCompanies.jsx"
    click HomePage "https://github.com/exclusiveabhi/react-job-portal/blob/main/frontend/src/components/Home/Home.jsx"
    click Jobs "https://github.com/exclusiveabhi/react-job-portal/blob/main/frontend/src/components/Job/Jobs.jsx"
    click JobDetails "https://github.com/exclusiveabhi/react-job-portal/blob/main/frontend/src/components/Job/JobDetails.jsx"
    click PostJob "https://github.com/exclusiveabhi/react-job-portal/blob/main/frontend/src/components/Job/PostJob.jsx"
    click MyJobs "https://github.com/exclusiveabhi/react-job-portal/blob/main/frontend/src/components/Job/MyJobs.jsx"
    click ApplicationComp "https://github.com/exclusiveabhi/react-job-portal/blob/main/frontend/src/components/Application/Application.jsx"
    click MyApplications "https://github.com/exclusiveabhi/react-job-portal/blob/main/frontend/src/components/Application/MyApplications.jsx"
    click ResumeModal "https://github.com/exclusiveabhi/react-job-portal/blob/main/frontend/src/components/Application/ResumeModal.jsx"
    click Navbar "https://github.com/exclusiveabhi/react-job-portal/blob/main/frontend/src/components/Layout/Navbar.jsx"
    click Footer "https://github.com/exclusiveabhi/react-job-portal/blob/main/frontend/src/components/Layout/Footer.jsx"
    click NotFound "https://github.com/exclusiveabhi/react-job-portal/blob/main/frontend/src/components/NotFound/NotFound.jsx"
    click PublicCVs "https://github.com/exclusiveabhi/react-job-portal/tree/main/frontend/public/CVs"

    %% Click Events - Backend
    click Express "https://github.com/exclusiveabhi/react-job-portal/blob/main/backend/app.js"
    click Express "https://github.com/exclusiveabhi/react-job-portal/blob/main/backend/server.js"
    click UserRoutes "https://github.com/exclusiveabhi/react-job-portal/blob/main/backend/routes/userRoutes.js"
    click JobRoutes "https://github.com/exclusiveabhi/react-job-portal/blob/main/backend/routes/jobRoutes.js"
    click AppRoutes "https://github.com/exclusiveabhi/react-job-portal/blob/main/backend/routes/applicationRoutes.js"
    click UserCtl "https://github.com/exclusiveabhi/react-job-portal/blob/main/backend/controllers/userController.js"
    click JobCtl "https://github.com/exclusiveabhi/react-job-portal/blob/main/backend/controllers/jobController.js"
    click AppCtl "https://github.com/exclusiveabhi/react-job-portal/blob/main/backend/controllers/applicationController.js"
    click UserModel "https://github.com/exclusiveabhi/react-job-portal/blob/main/backend/models/userSchema.js"
    click JobModel "https://github.com/exclusiveabhi/react-job-portal/blob/main/backend/models/jobSchema.js"
    click AppModel "https://github.com/exclusiveabhi/react-job-portal/blob/main/backend/models/applicationSchema.js"
    click AuthMW "https://github.com/exclusiveabhi/react-job-portal/blob/main/backend/middlewares/auth.js"
    click ErrorMW "https://github.com/exclusiveabhi/react-job-portal/blob/main/backend/middlewares/error.js"
    click CatchAsync "https://github.com/exclusiveabhi/react-job-portal/blob/main/backend/middlewares/catchAsyncError.js"
    click DBConn "https://github.com/exclusiveabhi/react-job-portal/blob/main/backend/database/dbConnection.js"
    click JWTUtil "https://github.com/exclusiveabhi/react-job-portal/blob/main/backend/utils/jwtToken.js"
    click EnvConfig "https://github.com/exclusiveabhi/react-job-portal/blob/main/backend/.env"

    %% Styles
    classDef frontend fill:#ccf,stroke:#339,stroke-width:1px
    classDef backend fill:#fcf,stroke:#933,stroke-width:1px
    classDef database fill:#cfc,stroke:#393,stroke-width:1px
    classDef external fill:#ffc,stroke:#993,stroke-width:1px
```
