# harshitpg/mfc-recruitment-portal-be architecture

> Architecture diagram of the GitHub repository harshitpg/mfc-recruitment-portal-be, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/harshitpg/mfc-recruitment-portal-be
- Repository: https://github.com/harshitpg/mfc-recruitment-portal-be

## Overview

##### Main Components

A. Client Layer
- External clients (Recruitment Portal Frontend)
- Connection through HTTP/REST APIs

B. API Gateway Layer
- Express.js Server
- Rate Limiting Middleware
- Authentication/Authorization Middleware

C. Core Application Layer
- Controllers (Auth, Admin, Task, User, Status)
- Routes
- Middleware
- Utils (Email Services)

D. Data Layer
- MongoDB Database
- Models (User, VerificationModel, DesignTask, TechTask, Management)

##### Component Relationships

- Client → API Gateway (HTTP/REST)
- API Gateway → Core Application Layer (Internal routing)
- Core Application Layer → Data Layer (Database operations)
- Core Application Layer → External Services (Email service)

##### Detailed Component Breakdown

- Token Validation
- Admin Validation
- Domain Validation
- File Validation
- Rate Limiting
- Verification Validation

- Auth Controller (User authentication, verification)
- Admin Controller (User management)
- Task Controller (Submission handling)
- User Controller (Profile management)
- Status Controller (Progress tracking)

- User Model
- Verification Model
- Design Task Model
- Tech Task Model
- Management Model

##### Special Features to Highlight

- Email Verification Flow
- File Upload System
- Domain Selection Process
- Admin Promotion System
- Task Submission Control

##### Additional Elements

- Security Layer (showing token-based authentication)
- Email Service Integration (NodeMailer)
- File Upload Flow (Multer)
- Domain-specific Task Management

**[Client Layer]**
- ↓
**[API Gateway/Security]**
- ↓
**[Middleware Layer]**
- ↓
**[Controllers/Business Logic]**
- ↓
**[Data Access Layer]**
- ↓
**[Database]**

A side panel showing external services (Email) and utilities.

Important Notes for the Engineer:
- Keep the authentication flow prominent as it's a crucial security feature
- Task submission workflow as it's a core functionality
- Clear separation between admin and user functionalities
- Database relationships between models
- Adding a small zoom-in view of the task submission process as it's a critical feature

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef client fill:#f9f,stroke:#333,stroke-width:2px
    classDef gateway fill:#87CEEB,stroke:#333,stroke-width:2px
    classDef middleware fill:#FFE4B5,stroke:#333,stroke-width:2px
    classDef controller fill:#98FB98,stroke:#333,stroke-width:2px
    classDef database fill:#DDA0DD,stroke:#333,stroke-width:2px
    classDef service fill:#FFA07A,stroke:#333,stroke-width:2px
    classDef route fill:#87CEEB,stroke:#333,stroke-width:2px

    %% Client Layer
    Client["Client Application"]:::client

    %% API Gateway
    Gateway["Express Server"]:::gateway
    click Gateway "https://github.com/HarshitPG/MFC-Recruitment-Portal-BE/blob/main/index.js"

    %% Middleware Layer
    subgraph Middleware
        RateLimit["Rate Limiter"]:::middleware
        TokenAuth["Token Validation"]:::middleware
        AdminVal["Admin Validation"]:::middleware
        DomainVal["Domain Validation"]:::middleware
        FileVal["File Validation"]:::middleware
        VerifyVal["Verification Validation"]:::middleware
    end
    click RateLimit "https://github.com/HarshitPG/MFC-Recruitment-Portal-BE/blob/main/api/middleware/ratelimiter.js"
    click TokenAuth "https://github.com/HarshitPG/MFC-Recruitment-Portal-BE/blob/main/api/middleware/validateTokenHandler.js"
    click AdminVal "https://github.com/HarshitPG/MFC-Recruitment-Portal-BE/blob/main/api/middleware/validateAdmin.js"
    click DomainVal "https://github.com/HarshitPG/MFC-Recruitment-Portal-BE/blob/main/api/middleware/validateDomain.js"
    click FileVal "https://github.com/HarshitPG/MFC-Recruitment-Portal-BE/blob/main/api/middleware/validateFile.js"
    click VerifyVal "https://github.com/HarshitPG/MFC-Recruitment-Portal-BE/blob/main/api/middleware/validateVerify.js"

    %% Routes Layer
    subgraph Routes
        AuthRoute["Auth Routes"]:::route
        AdminRoute["Admin Routes"]:::route
        TaskRoute["Task Routes"]:::route
        UserRoute["User Routes"]:::route
        StatusRoute["Status Routes"]:::route
    end
    click AuthRoute "https://github.com/HarshitPG/MFC-Recruitment-Portal-BE/blob/main/api/routes/authRoute.js"
    click AdminRoute "https://github.com/HarshitPG/MFC-Recruitment-Portal-BE/blob/main/api/routes/adminRoute.js"
    click TaskRoute "https://github.com/HarshitPG/MFC-Recruitment-Portal-BE/blob/main/api/routes/taskRoute.js"
    click UserRoute "https://github.com/HarshitPG/MFC-Recruitment-Portal-BE/blob/main/api/routes/userRoute.js"
    click StatusRoute "https://github.com/HarshitPG/MFC-Recruitment-Portal-BE/blob/main/api/routes/statusRoute.js"

    %% Controllers Layer
    subgraph Controllers
        AuthCtrl["Auth Controller"]:::controller
        AdminCtrl["Admin Controller"]:::controller
        TaskCtrl["Task Controller"]:::controller
        UserCtrl["User Controller"]:::controller
        StatusCtrl["Status Controller"]:::controller
    end
    click AuthCtrl "https://github.com/HarshitPG/MFC-Recruitment-Portal-BE/blob/main/api/controllers/authController.js"
    click AdminCtrl "https://github.com/HarshitPG/MFC-Recruitment-Portal-BE/blob/main/api/controllers/adminController.js"
    click TaskCtrl "https://github.com/HarshitPG/MFC-Recruitment-Portal-BE/blob/main/api/controllers/taskController.js"
    click UserCtrl "https://github.com/HarshitPG/MFC-Recruitment-Portal-BE/blob/main/api/controllers/userController.js"
    click StatusCtrl "https://github.com/HarshitPG/MFC-Recruitment-Portal-BE/blob/main/api/controllers/statusController.js"

    %% Database Layer
    DB[(MongoDB)]:::database
    click DB "https://github.com/HarshitPG/MFC-Recruitment-Portal-BE/blob/main/api/db/dbConnection.js"

    subgraph Models
        UserModel["User Model"]:::database
        VerifyModel["Verification Model"]:::database
        DesignModel["Design Task Model"]:::database
        TechModel["Tech Task Model"]:::database
        MgmtModel["Management Model"]:::database
    end
    click UserModel "https://github.com/HarshitPG/MFC-Recruitment-Portal-BE/blob/main/api/models/userModel.js"
    click VerifyModel "https://github.com/HarshitPG/MFC-Recruitment-Portal-BE/blob/main/api/models/verificationModel.js"
    click DesignModel "https://github.com/HarshitPG/MFC-Recruitment-Portal-BE/blob/main/api/models/designTaskModel.js"
    click TechModel "https://github.com/HarshitPG/MFC-Recruitment-Portal-BE/blob/main/api/models/techTaskModel.js"
    click MgmtModel "https://github.com/HarshitPG/MFC-Recruitment-Portal-BE/blob/main/api/models/managementModel.js"

    %% Email Services
    subgraph EmailServices
        MailTransport["Mail Transporter"]:::service
        VerifSender["Verification Sender"]:::service
        PassVerif["Password Verification"]:::service
    end
    click MailTransport "https://github.com/HarshitPG/MFC-Recruitment-Portal-BE/blob/main/api/utils/mailTransporter.js"
    click VerifSender "https://github.com/HarshitPG/MFC-Recruitment-Portal-BE/blob/main/api/utils/sendverification.js"
    click PassVerif "https://github.com/HarshitPG/MFC-Recruitment-Portal-BE/blob/main/api/utils/sendVerificationPassword.js"

    %% Connections
    Client --> Gateway
    Gateway --> Middleware
    Middleware --> Routes
    Routes --> Controllers
    Controllers --> Models
    Models --> DB
    Controllers --> EmailServices

    %% Legend
    subgraph Legend
        L1["Client Layer"]:::client
        L2["Gateway/Routes"]:::gateway
        L3["Middleware"]:::middleware
        L4["Controllers"]:::controller
        L5["Database"]:::database
        L6["Services"]:::service
    end
```
