System Architecture
Architecture Overview

FleetTrack follows a client-server architecture where students' mobile devices provide GPS data, the backend processes the data, and WebSocket delivers real-time bus locations to connected users.
Student Mobile
│
│ GPS Location
▼
FleetTrack App
│
│ HTTP / WebSocket
▼
Backend Server
│
├──────────────► Database
│ │
│ ├── Students
│ ├── Buses
│ ├── Routes
│ ├── Stops
│ └── Seats
│
│ WebSocket
▼
Connected Students
│
▼
Real-Time Bus Location
│
▼
Map UI
Frontend
The frontend provides the interface through which students interact with FleetTrack.
- Provides the student interface.
- Collects GPS location from participating devices.
- Displays buses and routes on an interactive map.
- Shows real-time bus locations and upcoming stops.
- Displays bus charts and seat information. Backend
The backend handles the application's business logic and communication between clients and the database.
- Handles API requests from the frontend.
- Receives and processes GPS location data.
- Manages buses, routes, stops, seats, and daily allocations.
- Determines the most reliable bus location from available GPS data.
- Sends real-time updates using WebSocket. Database
The database stores the information required by FleetTrack.
- Student information
- Bus information
- Routes
- Bus stops
- Seat allocations
- Daily bus assignments
- Tracking information
- GPS Tracking
FleetTrack uses the GPS sensors available on students' smartphones instead of dedicated GPS hardware.
- Uses GPS sensors available on students' smartphones.
- Participating students travelling on a bus provide location data.
- Location data is periodically sent to the backend.
- Multiple student devices can provide location data for the same bus.
- No dedicated GPS hardware is required on buses. WebSocket Flow
WebSocket is used to provide real-time bus location updates to connected students.
Student Device
│
│ GPS Update
▼
Backend Server
│
│ WebSocket Broadcast
├──────────► Student A
├──────────► Student B
└──────────► Student C
│
▼
Live Map
WebSocket Process
- Student devices send GPS updates to the backend.
- The backend processes the received location data.
- The latest bus location is broadcast using WebSocket.
- Connected students receive the update in real time.
- The frontend updates the bus position on the map.
Technology Stack
| Component | Technology |
|---|---|
| Frontend | React / React Native |
| Backend | Node.js + Express.js + Graphql |
| Real-Time Communication | WebSocket / Socket.IO |
| Database | MongoDB + ORM, Redis,BullMQ |
| Location Tracking | Smartphone GPS |
| Maps | openStreetMap/LeafLet/GoogleMap |