# vipulchaudhary16/application-tracker architecture

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

- Interactive diagram: https://gitdiagram.com/vipulchaudhary16/application-tracker
- Repository: https://github.com/vipulchaudhary16/application-tracker

## Overview

##### Main Components
- Client (Frontend):
- Built with ReactJS and CSS.
- Contains the user interface, including components like Welcome, Loader, Alert, Add Application, and Profile.
- Uses Context API for state management across alerts, applications, UI controls, and user details.
- Uses utilities like Firebase (likely for authentication or other integrations).
- Includes a public folder that houses static assets (HTML, manifest, etc.).

- Server (Backend):
- Built using NodeJS.
- Organized into controllers (Applications, Auth, Mailing), which handle the business logic.
- Contains models for Application, Otp, and User – these abstract the MongoDB collections.
- Routes separate the API endpoints for applications and authentication.
- Middleware (e.g., verifyUser) manages access control and request validations.
- A configuration file (config.js) indicates configurable parameters which could include database connections and authentication keys.

- Database:
- Although MongoDB is not explicitly shown in the file structure, the README indicates it is used to store job applications and user data.

- External Services:
- Firebase (utility in client/src/utils/Firebase.js) may handle additional authentication or push notifications.
- Mailing services are handled by a dedicated controller (Mailing.js).

##### Relationships and Interactions
- The Client interacts with the Server via HTTP requests (API calls) which are routed to the appropriate route handlers.
- The Server uses controllers to process incoming requests, perform business logic, and interact with the database through defined models.
- The verifyUser middleware ensures that routes are accessed only by authenticated users.
- Data flows from the Server (after handling logic) back to the Client, updating the UI via React’s component states.
- External services (like Firebase and mailing) interact with the backend or client as needed to support additional features (authentication, notifications, etc.).

##### Important Architectural Patterns and Design Principles
- MVC-like Pattern on the Server: With models (data schema), controllers (business logic), and routes (API endpoints).
- Separation of Concerns: Clearly dividing the frontend and backend functionalities.
- Use of Context API in the Frontend: For global state management across different components.
- JWT-based Authentication: Ensuring secure access to protected APIs.
- Modularity: The client and server directories are separate, allowing independent management and potential deployment.

- For the Server, explicitly note components like:
- Controllers (Applications, Auth, Mailing).
- Models (Application, Otp, User).
- Middleware (verifyUser).
- Routes (Application.js, Auth.js).
- Another for backend components.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Section
    subgraph "Client (Frontend)"
        direction TB
        Client_React["ReactJS UI Components"]:::frontend
        Client_Context["Context API (State Management)"]:::frontend
        Firebase_Utils["Firebase Integration"]:::frontend
        Public_Assets["Static Assets"]:::frontend
    end

    %% Backend Section
    subgraph "Server (Backend)"
        direction TB
        Server_Config["Configuration (config.js)"]:::backend
        Server_Middleware["verifyUser Middleware"]:::backend
        
        subgraph "Controllers"
            direction TB
            Controller_App["Applications Controller"]:::backend
            Controller_Auth["Authentication Controller"]:::backend
            Controller_Mailing["Mailing Controller"]:::backend
        end

        subgraph "Models"
            direction TB
            Model_Application["Application Model"]:::backend
            Model_Otp["OTP Model"]:::backend
            Model_User["User Model"]:::backend
        end

        subgraph "Routes"
            direction TB
            Route_App["Application Routes"]:::backend
            Route_Auth["Authentication Routes"]:::backend
        end
    end

    %% Database Section
    subgraph "Database"
        direction TB
        Database["MongoDB Database"]:::database
    end

    %% External Services Section
    subgraph "External Services"
        direction TB
        External_Firebase["Firebase Service"]:::external
        External_Mailing["Mailing Service"]:::external
    end

    %% Connections: Client to Server
    Client_React -->|"APIcalls"| Route_App
    Client_React -->|"APIcalls"| Route_Auth
    Client_Context -->|"Updates/UI"| Client_React
    Firebase_Utils -->|"IntegratesWith"| External_Firebase

    %% Server Routes to Middleware and Controllers
    Route_App -->|"authCheck"| Server_Middleware
    Route_Auth -->|"authCheck"| Server_Middleware
    Server_Middleware -->|"proceedsTo"| Controller_App
    Server_Middleware -->|"proceedsTo"| Controller_Auth

    %% Controllers to Models and External Services
    Controller_App -->|"uses"| Model_Application
    Controller_Auth -->|"uses"| Model_User
    Controller_Auth -->|"validates"| Model_Otp
    Controller_Mailing -->|"triggers"| External_Mailing

    %% Models to Database
    Model_Application -->|"reads/writes"| Database
    Model_Otp -->|"reads/writes"| Database
    Model_User -->|"reads/writes"| Database

    %% Click Events for Frontend Components
    click Client_React "https://github.com/vipulchaudhary16/application-tracker/tree/master/client/src/components"
    click Client_Context "https://github.com/vipulchaudhary16/application-tracker/tree/master/client/src/context"
    click Firebase_Utils "https://github.com/vipulchaudhary16/application-tracker/blob/master/client/src/utils/Firebase.js"
    click Public_Assets "https://github.com/vipulchaudhary16/application-tracker/tree/master/client/public"

    %% Click Events for Backend Components
    click Server_Config "https://github.com/vipulchaudhary16/application-tracker/blob/master/server/config.js"
    click Server_Middleware "https://github.com/vipulchaudhary16/application-tracker/blob/master/server/middleware/verifyUser.js"
    click Controller_App "https://github.com/vipulchaudhary16/application-tracker/blob/master/server/controller/Applications.js"
    click Controller_Auth "https://github.com/vipulchaudhary16/application-tracker/blob/master/server/controller/Auth.js"
    click Controller_Mailing "https://github.com/vipulchaudhary16/application-tracker/blob/master/server/controller/Mailing.js"
    click Model_Application "https://github.com/vipulchaudhary16/application-tracker/blob/master/server/models/Application.js"
    click Model_Otp "https://github.com/vipulchaudhary16/application-tracker/blob/master/server/models/Otp.js"
    click Model_User "https://github.com/vipulchaudhary16/application-tracker/blob/master/server/models/User.js"
    click Route_App "https://github.com/vipulchaudhary16/application-tracker/blob/master/server/routes/Application.js"
    click Route_Auth "https://github.com/vipulchaudhary16/application-tracker/blob/master/server/routes/Auth.js"

    %% Styles
    classDef frontend fill:#AEDFF7,stroke:#333,stroke-width:2px;
    classDef backend fill:#F7D6AE,stroke:#333,stroke-width:2px;
    classDef database fill:#C2F7C2,stroke:#333,stroke-width:2px;
    classDef external fill:#E1CDEC,stroke:#333,stroke-width:2px;
```
