# sanketgreathire/greathire architecture

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

- Interactive diagram: https://gitdiagram.com/sanketgreathire/greathire
- Repository: https://github.com/sanketgreathire/greathire

## Overview

##### Project Overview and Major Components
- Two main sections: Frontend and Backend.
- The Frontend is a React application (using Vite, Tailwind, and several UI components, contexts, redux slices, and page routes) that manages user interface logic, authentication views, job listings, and administrative dashboards.
- The Backend is built with Express.js and encapsulates a RESTful API. It has clearly separated directories for:
- Controllers: grouped by functionality (e.g., admin, users, recruiters, jobs, orders, verification, etc.) that handle incoming HTTP requests.
- Routes: map endpoints (including separate admin routes) to specific controllers.
- Middlewares: include authentication, validation, and file upload (multer) handlers.
- Models: define the data schema for various entities (jobs, companies, user profiles, admin, subscription details, etc.).
- Utilities: provide essential functions for cloud integrations (Cloudinary), database configurations, and other helpers.

##### Architectural Patterns and Design Principles
- Separation of concerns provided by separating controllers, routes, models, and middlewares.
- That admin-specific functionalities have dedicated folders in both the Frontend and Backend, indicating role-based access control.
- RESTful design principles where each endpoint represents a clear operation (e.g., GET, POST, PUT, DELETE) on resources.
- That the Frontend relies on state management (Redux and Context API) to handle authentication, notifications, and job details.

- From Frontend to Backend (for API calls, passing of data and responses).
- From Backend Routes to Controllers.
- From Controllers to Models and Utility Services.
- Critical paths such as authentication flows and data submission for job applications, admin operations, etc.
- Don’t shy away from breaking down the Backend further into sub-components like “Admin Module”, “User Module”, “Recruiter Module”, etc., to provide clarity.

##### Additional Points
- Annotations detailing how middleware functions (such as contactValidator or loginValidator) fit into the request lifecycle.
- If needed, add a note on how third-party integrations (Cloudinary for file storage, Google OAuth for authentication) are factored as part of the utilities.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend (React + Vite)"
        FE1["Frontend Application"]:::frontend
        FE2["UI Components"]:::frontend
        FE3["Pages"]:::frontend
        subgraph "State Management"
            FE4["Redux"]:::frontend
            FE5["Context"]:::frontend
        end
        FE1 -->|"renders"| FE2
        FE1 -->|"renders"| FE3
        FE1 -->|"manages"| FE4
        FE1 -->|"manages"| FE5
    end

    subgraph "Backend (Express.js)"
        BE0["Backend Server"]:::backend
        BE1["API Routes"]:::backend
        BE2["Middlewares"]:::backend
        BE3["Controllers"]:::backend
        BE4["Models"]:::backend
        BE5["Utility Services"]:::utilities
        BE6["Database"]:::db
        BE0 -->|"HTTP_Request"| BE1
        BE1 -->|"MW_Validation"| BE2
        BE2 -->|"Pass_Request"| BE3
        BE3 -->|"DB_Query"| BE4
        BE3 -->|"Call_Util"| BE5
        BE4 -->|"Store_Data"| BE6
    end

    FE1 -->|"HTTP_Request"| BE1

    click FE1 "https://github.com/sanketgreathire/greathire/tree/main/frontend/"
    click FE2 "https://github.com/sanketgreathire/greathire/tree/main/frontend/src/components/"
    click FE3 "https://github.com/sanketgreathire/greathire/tree/main/frontend/src/pages/"
    click FE4 "https://github.com/sanketgreathire/greathire/tree/main/frontend/src/redux/"
    click FE5 "https://github.com/sanketgreathire/greathire/tree/main/frontend/src/context/"
    click BE0 "https://github.com/sanketgreathire/greathire/tree/main/BackEnd/"
    click BE1 "https://github.com/sanketgreathire/greathire/tree/main/BackEnd/routes/"
    click BE2 "https://github.com/sanketgreathire/greathire/tree/main/BackEnd/middlewares/"
    click BE3 "https://github.com/sanketgreathire/greathire/tree/main/BackEnd/controllers/"
    click BE4 "https://github.com/sanketgreathire/greathire/tree/main/BackEnd/models/"
    click BE5 "https://github.com/sanketgreathire/greathire/tree/main/BackEnd/utils/"

    classDef frontend fill:#a9def9,stroke:#333,stroke-width:2px;
    classDef backend fill:#caffbf,stroke:#333,stroke-width:2px;
    classDef utilities fill:#fff5ba,stroke:#333,stroke-width:2px;
    classDef db fill:#d3d3d3,stroke:#333,stroke-width:2px;
```
