# steven030397/tdp-project-drive2 architecture

> Architecture diagram of the GitHub repository steven030397/tdp-project-drive2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/steven030397/tdp-project-drive2
- Repository: https://github.com/steven030397/tdp-project-drive2

## Overview

##### Project type and purpose
- This is a full-stack carpool matching platform.
- Purpose: collect user routes and profiles, run matching algorithms in the background, store and serve data, and present UI with embedded data visualizations.

##### File structure
- Top-level folders:
- Frontend – Flask app serving HTML templates and static assets (CSS, JS, images, Tableau embeds)
- Backend – Node.js/Express service exposing data APIs; contains docker-compose, mock-data generators, and tests
- API-Algo – Python/Flask microservice wrapping matching logic and exposing it via HTTP endpoints
- Algorithms – standalone Jupyter notebooks and scripts used offline to prototype/tune matching logic (not part of online service)
- Config/deployment files:
- Backend/compose.yml – orchestrates containers for Frontend, Backend, API-Algo, and MySQL
- requirements.txt & package.json (implied) – declare Python and Node.js dependencies

##### README for additional insights
- Confirms Python 3.11 for Flask services, Node.js for data API, periodic background execution of matching algorithm.
- Database: MySQL hosted on db4free.net. Credentials provided.
- Frontend uses Flask’s routing to serve pages and embed Tableau Cloud dashboards.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        Browser["User Browser"]:::ui
        Fr["Flask UI\n(Frontend Service)"]:::ui
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        direction TB
        Be["Node.js API\n(Backend Service)"]:::backend
        Algo["Python Matching Service\n(Algorithm Service)"]:::backend
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        DB["MySQL DB"]:::data
    end

    %% External Systems
    Tableau["Tableau Cloud"]:::external

    %% Scheduler / Utilities
    subgraph "Utilities & Scheduler"
        direction TB
        Scheduler["Scheduler/Cron"]:::util
        Offline["Offline Algorithm Prototyping"]:::util
        Compose["Docker Compose Orchestration"]:::util
        PythonDeps["Python Dependencies"]:::util
        NodeDeps["Node.js Dependencies"]:::util
        Embedded["Embedded Visualization Assets"]:::util
    end

    %% Connections
    Browser <-->|"HTTP Requests / AJAX"| Fr
    Fr -->|"REST API Calls"| Be
    Fr -->|"Match Requests"| Algo
    Fr -->|"Embedded Dashboards"| Tableau
    Be -->|"SQL Queries"| DB
    Algo -->|"Reads / Writes Data"| DB
    Scheduler -->|"Triggers Matching"| Algo

    %% Click Events
    click Fr "https://github.com/steven030397/tdp-project-drive2/blob/main/Frontend/app.py"
    click Fr "https://github.com/steven030397/tdp-project-drive2/tree/main/Frontend/templates/"
    click Fr "https://github.com/steven030397/tdp-project-drive2/tree/main/Frontend/static/"
    click Be "https://github.com/steven030397/tdp-project-drive2/blob/main/Backend/index.js"
    click Be "https://github.com/steven030397/tdp-project-drive2/tree/main/Backend/data_api/"
    click Be "https://github.com/steven030397/tdp-project-drive2/blob/main/Backend/generateMockData.js"
    click Be "https://github.com/steven030397/tdp-project-drive2/blob/main/Backend/coordinates-generator.py"
    click Be "https://github.com/steven030397/tdp-project-drive2/tree/main/Backend/test/"
    click Be "https://github.com/steven030397/tdp-project-drive2/blob/main/Backend/test-vic-coord.py"
    click Algo "https://github.com/steven030397/tdp-project-drive2/blob/main/API-Algo/app.py"
    click Algo "https://github.com/steven030397/tdp-project-drive2/blob/main/API-Algo/unique.py"
    click Algo "https://github.com/steven030397/tdp-project-drive2/tree/main/API-Algo/templates/"
    click Algo "https://github.com/steven030397/tdp-project-drive2/blob/main/API-Algo/car.csv"
    click Algo "https://github.com/steven030397/tdp-project-drive2/blob/main/API-Algo/car.xlsx"
    click Offline "https://github.com/steven030397/tdp-project-drive2/tree/main/Algorithms/"
    click Compose "https://github.com/steven030397/tdp-project-drive2/blob/main/Backend/compose.yml"
    click PythonDeps "https://github.com/steven030397/tdp-project-drive2/blob/main/requirements.txt"
    click NodeDeps "https://github.com/steven030397/tdp-project-drive2/blob/main/Backend/package.json"
    click NodeDeps "https://github.com/steven030397/tdp-project-drive2/blob/main/Backend/node_modules.sql"
    click NodeDeps "https://github.com/steven030397/tdp-project-drive2/blob/main/Backend/node_modules-steven.sql"
    click Embedded "https://github.com/steven030397/tdp-project-drive2/tree/main/Frontend/static/"

    %% Styles
    classDef ui fill:#adebeb,stroke:#333,stroke-width:1px;
    classDef backend fill:#b2f7ef,stroke:#333,stroke-width:1px;
    classDef data fill:#ffcc99,stroke:#333,stroke-width:1px;
    classDef external fill:#d3d3d3,stroke:#333,stroke-width:1px;
    classDef util fill:#e0bbe4,stroke:#333,stroke-width:1px;
```
