# viralone/smartcommute architecture

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

- Interactive diagram: https://gitdiagram.com/viralone/smartcommute
- Repository: https://github.com/viralone/smartcommute

## Overview

##### Project type and purpose
- From the file tree and README, this is a single-page, static web application (“Bus LiveMap”) whose sole job is to display real-time bus locations on a map in the user’s browser.
- No custom backend code is present; instead it fetches data from an external “Bus API” and uses Leaflet (map rendering) and Bulma (CSS).

##### File structure
- Top-level files:
- Dockerfile & docker-compose.yaml – containerize the static site (likely serving via nginx).
- index.html – entry point.
- css/style.css – custom styling.
- js/functions.js – all application logic (map setup, API calls, UI interactions).
- .github/workflows/deploy_changes.yaml – CI/CD pipeline.
- No “src/backend” or database directories, confirming it’s purely a front-end deliverable.

##### README for additional insights
- Describes Leaflet & Bulma usage.
- Explains the app fetches bus locations from an external Bus API.
- Documents Docker build & run steps.
- Lists map features (follow bus, show stops, recent buses).

##### Detail without over-splitting
- You don’t need microservices or deep infrastructure layers here.
- Three runtime actors (Browser, Static Server, External APIs) plus CI/CD.
- This level of separation fully conveys how data flows and where responsibilities lie.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Client-Side (Browser Runtime)"
        HTML["index.html"]:::frontend
        CSS["css/style.css"]:::frontend
        JS["js/functions.js"]:::frontend
        B["Browser<br>(Leaflet + Bulma + JS)"]:::internal
        HTML --> B
        CSS --> B
        JS --> B
    end

    subgraph "Static File Server"
        DF["Dockerfile"]:::infra
        DC["docker-compose.yaml"]:::infra
        SS["Dockerized Static Host"]:::internal
        DF --> SS
        DC --> SS
        SS --> HTML
        SS --> CSS
        SS --> JS
    end

    subgraph "CI/CD Pipeline"
        CI[".github/workflows/deploy_changes.yaml"]:::infra
        CI -->|"triggers build/deploy"| SS
    end

    subgraph "External Services"
        BusAPI["Bus API"]:::external
        Tile["Map Tile Service"]:::external
    end

    B -->|"HTTP GET /bus-locations"| BusAPI
    BusAPI -->|"JSON data"| B
    B -->|"Tile requests"| Tile

    click HTML "https://github.com/viralone/smartcommute/blob/master/index.html"
    click CSS "https://github.com/viralone/smartcommute/blob/master/css/style.css"
    click JS "https://github.com/viralone/smartcommute/blob/master/js/functions.js"
    click DF "https://github.com/viralone/smartcommute/tree/master/Dockerfile"
    click DC "https://github.com/viralone/smartcommute/blob/master/docker-compose.yaml"
    click CI "https://github.com/viralone/smartcommute/blob/master/.github/workflows/deploy_changes.yaml"

    classDef frontend fill:#5e81ac,stroke:#4c566a,color:#eceff4;
    classDef internal fill:#81a1c1,stroke:#5e81ac,color:#2e3440;
    classDef infra fill:#88c0d0,stroke:#4c566a,color:#2e3440;
    classDef external fill:#a3be8c,stroke:#4c566a,color:#2e3440;
```
