# jtr-0901/student-bus-tracking architecture

> Architecture diagram of the GitHub repository jtr-0901/student-bus-tracking, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jtr-0901/student-bus-tracking
- Repository: https://github.com/jtr-0901/student-bus-tracking

## Overview

BusTrack Pro is a school-bus tracking application for parents, drivers, conductors, and administrators. Users sign in, then use role-specific dashboards: drivers share bus location and can raise SOS alerts; conductors scan student QR codes to record boarding or drop-off; parents view bus status, notifications, and submit feedback; administrators manage school operations and review alerts and feedback. The README documents live GPS, OpenStreetMap, real-time notifications, SOS, driver details, and feedback. Backend internals are represented by the server entry point because its implementation was not excerpted.

Main entry points: [`frontend/src/context/AppContext.jsx`](https://github.com/jtr-0901/student-bus-tracking/blob/main/frontend/src/context/AppContext.jsx) (App state), [`frontend/src/App.jsx`](https://github.com/jtr-0901/student-bus-tracking/blob/main/frontend/src/App.jsx) (Role routing), [`backend/server.js`](https://github.com/jtr-0901/student-bus-tracking/blob/main/backend/server.js) (HTTP API), [`frontend/src/pages/DriverDashboard.jsx`](https://github.com/jtr-0901/student-bus-tracking/blob/main/frontend/src/pages/DriverDashboard.jsx) (Driver dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_app["Role routing<br/>[App.jsx]"]
  node_login["Sign-in<br/>[Login.jsx]"]
  node_context["App state<br/>[AppContext.jsx]"]
  node_navbar["Navigation<br/>[Navbar.jsx]"]
end

subgraph group_tracking["Bus tracking"]
  node_parent["Parent dashboard"]
  node_driver["Driver dashboard"]
  node_map["Live map<br/>[MapView.jsx]"]
end

subgraph group_student["Student safety"]
  node_conductor["Conductor dashboard"]
  node_scanner["QR scanner<br/>[QRScanner.jsx]"]
end

subgraph group_school["School operations"]
  node_admin["Admin dashboard<br/>[AdminDashboard.jsx]"]
  node_notifications["Notification panel"]
end

subgraph group_backend["Backend services"]
  node_api["HTTP API<br/>[server.js]"]
  node_realtime["Socket.IO service<br/>[server.js]"]
end

node_users(("School users"))
node_osm["OpenStreetMap"]

node_users -->|"use"| node_app
node_app -->|"provides state"| node_context
node_app -->|"routes unauthenticated"| node_login
node_app -->|"routes parent"| node_parent
node_app -->|"routes driver"| node_driver
node_app -->|"routes conductor"| node_conductor
node_app -->|"routes admin"| node_admin
node_login -->|"authenticates through"| node_context
node_context -->|"requests auth and alerts"| node_api
node_context -->|"opens socket"| node_realtime
node_navbar -->|"reads user state"| node_context
node_navbar -->|"opens panel"| node_notifications
node_notifications -->|"reads and marks alerts"| node_context
node_parent -->|"reads live state"| node_context
node_parent -->|"loads records and posts feedback"| node_api
node_parent -->|"renders bus location"| node_map
node_map -.->|"renders map tiles"| node_osm
node_driver -->|"reads socket updates"| node_context
node_driver -->|"posts GPS and trip actions"| node_api
node_driver -->|"emits location"| node_realtime
node_driver -->|"renders bus location"| node_map
node_conductor -->|"renders scanner"| node_scanner
node_scanner -->|"returns scan result"| node_conductor
node_conductor -->|"records student scan"| node_api
node_admin -->|"reads bus and alert state"| node_context
node_admin -->|"manages records and SOS"| node_api
node_api -.->|"broadcasts events"| node_realtime

click node_app "https://github.com/jtr-0901/student-bus-tracking/blob/main/frontend/src/App.jsx"
click node_login "https://github.com/jtr-0901/student-bus-tracking/blob/main/frontend/src/pages/Login.jsx"
click node_context "https://github.com/jtr-0901/student-bus-tracking/blob/main/frontend/src/context/AppContext.jsx"
click node_navbar "https://github.com/jtr-0901/student-bus-tracking/blob/main/frontend/src/components/Navbar.jsx"
click node_parent "https://github.com/jtr-0901/student-bus-tracking/blob/main/frontend/src/pages/ParentDashboard.jsx"
click node_driver "https://github.com/jtr-0901/student-bus-tracking/blob/main/frontend/src/pages/DriverDashboard.jsx"
click node_map "https://github.com/jtr-0901/student-bus-tracking/blob/main/frontend/src/components/MapView.jsx"
click node_conductor "https://github.com/jtr-0901/student-bus-tracking/blob/main/frontend/src/pages/ConductorDashboard.jsx"
click node_scanner "https://github.com/jtr-0901/student-bus-tracking/blob/main/frontend/src/components/QRScanner.jsx"
click node_admin "https://github.com/jtr-0901/student-bus-tracking/blob/main/frontend/src/pages/AdminDashboard.jsx"
click node_notifications "https://github.com/jtr-0901/student-bus-tracking/blob/main/frontend/src/components/NotificationPanel.jsx"
click node_api "https://github.com/jtr-0901/student-bus-tracking/blob/main/backend/server.js"
click node_realtime "https://github.com/jtr-0901/student-bus-tracking/blob/main/backend/server.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_login,node_context,node_navbar,node_users toneBlue
class node_parent,node_driver,node_map toneAmber
class node_conductor,node_scanner toneMint
class node_admin,node_notifications toneRose
class node_api,node_realtime,node_osm toneIndigo
```

## Components

### Web application

- [Role routing](https://github.com/jtr-0901/student-bus-tracking/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Sign-in](https://github.com/jtr-0901/student-bus-tracking/blob/main/frontend/src/pages/Login.jsx): `frontend/src/pages/Login.jsx`
- [App state](https://github.com/jtr-0901/student-bus-tracking/blob/main/frontend/src/context/AppContext.jsx): `frontend/src/context/AppContext.jsx`
- [Navigation](https://github.com/jtr-0901/student-bus-tracking/blob/main/frontend/src/components/Navbar.jsx): `frontend/src/components/Navbar.jsx`

### Bus tracking

- [Parent dashboard](https://github.com/jtr-0901/student-bus-tracking/blob/main/frontend/src/pages/ParentDashboard.jsx): `frontend/src/pages/ParentDashboard.jsx`
- [Driver dashboard](https://github.com/jtr-0901/student-bus-tracking/blob/main/frontend/src/pages/DriverDashboard.jsx): `frontend/src/pages/DriverDashboard.jsx`
- [Live map](https://github.com/jtr-0901/student-bus-tracking/blob/main/frontend/src/components/MapView.jsx): `frontend/src/components/MapView.jsx`

### Student safety

- [Conductor dashboard](https://github.com/jtr-0901/student-bus-tracking/blob/main/frontend/src/pages/ConductorDashboard.jsx): `frontend/src/pages/ConductorDashboard.jsx`
- [QR scanner](https://github.com/jtr-0901/student-bus-tracking/blob/main/frontend/src/components/QRScanner.jsx): `frontend/src/components/QRScanner.jsx`

### School operations

- [Admin dashboard](https://github.com/jtr-0901/student-bus-tracking/blob/main/frontend/src/pages/AdminDashboard.jsx): `frontend/src/pages/AdminDashboard.jsx`
- [Notification panel](https://github.com/jtr-0901/student-bus-tracking/blob/main/frontend/src/components/NotificationPanel.jsx): `frontend/src/components/NotificationPanel.jsx`

### Backend services

- [HTTP API](https://github.com/jtr-0901/student-bus-tracking/blob/main/backend/server.js): `backend/server.js`
- [Socket.IO service](https://github.com/jtr-0901/student-bus-tracking/blob/main/backend/server.js): `backend/server.js`

### Other components

- **School users**
- **OpenStreetMap**

## Connections

- School users → Role routing: use (evidence: `frontend/src/App.jsx`)
- Role routing → App state: provides state (evidence: `frontend/src/App.jsx`)
- Role routing → Sign-in: routes unauthenticated (evidence: `frontend/src/App.jsx`)
- Role routing → Parent dashboard: routes parent (evidence: `frontend/src/App.jsx`)
- Role routing → Driver dashboard: routes driver (evidence: `frontend/src/App.jsx`)
- Role routing → Conductor dashboard: routes conductor (evidence: `frontend/src/App.jsx`)
- Role routing → Admin dashboard: routes admin (evidence: `frontend/src/App.jsx`)
- Sign-in → App state: authenticates through (evidence: `frontend/src/pages/Login.jsx`)
- App state → HTTP API: requests auth and alerts (evidence: `frontend/src/context/AppContext.jsx`)
- App state → Socket.IO service: opens socket (evidence: `frontend/src/context/AppContext.jsx`)
- Navigation → App state: reads user state (evidence: `frontend/src/components/Navbar.jsx`)
- Navigation → Notification panel: opens panel (evidence: `frontend/src/components/Navbar.jsx`)
- Notification panel → App state: reads and marks alerts (evidence: `frontend/src/components/NotificationPanel.jsx`)
- Parent dashboard → App state: reads live state (evidence: `frontend/src/pages/ParentDashboard.jsx`)
- Parent dashboard → HTTP API: loads records and posts feedback (evidence: `frontend/src/pages/ParentDashboard.jsx`)
- Parent dashboard → Live map: renders bus location (evidence: `frontend/src/pages/ParentDashboard.jsx`)
- Live map → OpenStreetMap: renders map tiles (evidence: `README.md`)
- Driver dashboard → App state: reads socket updates (evidence: `frontend/src/pages/DriverDashboard.jsx`)
- Driver dashboard → HTTP API: posts GPS and trip actions (evidence: `frontend/src/pages/DriverDashboard.jsx`)
- Driver dashboard → Socket.IO service: emits location (evidence: `frontend/src/pages/DriverDashboard.jsx`)
- Driver dashboard → Live map: renders bus location (evidence: `frontend/src/pages/DriverDashboard.jsx`)
- Conductor dashboard → QR scanner: renders scanner (evidence: `frontend/src/pages/ConductorDashboard.jsx`)
- QR scanner → Conductor dashboard: returns scan result (evidence: `frontend/src/pages/ConductorDashboard.jsx`)
- Conductor dashboard → HTTP API: records student scan (evidence: `frontend/src/pages/ConductorDashboard.jsx`)
- Admin dashboard → App state: reads bus and alert state (evidence: `frontend/src/pages/AdminDashboard.jsx`)
- Admin dashboard → HTTP API: manages records and SOS (evidence: `frontend/src/pages/AdminDashboard.jsx`)
- HTTP API → Socket.IO service: broadcasts events (evidence: `README.md`)
