# mahirshahriar1/cse-299-nsu-cpc architecture

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

- Interactive diagram: https://gitdiagram.com/mahirshahriar1/cse-299-nsu-cpc
- Repository: https://github.com/mahirshahriar1/cse-299-nsu-cpc

## Overview

##### Main Components
- Front-End Client:
- Components: Break down major UI parts such as landing pages, authentication (login, registration), dashboards (user, corporate, and admin), job listings, and CV processing pages.
- Routing & State Management: Show the role of React Router (or any routing system in use) and how contexts (like StepperContext and UserContext) are used.
- Styling: Label integration with modern styling libraries (Tailwind CSS & DaisyUI) and configuration files (postcss.config.js, tailwind.config.js).

- Back-End Server:
- Express.js Application: Highlight how the entry point (backend/index.js) coordinates the Express server.
- Controllers: A set of controllers handling various domain actions (admin, corporate, job applications, CV handling, and user management).
- Middlewares: Indicate error handling and access control with specific middlewares (adminMiddleware, corporateMiddleware, errorMiddleware).
- Routes: Show how different routers (adminRoutes, authRoutes, corporateRoutes, etc.) correspond to the REST API endpoints.
- Models: Display the Mongoose models (adminModel, alumniModel, appliedJobsModel, corporateModel, cvModel, jobModel, studentModel, userModel) that interact with MongoDB.
- Utilities: Include generation of tokens (JWT) and Passport integration from backend/utils.

- Database:
- MongoDB: Point out where the connection is configured (backend/config/db.js) and note that it supports flexible schema for various entities.

- External Services:
- Firebase Cloud Storage: Emphasize its role in handling file uploads (CVs and profile images).
- Authentication: Google Sign-In integrated with JWT for secure authentication.

##### Relationships and Interactions
- That the back-end processes incoming requests via controllers, applies business logic using middlewares, and interacts with MongoDB through models.
- That the back-end also communicates with Firebase for file storage.
- For deployment, include the environment management (.env files for both front-end and back-end) and a note of Railway as the hosting platform.

##### Architectural Patterns & Design Principles
- MVC-Like Structure: Explain that the back-end follows a pattern where routes invoke controllers which then interact with models.
- Separation of Concerns: Differentiate clearly between front-end and back-end concerns, ensuring a clean API boundary.
- Security and Middleware Usage: Highlight the integration of JWT, Google authentication, and security-focused middleware.
- Component-Based Front-End: Indicate that the React architecture is modular, with components managing specific UI pieces.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User
    User("User"):::external

    %% React Front-End Subgraph
    subgraph "React Front-End"
        FE_UI("UI Components"):::frontend
        FE_Routes("React Routing"):::frontend
        FE_Contexts("React Contexts"):::frontend
        FE_Tailwind("Tailwind Config"):::frontend
        FE_PostCSS("PostCSS Config"):::frontend
        FE_Firebase("Firebase Integration"):::frontend
    end

    %% Express Back-End Subgraph
    subgraph "Express Back-End"
        BE_Entry("Express Entry Point"):::backend
        BE_Controllers("Controllers"):::backend
        BE_Middlewares("Middlewares"):::backend
        BE_Routes("Routes"):::backend
        BE_Models("Models"):::backend
        BE_Utilities("Utilities"):::backend
    end

    %% Database and External Services
    DB("MongoDB Database"):::database
    Firebase("Firebase Storage"):::external
    Auth("Google Sign-In & JWT"):::external
    Deploy("Railway & Environment"):::deployment

    %% Connections
    User -->|"access"| FE_UI
    FE_UI -->|"API_Calls"| BE_Entry
    FE_Routes -->|"Routes"| BE_Routes
    BE_Entry -->|"Invokes"| BE_Controllers
    BE_Entry -->|"Applies"| BE_Middlewares
    BE_Controllers -->|"Reads/Writes"| DB
    BE_Controllers -->|"Uploads_Files"| Firebase
    BE_Entry -- "Auth_Flows" --> Auth
    BE_Utilities -->|"Token_Generation"| Auth
    Auth -->|"Sends_Token"| FE_Contexts
    Deploy --- FE_UI
    Deploy --- BE_Entry
    Deploy --- DB

    %% Styles
    classDef frontend fill:#e0f7fa,stroke:#006064,stroke-width:2px;
    classDef backend fill:#ffecb3,stroke:#ff9800,stroke-width:2px;
    classDef database fill:#c8e6c9,stroke:#388e3c,stroke-width:2px;
    classDef external fill:#fce4ec,stroke:#d81b60,stroke-width:2px;
    classDef deployment fill:#d1c4e9,stroke:#673ab7,stroke-width:2px;

    %% Click Events
    click FE_UI "https://github.com/mahirshahriar1/cse-299-nsu-cpc/tree/main/frontend/src/Components"
    click FE_Routes "https://github.com/mahirshahriar1/cse-299-nsu-cpc/blob/main/frontend/src/routes.js"
    click FE_Contexts "https://github.com/mahirshahriar1/cse-299-nsu-cpc/tree/main/frontend/src/contexts"
    click FE_Tailwind "https://github.com/mahirshahriar1/cse-299-nsu-cpc/blob/main/frontend/tailwind.config.js"
    click FE_PostCSS "https://github.com/mahirshahriar1/cse-299-nsu-cpc/blob/main/frontend/postcss.config.js"
    click FE_Firebase "https://github.com/mahirshahriar1/cse-299-nsu-cpc/blob/main/frontend/src/firebase.js"
    click BE_Entry "https://github.com/mahirshahriar1/cse-299-nsu-cpc/blob/main/backend/index.js"
    click BE_Controllers "https://github.com/mahirshahriar1/cse-299-nsu-cpc/tree/main/backend/controllers"
    click BE_Middlewares "https://github.com/mahirshahriar1/cse-299-nsu-cpc/tree/main/backend/middlewares"
    click BE_Routes "https://github.com/mahirshahriar1/cse-299-nsu-cpc/tree/main/backend/routes"
    click BE_Models "https://github.com/mahirshahriar1/cse-299-nsu-cpc/tree/main/backend/models"
    click BE_Utilities "https://github.com/mahirshahriar1/cse-299-nsu-cpc/tree/main/backend/utils"
    click DB "https://github.com/mahirshahriar1/cse-299-nsu-cpc/blob/main/backend/config/db.js"
```
