# fxprima/applytracker architecture

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

- Interactive diagram: https://gitdiagram.com/fxprima/applytracker
- Repository: https://github.com/fxprima/applytracker

## Overview

##### Main Components
a. Client (Frontend) – Located under the "client" directory, this part is built in React. It comprises pages, routing components (e.g., ProtectedRoute for authenticated access), form components (for dynamic login, registration, and other interactions), and API communication through Axios (axiosConfig.js).
b. Server (Backend) – Found inside the "server" directory, the backend uses Node.js and Express. It includes:
- Configuration files (config/config.json) for environment-specific settings (i.e., database connection details).
- Middleware (AuthMiddleware.js) for handling JWT authentication.
- Models (Applications, Statuses, Users) for mapping database entities.
- Routes (Applications.js, Statuses.js, Users.js) providing RESTful endpoints.
d. Environment Configuration – Both the client and server use .env and .env.example files to set environment variables (e.g., JWT_SECRET, PORT).

##### Relationships and Interactions
a. The Client sends HTTP requests (using Axios) to the Server endpoints.
b. The Server processes these requests via Express routes. In tasks related to user actions (add/edit/delete applications), it enforces JWT-based authentication via middleware.
c. The Server interacts with the MySQL database through models (such as Applications.js, Statuses.js, and Users.js) to perform CRUD operations.
d. Configuration files and environment variables tie together the deployment and local development concerns.

##### Architectural Patterns
a. Separation of Concerns: The distinct separation between the client (user interface and client-side logic) and the server (business logic, data handling, authentication).
b. MVC-like Pattern on the Server: With separate directories for routes (controllers), models, and middleware.
c. API-Driven Communication: The client communicates with the server through well-defined RESTful APIs.
d. Security via JWT Authentication: The use of AuthMiddleware and JWT tokens to manage secure interactions.

##### Relevant Technologies and Frameworks
a. React for building a responsive and dynamic frontend.
b. Node.js and Express for the backend API.
c. MySQL for persistent data storage.
d. JWT for managing secure user authentication.
e. Axios for handling HTTP requests on the frontend.

##### Detailing Essential Architectural Elements
a. Don’t overcomplicate—the goal is to capture the clear separation and interaction flows.
b. Notes on how environment configurations (like .env files and config.json) are used during deployment and development.
c. Application’s security flow by highlighting how requests are filtered through AuthMiddleware with JWT verification before accessing sensitive routes or database operations.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend (React Client)"
        F1("React Client"):::frontend
        F2("Axios API Configuration"):::frontend
        F3("ProtectedRoute Component"):::frontend
        F4("Env Config (.env)"):::config
    end

    subgraph "Backend (Express Server)"
        B1("Express Server"):::backend
        B2("Server Config"):::config
        B3("JWT Authentication Middleware"):::auth
        subgraph "API Routes"
            R1("Applications Route"):::backend
            R2("Statuses Route"):::backend
            R3("Users Route"):::backend
        end
        subgraph "Database Models"
            M1("Applications Model"):::backend
            M2("Statuses Model"):::backend
            M3("Users Model"):::backend
        end
    end

    DB("MySQL Database"):::database

    %% Relationships
    F1 -->|"API_Calls(HTTP/REST)"| B1
    B1 -->|"loads"| B2
    B1 -->|"verifies"| B3
    B1 -->|"routes_to"| R1
    B1 -->|"routes_to"| R2
    B1 -->|"routes_to"| R3
    R1 -->|"uses"| M1
    R2 -->|"uses"| M2
    R3 -->|"uses"| M3
    M1 -->|"CRUD_Operations"| DB
    M2 -->|"CRUD_Operations"| DB
    M3 -->|"CRUD_Operations"| DB

    %% Click Events
    click F1 "https://github.com/fxprima/applytracker/tree/master/client"
    click F2 "https://github.com/fxprima/applytracker/blob/master/client/src/api/axiosConfig.js"
    click F3 "https://github.com/fxprima/applytracker/blob/master/client/src/components/routes/ProtectedRoute.jsx"
    click F4 "https://github.com/fxprima/applytracker/blob/master/client/.env.example"
    click B1 "https://github.com/fxprima/applytracker/blob/master/server/index.js"
    click B2 "https://github.com/fxprima/applytracker/blob/master/server/config/config.json"
    click B3 "https://github.com/fxprima/applytracker/blob/master/server/middlewares/AuthMiddleware.js"
    click R1 "https://github.com/fxprima/applytracker/blob/master/server/routes/Applications.js"
    click R2 "https://github.com/fxprima/applytracker/blob/master/server/routes/Statuses.js"
    click R3 "https://github.com/fxprima/applytracker/blob/master/server/routes/Users.js"
    click M1 "https://github.com/fxprima/applytracker/blob/master/server/models/Applications.js"
    click M2 "https://github.com/fxprima/applytracker/blob/master/server/models/Statuses.js"
    click M3 "https://github.com/fxprima/applytracker/blob/master/server/models/Users.js"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef backend fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef config fill:#FFB6C1,stroke:#000,stroke-width:2px;
    classDef auth fill:#FFD700,stroke:#000,stroke-width:2px;
    classDef database fill:#F4A460,stroke:#000,stroke-width:2px;
```
