# amansatya/pulse-roadway-insight architecture

> Architecture diagram of the GitHub repository amansatya/pulse-roadway-insight, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/amansatya/pulse-roadway-insight
- Repository: https://github.com/amansatya/pulse-roadway-insight

## Overview

##### Project type and purpose
- This is a single-page, client-side React application scaffolded with Vite, written in TypeScript.
- It consumes data (real-time or batch) for traffic system visualization and control (e.g., JunctionHeatmap, TrafficLight3D, EmergencyAlert, PerformanceChart).
- The repository contains no backend code, so we assume APIs or WebSocket endpoints are provided by an external service (e.g., your traffic-control backend or Lovable’s runtime).

##### File structure
- Top-level files: package.json (dependencies & scripts), vite.config.ts (build & dev server), tailwind.config.ts, tsconfig.json.
- public/: static assets (robots.txt, index.html template).
- src/
- main.tsx: application entry point (mounts React tree)
- index.css + Tailwind styling
- lib/utils.ts: shared utilities (formatting, API clients)
- hooks/: custom React hooks (use-toast, use-mobile)
- pages/: routing targets (Index.tsx = dashboard; NotFound.tsx)
- components/: feature components (ApproachLane, JunctionControl, VideoPlayer, etc.)
- components/ui/: primitive UI building blocks provided by shadcn-ui (buttons, dialogs, form controls, etc.)

##### README for additional insights
- Lists tech stack: Vite, React, TypeScript, Tailwind CSS, shadcn-ui.
- Deployment and editing flow are all managed by the Lovable platform, which provides live preview, commits, and publishing to static hosting or custom domains.

##### Key reminder
- Be exhaustive but not overly granular: capture every major subsystem (Build → Host → Runtime → API) and all internal layering (Pages → Features → UI Primitives).
- Critical configuration (e.g., Tailwind config, Vite plugins).

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Development & Build
    subgraph "Development & Build" 
        direction TB
        VITE_CFG["vite.config.ts"]:::infra
        TSCONFIG["tsconfig.json / tsconfig.*.json"]:::infra
        PKG_JSON["package.json / package-lock.json / bun.lockb"]:::infra
        TAILWIND_CFG["tailwind.config.ts"]:::infra
        POSTCSS_CFG["postcss.config.js"]:::infra
        VITE_CFG -->|"configures"| VITE["Vite Build"]:::infra
        TSCONFIG -->|"typing & paths"| VITE
        PKG_JSON -->|"scripts & deps"| VITE
        TAILWIND_CFG -->|"styles config"| VITE
        POSTCSS_CFG -->|"postcss config"| VITE
        VITE -->|"npm run build"| BUNDLE["JS/CSS Bundle"]:::infra
    end

    %% Hosting & CDN
    subgraph "Hosting & CDN" 
        direction TB
        HOST["Static Hosting / CDN"]:::infra
        BUNDLE -->|"deploys"| HOST
        PUBLIC_HTML["public/index.html"]:::infra
        PUBLIC_ROBOTS["public/robots.txt"]:::infra
        PUBLIC_HTML --> HOST
        PUBLIC_ROBOTS --> HOST
    end

    %% Runtime in Browser
    subgraph "Browser Runtime" 
        direction TB
        ENTRY["src/main.tsx"]:::frontend
        STYLES["Global Styles\n(src/index.css)"]:::frontend
        ENTRY --> STYLES
        ENTRY --> APP["src/App.tsx"]:::frontend
        APP --> PAGES["Pages"]:::frontend
        APP --> FEATURES["Feature Components"]:::frontend
        APP --> UI["UI Primitives"]:::frontend
        APP --> UTILS["src/lib/utils.ts"]:::frontend
        APP --> HOOKS["Custom Hooks"]:::frontend

        subgraph "Pages"
            direction TB
            DASH["Dashboard\n(src/pages/Index.tsx)"]:::frontend
            NOTFOUND["404 Page\n(src/pages/NotFound.tsx)"]:::frontend
        end
        subgraph "Feature Components"
            direction TB
            JHEAT["JunctionHeatmap\n(src/components/JunctionHeatmap.tsx)"]:::frontend
            TL3D["TrafficLight3D\n(src/components/TrafficLight3D.tsx)"]:::frontend
            EALERT["EmergencyAlert\n(src/components/EmergencyAlert.tsx)"]:::frontend
            PCHART["PerformanceChart\n(src/components/PerformanceChart.tsx)"]:::frontend
            SANALYTICS["SystemAnalytics\n(src/components/SystemAnalytics.tsx)"]:::frontend
            APPLANE["ApproachLane\n(src/components/ApproachLane.tsx)"]:::frontend
            JCTRL["JunctionControl\n(src/components/JunctionControl.tsx)"]:::frontend
            VPLAYER["VideoPlayer\n(src/components/VideoPlayer.tsx)"]:::frontend
            NMODAL["NotificationModal\n(src/components/NotificationModal.tsx)"]:::frontend
            SMODAL["SettingsModal\n(src/components/SettingsModal.tsx)"]:::frontend
            PDROP["ProfileDropdown\n(src/components/ProfileDropdown.tsx)"]:::frontend
        end
        subgraph "UI Primitives (shadcn-ui)"
            direction TB
            BTN["Button\n(src/components/ui/button.tsx)"]:::frontend
            DLG["Dialog\n(src/components/ui/dialog.tsx)"]:::frontend
            ALTDLG["AlertDialog\n(src/components/ui/alert-dialog.tsx)"]:::frontend
            INPUT["Input\n(src/components/ui/input.tsx)"]:::frontend
            SELECT["Select\n(src/components/ui/select.tsx)"]:::frontend
            TOAST["Toast\n(src/components/ui/toast.tsx)"]:::frontend
            TOASTER["Toaster\n(src/components/ui/toaster.tsx)"]:::frontend
        end
        subgraph "Custom Hooks"
            direction TB
            UTOAST["use-toast\n(src/hooks/use-toast.ts)"]:::frontend
            UMOBILE["use-mobile\n(src/hooks/use-mobile.tsx)"]:::frontend
        end

        %% Relationships in runtime
        APP -->|renders| DASH
        APP -->|renders| NOTFOUND
        DASH -->|uses| JHEAT
        DASH -->|uses| TL3D
        DASH -->|uses| EALERT
        DASH -->|uses| PCHART
        SANALYTICS -->|uses util| UTILS
        FEATURE_EVENTS["User Actions"]:::frontend
        FEATURE_EVENTS -->|triggers| UTILS
        FEATURE_EVENTS -->|triggers| EXAPI
        JHEAT -->|UI| BTN
        JHEAT -->|UI| INPUT
        EALERT -->|UI| ALTDLG
        VPLAYER -->|UI| TOASTER
        JHEAT -->|hooks| UTOAST
        TL3D -->|hooks| UMOBILE
    end

    %% External Backend
    EXAPI["External Traffic API\n(WebSocket / REST)"]:::external

    %% Flows
    HOST -->|"serves index.html & bundle"| ENTRY
    ENTRY -->|"connects to"| EXAPI
    ENTRY -->|"fetches GET /traffic"| EXAPI
    ENTRY -->|"subscribes WS"| EXAPI

    %% Click Events
    click ENTRY "https://github.com/amansatya/pulse-roadway-insight/blob/main/src/main.tsx"
    click STYLES "https://github.com/amansatya/pulse-roadway-insight/blob/main/src/index.css"
    click PKG_JSON "https://github.com/amansatya/pulse-roadway-insight/blob/main/package.json"
    click VITE_CFG "https://github.com/amansatya/pulse-roadway-insight/blob/main/vite.config.ts"
    click TSCONFIG "https://github.com/amansatya/pulse-roadway-insight/blob/main/tsconfig.json"
    click TAILWIND_CFG "https://github.com/amansatya/pulse-roadway-insight/blob/main/tailwind.config.ts"
    click POSTCSS_CFG "https://github.com/amansatya/pulse-roadway-insight/blob/main/postcss.config.js"
    click PUBLIC_HTML "https://github.com/amansatya/pulse-roadway-insight/blob/main/index.html"
    click PUBLIC_ROBOTS "https://github.com/amansatya/pulse-roadway-insight/blob/main/public/robots.txt"

    click UTILS "https://github.com/amansatya/pulse-roadway-insight/blob/main/src/lib/utils.ts"
    click UTOAST "https://github.com/amansatya/pulse-roadway-insight/blob/main/src/hooks/use-toast.ts"
    click UMOBILE "https://github.com/amansatya/pulse-roadway-insight/blob/main/src/hooks/use-mobile.tsx"

    click DASH "https://github.com/amansatya/pulse-roadway-insight/blob/main/src/pages/Index.tsx"
    click NOTFOUND "https://github.com/amansatya/pulse-roadway-insight/blob/main/src/pages/NotFound.tsx"

    click JHEAT "https://github.com/amansatya/pulse-roadway-insight/blob/main/src/components/JunctionHeatmap.tsx"
    click TL3D "https://github.com/amansatya/pulse-roadway-insight/blob/main/src/components/TrafficLight3D.tsx"
    click EALERT "https://github.com/amansatya/pulse-roadway-insight/blob/main/src/components/EmergencyAlert.tsx"
    click PCHART "https://github.com/amansatya/pulse-roadway-insight/blob/main/src/components/PerformanceChart.tsx"
    click SANALYTICS "https://github.com/amansatya/pulse-roadway-insight/blob/main/src/components/SystemAnalytics.tsx"
    click APPLANE "https://github.com/amansatya/pulse-roadway-insight/blob/main/src/components/ApproachLane.tsx"
    click JCTRL "https://github.com/amansatya/pulse-roadway-insight/blob/main/src/components/JunctionControl.tsx"
    click VPLAYER "https://github.com/amansatya/pulse-roadway-insight/blob/main/src/components/VideoPlayer.tsx"
    click NMODAL "https://github.com/amansatya/pulse-roadway-insight/blob/main/src/components/NotificationModal.tsx"
    click SMODAL "https://github.com/amansatya/pulse-roadway-insight/blob/main/src/components/SettingsModal.tsx"
    click PDROP "https://github.com/amansatya/pulse-roadway-insight/blob/main/src/components/ProfileDropdown.tsx"

    click BTN "https://github.com/amansatya/pulse-roadway-insight/blob/main/src/components/ui/button.tsx"
    click DLG "https://github.com/amansatya/pulse-roadway-insight/blob/main/src/components/ui/dialog.tsx"
    click ALTDLG "https://github.com/amansatya/pulse-roadway-insight/blob/main/src/components/ui/alert-dialog.tsx"
    click INPUT "https://github.com/amansatya/pulse-roadway-insight/blob/main/src/components/ui/input.tsx"
    click SELECT "https://github.com/amansatya/pulse-roadway-insight/blob/main/src/components/ui/select.tsx"
    click TOAST "https://github.com/amansatya/pulse-roadway-insight/blob/main/src/components/ui/toast.tsx"
    click TOASTER "https://github.com/amansatya/pulse-roadway-insight/blob/main/src/components/ui/toaster.tsx"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366D6,stroke-width:1px
    classDef infra fill:#E6F4EA,stroke:#22863A,stroke-width:1px
    classDef external fill:#FFF5E5,stroke:#D93F0B,stroke-width:1px
```
