# priyadarsh912/busconnect1 architecture

> Architecture diagram of the GitHub repository priyadarsh912/busconnect1, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/priyadarsh912/busconnect1
- Repository: https://github.com/priyadarsh912/busconnect1

## Overview

BusConnect is a mobile-oriented transit app for discovering routes and nearby buses, tracking live vehicles, and booking tickets, with separate administration and offline synchronization capabilities. Its user workflow begins in the routed React app, proceeds through route search and booking, and presents confirmation or a ticket; real-time discovery and radar provide parallel transit features. The README documents the geo-query and radar behavior, while sampled source confirms selected route, crowd-prediction, authentication, and sync calls. Several page and service implementations were not sampled, so their internal wiring is shown only where documented.

Main entry points: [`src/App.tsx`](https://github.com/priyadarsh912/busconnect1/blob/main/src/App.tsx) (React app and routes), [`src/pages/RouteSearchPage.tsx`](https://github.com/priyadarsh912/busconnect1/blob/main/src/pages/RouteSearchPage.tsx) (Route search), [`src/lib/supabase.ts`](https://github.com/priyadarsh912/busconnect1/blob/main/src/lib/supabase.ts) (Supabase data), [`src/services/authService.ts`](https://github.com/priyadarsh912/busconnect1/blob/main/src/services/authService.ts) (Authentication service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and identity"]
  node_app["React app and routes<br/>[App.tsx]"]
  node_auth["Authentication service<br/>[authService.ts]"]
end

subgraph group_routes["Route discovery"]
  node_route_search["Route search"]
  node_route_service["Bus and route service<br/>[busService.ts]"]
  node_route_data["Delhi UP route loader"]
  node_connections["Connecting-route finder"]
end

subgraph group_booking["Ticket booking"]
  node_booking["Ticket booking<br/>[BookTicketPage.tsx]"]
  node_seats["Seat selection"]
  node_payment["Payment"]
  node_confirmation["Booking confirmation"]
end

subgraph group_transit["Live transit"]
  node_nearby["Nearby bus geo-query"]
  node_nearby_hook["Nearby bus hook<br/>[useNearbyBuses.ts]"]
  node_radar["Highway radar"]
  node_live_wrapper["Live radar wrapper"]
  node_live_hook["Live bus subscription"]
  node_crowd["Crowd prediction"]
end

subgraph group_operations["Operations and sync"]
  node_admin["Admin dashboard"]
  node_admin_service["Admin data service<br/>[adminService.ts]"]
  node_offline["Offline services"]
  node_sync["Offline sync engine<br/>[SyncEngine.ts]"]
end

node_rider(("Rider"))
node_firebase[("Firebase Auth and Firestore")]
node_supabase[("Supabase data<br/>[supabase.ts]")]

node_rider -->|"uses"| node_app
node_app -->|"routes to"| node_route_search
node_app -->|"routes to"| node_booking
node_app -->|"routes to"| node_radar
node_app -->|"routes to"| node_admin
node_auth -->|"authenticates"| node_firebase
node_auth -->|"syncs profile"| node_route_service
node_route_search -->|"loads routes"| node_route_service
node_route_search -.->|"finds connections"| node_connections
node_route_data -->|"returns route data"| node_rider
node_nearby_hook -->|"queries nearby"| node_nearby
node_nearby -->|"geo-queries"| node_firebase
node_radar -->|"shows live overlay"| node_live_wrapper
node_live_hook -->|"subscribes to buses"| node_supabase
node_crowd -->|"reads history"| node_supabase
node_booking -->|"selects seats"| node_seats
node_seats -->|"continues booking"| node_payment
node_payment -->|"confirms booking"| node_confirmation
node_admin -->|"loads admin data"| node_admin_service
node_offline -->|"queues offline work"| node_sync
node_sync -->|"syncs records"| node_supabase

click node_app "https://github.com/priyadarsh912/busconnect1/blob/main/src/App.tsx"
click node_auth "https://github.com/priyadarsh912/busconnect1/blob/main/src/services/authService.ts"
click node_route_search "https://github.com/priyadarsh912/busconnect1/blob/main/src/pages/RouteSearchPage.tsx"
click node_route_service "https://github.com/priyadarsh912/busconnect1/blob/main/src/services/busService.ts"
click node_route_data "https://github.com/priyadarsh912/busconnect1/blob/main/src/data/loadDelhiUPRoutes.ts"
click node_connections "https://github.com/priyadarsh912/busconnect1/blob/main/src/utils/ConnectingRouteFinder.ts"
click node_nearby "https://github.com/priyadarsh912/busconnect1/blob/main/src/services/nearbyBusService.ts"
click node_nearby_hook "https://github.com/priyadarsh912/busconnect1/blob/main/src/hooks/useNearbyBuses.ts"
click node_radar "https://github.com/priyadarsh912/busconnect1/blob/main/src/pages/HighwayRadarPage.tsx"
click node_live_wrapper "https://github.com/priyadarsh912/busconnect1/blob/main/src/pages/LiveRadarWrapper.tsx"
click node_live_hook "https://github.com/priyadarsh912/busconnect1/blob/main/src/hooks/useSupabaseLiveBuses.ts"
click node_booking "https://github.com/priyadarsh912/busconnect1/blob/main/src/pages/BookTicketPage.tsx"
click node_seats "https://github.com/priyadarsh912/busconnect1/blob/main/src/pages/SeatSelectionPage.tsx"
click node_payment "https://github.com/priyadarsh912/busconnect1/blob/main/src/pages/CardPaymentPage.tsx"
click node_confirmation "https://github.com/priyadarsh912/busconnect1/blob/main/src/pages/ConfirmationPage.tsx"
click node_crowd "https://github.com/priyadarsh912/busconnect1/blob/main/src/utils/CrowdPredictionEngine.ts"
click node_supabase "https://github.com/priyadarsh912/busconnect1/blob/main/src/lib/supabase.ts"
click node_admin "https://github.com/priyadarsh912/busconnect1/blob/main/src/pages/admin/AdminDashboardPage.tsx"
click node_admin_service "https://github.com/priyadarsh912/busconnect1/blob/main/src/services/adminService.ts"
click node_offline "https://github.com/priyadarsh912/busconnect1/blob/main/src/services/offline/OfflineBusService.ts"
click node_sync "https://github.com/priyadarsh912/busconnect1/blob/main/src/services/offline/SyncEngine.ts"

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_auth toneBlue
class node_route_search,node_route_service,node_route_data,node_connections,node_firebase,node_supabase toneAmber
class node_booking,node_seats,node_payment,node_confirmation toneMint
class node_nearby,node_nearby_hook,node_radar,node_live_wrapper,node_live_hook,node_crowd toneRose
class node_admin,node_admin_service,node_offline,node_sync,node_rider toneIndigo
```

## Components

### App and identity

- [React app and routes](https://github.com/priyadarsh912/busconnect1/blob/main/src/App.tsx): `src/App.tsx`
- [Authentication service](https://github.com/priyadarsh912/busconnect1/blob/main/src/services/authService.ts): `src/services/authService.ts`

### Route discovery

- [Route search](https://github.com/priyadarsh912/busconnect1/blob/main/src/pages/RouteSearchPage.tsx): `src/pages/RouteSearchPage.tsx`
- [Bus and route service](https://github.com/priyadarsh912/busconnect1/blob/main/src/services/busService.ts): `src/services/busService.ts`
- [Delhi UP route loader](https://github.com/priyadarsh912/busconnect1/blob/main/src/data/loadDelhiUPRoutes.ts): `src/data/loadDelhiUPRoutes.ts`
- [Connecting-route finder](https://github.com/priyadarsh912/busconnect1/blob/main/src/utils/ConnectingRouteFinder.ts): `src/utils/ConnectingRouteFinder.ts`

### Ticket booking

- [Ticket booking](https://github.com/priyadarsh912/busconnect1/blob/main/src/pages/BookTicketPage.tsx): `src/pages/BookTicketPage.tsx`
- [Seat selection](https://github.com/priyadarsh912/busconnect1/blob/main/src/pages/SeatSelectionPage.tsx): `src/pages/SeatSelectionPage.tsx`
- [Payment](https://github.com/priyadarsh912/busconnect1/blob/main/src/pages/CardPaymentPage.tsx): `src/pages/CardPaymentPage.tsx`
- [Booking confirmation](https://github.com/priyadarsh912/busconnect1/blob/main/src/pages/ConfirmationPage.tsx): `src/pages/ConfirmationPage.tsx`

### Live transit

- [Nearby bus geo-query](https://github.com/priyadarsh912/busconnect1/blob/main/src/services/nearbyBusService.ts): `src/services/nearbyBusService.ts`
- [Nearby bus hook](https://github.com/priyadarsh912/busconnect1/blob/main/src/hooks/useNearbyBuses.ts): `src/hooks/useNearbyBuses.ts`
- [Highway radar](https://github.com/priyadarsh912/busconnect1/blob/main/src/pages/HighwayRadarPage.tsx): `src/pages/HighwayRadarPage.tsx`
- [Live radar wrapper](https://github.com/priyadarsh912/busconnect1/blob/main/src/pages/LiveRadarWrapper.tsx): `src/pages/LiveRadarWrapper.tsx`
- [Live bus subscription](https://github.com/priyadarsh912/busconnect1/blob/main/src/hooks/useSupabaseLiveBuses.ts): `src/hooks/useSupabaseLiveBuses.ts`
- [Crowd prediction](https://github.com/priyadarsh912/busconnect1/blob/main/src/utils/CrowdPredictionEngine.ts): `src/utils/CrowdPredictionEngine.ts`

### Operations and sync

- [Admin dashboard](https://github.com/priyadarsh912/busconnect1/blob/main/src/pages/admin/AdminDashboardPage.tsx): `src/pages/admin/AdminDashboardPage.tsx`
- [Admin data service](https://github.com/priyadarsh912/busconnect1/blob/main/src/services/adminService.ts): `src/services/adminService.ts`
- [Offline services](https://github.com/priyadarsh912/busconnect1/blob/main/src/services/offline/OfflineBusService.ts): `src/services/offline/OfflineBusService.ts`
- [Offline sync engine](https://github.com/priyadarsh912/busconnect1/blob/main/src/services/offline/SyncEngine.ts): `src/services/offline/SyncEngine.ts`

### Other components

- **Rider**
- **Firebase Auth and Firestore**
- [Supabase data](https://github.com/priyadarsh912/busconnect1/blob/main/src/lib/supabase.ts): `src/lib/supabase.ts`

## Connections

- Rider → React app and routes: uses
- React app and routes → Route search: routes to
- React app and routes → Ticket booking: routes to
- React app and routes → Highway radar: routes to
- React app and routes → Admin dashboard: routes to
- Authentication service → Firebase Auth and Firestore: authenticates
- Authentication service → Bus and route service: syncs profile
- Route search → Bus and route service: loads routes
- Route search → Connecting-route finder: finds connections
- Delhi UP route loader → Rider: returns route data
- Nearby bus hook → Nearby bus geo-query: queries nearby
- Nearby bus geo-query → Firebase Auth and Firestore: geo-queries
- Highway radar → Live radar wrapper: shows live overlay
- Live bus subscription → Supabase data: subscribes to buses
- Crowd prediction → Supabase data: reads history
- Ticket booking → Seat selection: selects seats
- Seat selection → Payment: continues booking
- Payment → Booking confirmation: confirms booking
- Admin dashboard → Admin data service: loads admin data
- Offline services → Offline sync engine: queues offline work
- Offline sync engine → Supabase data: syncs records
