# rajtiwari23/careernest architecture

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

- Interactive diagram: https://gitdiagram.com/rajtiwari23/careernest
- Repository: https://github.com/rajtiwari23/careernest

## Overview

##### Project type and purpose
- This is a full-stack web application: a job portal with user and admin interfaces for browsing, posting, and managing job listings and applications.
- The frontend is built in React (Vite, Tailwind CSS, Redux) and the backend is an Express/Node.js REST API with MongoDB (Mongoose) and Cloudinary for file uploads.

##### File structure
- Top-level “backend” and “frontend” directories
- Backend follows an MVC-style pattern:
- controllers/ (application.controller.js, job.controller.js, etc.)
- models/ (application.model.js, job.model.js, etc.)
- routes/ (application.route.js, job.route.js, etc.)
- middlewares/ (authentication, file upload)
- utils/ (db connection, Cloudinary integration, data URI conversion)
- index.js as entry point
- Frontend is a Vite-React app:
- src/components/ subdivided into auth, admin, shared, UI primitives
- src/hooks/ for data fetching
- src/redux/ for application state slices (auth, job, company, application)
- tailwind.config.js, postcss.config.js, vite.config.js for styling/build

##### README
- (Empty in this case; all insights come from file structure.)

a. Main components:
- Client Browser (React UI)
- Frontend App (Vite development server / static assets)
- Backend API Server (Express)
- Database (MongoDB)
- External Service (Cloudinary)
b. Relationships and interactions:
1. Browser ↔ Frontend: User events → React components; state stored in Redux; HTTP calls via fetch/axios to backend.
2. Frontend → Backend: REST API calls (GET/POST/PUT/DELETE) to /api/users, /api/jobs, /api/applications, /api/companies.
3. Backend:
- Request → middleware (authentication, Multer upload) → route → controller → model (Mongoose) → MongoDB.
- For file uploads: controller calls utils/datauri → utils/cloudinary → Cloudinary.
4. Backend → Database: CRUD operations via Mongoose.
c. Architectural patterns/design principles:
- MVC pattern on the server side (routes → controllers → models).
- Separation of concerns: authentication and file processing in middlewares; utility modules for external integrations.
- Unidirectional data flow on frontend: React components dispatch Redux actions → update store → propagate to UI.
d. Relevant technologies/frameworks:
- Frontend: React, Vite, Redux Toolkit, Tailwind CSS, Sonner, Headless UI (implicit), custom hooks.
- Backend: Node.js, Express, Mongoose, Cloudinary SDK, Multer, JWT (implied by isAuthenticated), dotenv.
- Database: MongoDB (self-hosted or Atlas).

##### Detailed guidance
- Drill down to a “Container” view: separate code-level containers for the React app, Express app, MongoDB, Cloudinary.
- A “Component” view within the Express app, showing routes → controllers → models.
- Technology names and ports (e.g., Frontend on port 3000, Backend on port 5000).

## Diagram (Mermaid)

```mermaid
graph TB
  %% Frontend Container
  subgraph "Frontend" 
    direction TB
    Browser["Browser (User/Admin)"]:::external
    Main["React UI Components"]:::frontend
    Store["Redux Store"]:::frontend
    HTTP["HTTP Client (fetch/axios)"]:::frontend
    Hooks["Custom Hooks"]:::frontend
    UtilsFE["Frontend Utils"]:::frontend
    EntryFE["Frontend Entry Point"]:::frontend
    Styles["Styles & Config"]:::frontend
  end

  %% Backend Container
  subgraph "Backend"
    direction TB
    API["Express API Server"]:::backend
    EntryBE["API Entry Point"]:::backend

    subgraph "Middlewares"
      AuthM["Auth Middleware"]:::backend
      UploadM["Upload Middleware"]:::backend
    end

    subgraph "Routes"
      UserR["User Routes"]:::backend
      JobR["Job Routes"]:::backend
      CompR["Company Routes"]:::backend
      AppR["Application Routes"]:::backend
    end

    subgraph "Controllers"
      UserC["User Controller"]:::backend
      JobC["Job Controller"]:::backend
      CompC["Company Controller"]:::backend
      AppC["Application Controller"]:::backend
    end

    subgraph "Models"
      UserM["User Model"]:::backend
      JobM["Job Model"]:::backend
      CompM["Company Model"]:::backend
      AppM["Application Model"]:::backend
    end

    subgraph "Utils"
      DB["DB Utility"]:::backend
      Cloud["Cloudinary Utility"]:::backend
      DataU["Data URI Utility"]:::backend
    end
  end

  %% External Services
  DBServer["MongoDB"]:::database
  CloudSrv["Cloudinary"]:::external

  %% Connections
  Browser --> Main
  Main --> Store
  Store --> HTTP
  HTTP --> API
  API --> AuthM
  API --> UploadM
  API --> EntryBE
  AuthM --> UserR
  UploadM --> UserR
  UserR --> UserC
  JobR --> JobC
  CompR --> CompC
  AppR --> AppC
  UserC --> UserM
  JobC --> JobM
  CompC --> CompM
  AppC --> AppM
  UserM --> DB
  JobM --> DB
  CompM --> DB
  AppM --> DB
  DB --> DBServer
  JobC --> DataU
  DataU --> Cloud
  Cloud --> CloudSrv

  %% Click Events - Frontend
  click Main "https://github.com/rajtiwari23/careernest/tree/main/frontend/src/components/"
  click EntryFE "https://github.com/rajtiwari23/careernest/blob/main/frontend/src/main.jsx"
  click Store "https://github.com/rajtiwari23/careernest/blob/main/frontend/src/redux/store.js"
  click Hooks "https://github.com/rajtiwari23/careernest/tree/main/frontend/src/hooks/"
  click UtilsFE "https://github.com/rajtiwari23/careernest/blob/main/frontend/src/lib/utils.js"
  click UtilsFE "https://github.com/rajtiwari23/careernest/blob/main/frontend/src/utils/constant.js"
  click Styles "https://github.com/rajtiwari23/careernest/blob/main/frontend/tailwind.config.js"
  click Styles "https://github.com/rajtiwari23/careernest/blob/main/frontend/vite.config.js"
  click Styles "https://github.com/rajtiwari23/careernest/blob/main/frontend/postcss.config.js"
  click Browser "https://github.com/rajtiwari23/careernest/tree/main/frontend/"

  %% Click Events - Auth/Admin/Shared/UI
  click Main "https://github.com/rajtiwari23/careernest/blob/main/frontend/src/components/auth/Login.jsx"
  click Main "https://github.com/rajtiwari23/careernest/blob/main/frontend/src/components/auth/Signup.jsx"
  click Main "https://github.com/rajtiwari23/careernest/tree/main/frontend/src/components/admin/"
  click Main "https://github.com/rajtiwari23/careernest/blob/main/frontend/src/components/shared/Navbar.jsx"
  click Main "https://github.com/rajtiwari23/careernest/blob/main/frontend/src/components/shared/Footer.jsx"
  click Main "https://github.com/rajtiwari23/careernest/tree/main/frontend/src/components/ui/"

  %% Click Events - Backend
  click EntryBE "https://github.com/rajtiwari23/careernest/blob/main/backend/index.js"
  click AuthM "https://github.com/rajtiwari23/careernest/blob/main/backend/middlewares/isAuthenticated.js"
  click UploadM "https://github.com/rajtiwari23/careernest/blob/main/backend/middlewares/mutler.js"
  click UserR "https://github.com/rajtiwari23/careernest/blob/main/backend/routes/user.route.js"
  click JobR "https://github.com/rajtiwari23/careernest/blob/main/backend/routes/job.route.js"
  click CompR "https://github.com/rajtiwari23/careernest/blob/main/backend/routes/company.route.js"
  click AppR "https://github.com/rajtiwari23/careernest/blob/main/backend/routes/application.route.js"
  click UserC "https://github.com/rajtiwari23/careernest/blob/main/backend/controllers/user.controller.js"
  click JobC "https://github.com/rajtiwari23/careernest/blob/main/backend/controllers/job.controller.js"
  click CompC "https://github.com/rajtiwari23/careernest/blob/main/backend/controllers/company.controller.js"
  click AppC "https://github.com/rajtiwari23/careernest/blob/main/backend/controllers/application.controller.js"
  click UserM "https://github.com/rajtiwari23/careernest/blob/main/backend/models/user.model.js"
  click JobM "https://github.com/rajtiwari23/careernest/blob/main/backend/models/job.model.js"
  click CompM "https://github.com/rajtiwari23/careernest/blob/main/backend/models/company.model.js"
  click AppM "https://github.com/rajtiwari23/careernest/blob/main/backend/models/application.model.js"
  click DB "https://github.com/rajtiwari23/careernest/blob/main/backend/utils/db.js"
  click Cloud "https://github.com/rajtiwari23/careernest/blob/main/backend/utils/cloudinary.js"
  click DataU "https://github.com/rajtiwari23/careernest/blob/main/backend/utils/datauri.js"

  %% Styles
  classDef frontend fill:#E8F0FE,stroke:#4A90E2,color:#1A237E;
  classDef backend fill:#E8F5E9,stroke:#43A047,color:#1B5E20;
  classDef database fill:#FFF3E0,stroke:#FB8C00,color:#E65100;
  classDef external fill:#F3E5F5,stroke:#8E24AA,color:#4A148C;
```
