# iamrohitkandpal/workhub-app architecture

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

- Interactive diagram: https://gitdiagram.com/iamrohitkandpal/workhub-app
- Repository: https://github.com/iamrohitkandpal/workhub-app

## Overview

##### Project type and purpose
- This is a full-stack job board application (“WorkHub-App”) with:
- A React/Vite/TailwindCSS frontend (job browsing, applications, profile, admin panels)
- An Express/MongoDB backend exposing RESTful APIs (users, companies, jobs, applications)
- File upload/image storage via Multer + Cloudinary
- Authentication via JWT middleware

##### File structure
- Frontend (frontend/)
- src/components: pages & UI widgets (admin, auth, shared, ui)
- src/hooks + src/redux: data‐fetching & state management (React Query style hooks + Redux slices)
- Vite/Tailwind config & index.html entry point
- Backend (backend/)
- app.js: Express app & route mounting
- routes/*: route definitions
- controllers/*: MVC controllers
- models/*: Mongoose schemas (User, Company, Job, Application)
- middlewares/*: JWT auth, file‐upload handling
- utils: DB connection, Cloudinary integration, Data URI helper

##### Key insights from README
- Minimal description but file tree reveals standard frontend/backend split

##### Detailed capturing of essential elements
- Frontend:
- Entry: index.html → main.jsx
- Components (e.g., Jobs, JobDescription)
- Redux slices: authSlice, jobSlice, etc.
- Backend:
- app.js mounting /api/users, /api/jobs, /api/companies, /api/applications
- isAuthenticated middleware in front of protected routes
- multer and cloudinary in company & job controller file upload endpoints
- Data flow examples:
- User signup → POST /api/users → user.controller.create → user.model.save → returns JWT
- Company logo upload → multer → cloudinary.upload → returns URL → company.model.save

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    Browser["Browser"]:::frontend

    %% Frontend Layer
    subgraph "Frontend Application" 
        direction TB
        IDX["Index.html"]:::frontend
        MAIN["main.jsx"]:::frontend
        APP["App.jsx"]:::frontend
        CMPTS["Components"]:::frontend
        AUTHCMPT["Login.jsx / Signup.jsx"]:::frontend
        ADMCMPTS["Admin Components"]:::frontend
        SHDCMPTS["Shared Components"]:::frontend
        UICMPTS["UI Library"]:::frontend
        HOOKS["Data Fetching Hooks"]:::frontend
        STORE["Redux Store (store.js)"]:::frontend
        SLICES["Auth/Job/Company/Application Slices"]:::frontend
        UTILS_FE["Utils (utils.js, constant.js)"]:::frontend
        CONFIG["Tailwind & Vite Configs"]:::frontend

        IDX -->|"loads"| MAIN
        MAIN -->|"renders"| APP
        APP -->|"uses"| CMPTS
        CMPTS --> AUTHCMPT
        CMPTS --> ADMCMPTS
        CMPTS --> SHDCMPTS
        CMPTS --> UICMPTS
        APP -->|"calls hooks"| HOOKS
        APP -->|"dispatches actions"| STORE
        STORE -->|"manages slices"| SLICES
        APP -->|"fetches/config"| UTILS_FE
        IDX -->|"build config"| CONFIG
        APP -->|"REST API calls"| API["Express API"] 
    end

    %% Backend Layer
    subgraph "Backend API" 
        direction TB
        APPJS["app.js"]:::backend
        ROUTES["Routes"]:::backend
        CTRLS["Controllers"]:::backend
        MODELS["Models"]:::backend
        AUTHMW["JWT Middleware"]:::backend
        MULTERMW["Multer Middleware"]:::backend
        UTILS_BE["Utils"]:::backend

        API --> APPJS
        APPJS --> ROUTES
        ROUTES --> AUTHMW
        ROUTES --> CTRLS
        CTRLS --> MODELS
        MODELS --> DB["MongoDB"]:::db
        CTRLS --> MULTERMW
        MULTERMW --> CLOUD["Cloudinary"]:::external
        UTILS_BE --> APPJS
    end

    %% Database
    subgraph "Database"
        DB
    end

    %% External Services
    subgraph "External Services"
        CLOUD
    end

    %% Connections
    Browser -->|"HTTP(S)"| APP
    APP -->|"GET/POST JSON"| API
    CTRLS -->|"save/fetch"| DB
    MULTERMW -->|"upload image"| CLOUD
    CLOUD -->|"returns URL"| CTRLS

    %% Click Events
    click IDX "https://github.com/iamrohitkandpal/workhub-app/blob/main/frontend/index.html"
    click MAIN "https://github.com/iamrohitkandpal/workhub-app/blob/main/frontend/src/main.jsx"
    click APP "https://github.com/iamrohitkandpal/workhub-app/blob/main/frontend/src/App.jsx"
    click CMPTS "https://github.com/iamrohitkandpal/workhub-app/tree/main/frontend/src/components/"
    click AUTHCMPT "https://github.com/iamrohitkandpal/workhub-app/blob/main/frontend/src/components/auth/Login.jsx"
    click AUTHCMPT "https://github.com/iamrohitkandpal/workhub-app/blob/main/frontend/src/components/auth/Signup.jsx"
    click ADMCMPTS "https://github.com/iamrohitkandpal/workhub-app/tree/main/frontend/src/components/admin/"
    click SHDCMPTS "https://github.com/iamrohitkandpal/workhub-app/tree/main/frontend/src/components/shared/"
    click UICMPTS "https://github.com/iamrohitkandpal/workhub-app/tree/main/frontend/src/components/ui/"
    click HOOKS "https://github.com/iamrohitkandpal/workhub-app/tree/main/frontend/src/hooks/"
    click STORE "https://github.com/iamrohitkandpal/workhub-app/blob/main/frontend/src/redux/store.js"
    click SLICES "https://github.com/iamrohitkandpal/workhub-app/blob/main/frontend/src/redux/authSlice.js"
    click SLICES "https://github.com/iamrohitkandpal/workhub-app/blob/main/frontend/src/redux/jobSlice.js"
    click SLICES "https://github.com/iamrohitkandpal/workhub-app/blob/main/frontend/src/redux/companySlice.js"
    click SLICES "https://github.com/iamrohitkandpal/workhub-app/blob/main/frontend/src/redux/applicationSlice.js"
    click UTILS_FE "https://github.com/iamrohitkandpal/workhub-app/blob/main/frontend/src/lib/utils.js"
    click UTILS_FE "https://github.com/iamrohitkandpal/workhub-app/blob/main/frontend/src/utils/constant.js"
    click CONFIG "https://github.com/iamrohitkandpal/workhub-app/blob/main/frontend/tailwind.config.js"
    click CONFIG "https://github.com/iamrohitkandpal/workhub-app/blob/main/frontend/vite.config.js"
    click APPJS "https://github.com/iamrohitkandpal/workhub-app/blob/main/backend/app.js"
    click ROUTES "https://github.com/iamrohitkandpal/workhub-app/tree/main/backend/routes/"
    click CTRLS "https://github.com/iamrohitkandpal/workhub-app/tree/main/backend/controllers/"
    click MODELS "https://github.com/iamrohitkandpal/workhub-app/tree/main/backend/models/"
    click AUTHMW "https://github.com/iamrohitkandpal/workhub-app/blob/main/backend/middlewares/isAuthenticated.js"
    click MULTERMW "https://github.com/iamrohitkandpal/workhub-app/blob/main/backend/middlewares/multer.js"
    click UTILS_BE "https://github.com/iamrohitkandpal/workhub-app/blob/main/backend/utils/db.js"
    click UTILS_BE "https://github.com/iamrohitkandpal/workhub-app/blob/main/backend/utils/cloudinary.js"
    click UTILS_BE "https://github.com/iamrohitkandpal/workhub-app/blob/main/backend/utils/dataURI.js"

    %% Styles
    classDef frontend fill:#e0f7fa,stroke:#006064,color:#004d40
    classDef backend fill:#e8f5e9,stroke:#1b5e20,color:#2e7d32
    classDef db fill:#fff3e0,stroke:#e65100,color:#bf360c
    classDef external fill:#f3e5f5,stroke:#6a1b9a,color:#4a148c
```
