Managing transportation for schools or companies is harder than it looks.
Traditional methods like Excel sheets, manual planning, and paper-based routes are time-consuming, error-prone, and costly.
In this post, I’ll share how we engineered RouteBot, a SaaS product for school bus tracking, route optimization, and fleet management — including our tech stack, optimization challenges, and lessons learned.
🚍 The Problem
School and personnel transportation services face common challenges:
- Inefficient Routes → Manual planning wastes time and increases fuel costs.
- Lack of Real-Time Tracking → Parents and managers can't see where vehicles are.
- Communication Delays → Delayed SMS/phone updates cause frustration.
- Poor Data Management → Managing hundreds of students/employees manually leads to mistakes.
We wanted to solve all of these in a single system.
💡 Our Solution: RouteBot
RouteBot is a transportation management SaaS that combines:
- Route Optimization → Using Google Maps API + custom algorithms.
- Real-Time Vehicle Tracking → Live GPS data from driver mobile apps.
- Multi-Role Access → Admin, driver, and passenger/parent portals.
- Automated Notifications → SMS alerts for arrivals, delays, and route changes.
- Scalable Architecture → Capable of handling thousands of vehicles.
We designed it to work for schools, corporations, and service providers with minimal onboarding time.
🛠 Tech Stack
We kept the tech stack JavaScript-first for speed and maintainability:
- Frontend: React + Material UI
- Backend: Node.js, Express, Mongoose
- Database: MongoDB
- Mapping & Optimization: Google Maps APIs (Directions, Distance Matrix, Geocoding)
- Hosting: Heroku (planning migration to Vercel + containerized services)
🏗 Architecture Overview
While RouteBot appears simple to the end user — a web dashboard, a mobile app, and live maps — the architecture behind it is designed for high scalability, maintainability, and performance.
At a high level, the system is composed of four main layers:
-
Client Layer (React Frontend)
- Technology: React + Material UI
-
Responsibilities:
- Provides responsive dashboards for admins, parents, and drivers.
- Handles real-time map rendering via Google Maps JavaScript API.
- Uses context-based state management to keep route data, GPS updates, and notifications synchronized without redundant API calls.
- Implements authentication flows and role-based UI components.
-
API Gateway & Backend Services (Node.js + Express)
- Technology: Node.js, Express, Mongoose
-
Responsibilities:
- Exposes REST and WebSocket endpoints for client communication.
- Manages authentication, authorization, and session control.
- Processes route optimization requests, calling Google Maps APIs and our custom clustering algorithms.
- Acts as a central hub for events — triggering notifications, dispatching updates, and queuing background jobs.
-
Data Layer (MongoDB)
-
Responsibilities:
- Stores all entities — users, vehicles, routes, GPS logs, and notification history.
- Uses geospatial indexes to quickly query nearest stops and optimize route calculations.
- Supports time-series storage for GPS data, making historical route playback possible.
-
Responsibilities:
-
External Integrations & Services
- Google Maps APIs: Directions, Distance Matrix, Geocoding for route planning.
- SMS Provider: Sends alerts, reminders, and confirmations.
- Push Notifications Service: Delivers mobile updates instantly to parents and drivers.
- Analytics & Monitoring Tools: Tracks performance, errors, and user behavior.
Data Flow Example:
[Client (React)]
↓ HTTPS / WebSocket
[Backend API (Node.js + Express)]
↓ MongoDB Queries / Writes
[MongoDB Database] ↔ [Google Maps APIs / SMS Service / Notification System]
📏 Route Optimization at Scale
One of the hardest parts of building RouteBot was handling complex route assignments for multiple vehicles across dozens (or hundreds) of pickup points.
🚐 The Multiple Salesman Problem
In classic logistics problems, the Travelling Salesman Problem (TSP) is about finding the shortest route visiting all locations once.
In our case, we needed to solve the Multiple Salesman Problem (mTSP) — because we had multiple buses serving different passengers.
Our Approach
Input:
- A list of students/employees with precise GPS coordinates.
- Vehicle capacity limits.
- Pickup/delivery constraints.
Process:
- Cluster passengers into groups based on proximity and capacity.
- Assign each group to the most efficient vehicle.
- Generate stop sequences to minimize travel time.
Output:
- Optimized routes for each bus.
- Stop order with ETA (Estimated Time of Arrival).
- Balanced workloads across vehicles.
🗺 Google Maps API + Custom Clustering
We used Google Distance Matrix API to get accurate travel times between points.
However, calling the API for every possible pair is expensive and slow.
To solve this, we implemented:
- Custom clustering to reduce API calls.
- Heuristic optimizations for near-real-time route generation.
- Caching of distance data for recurring stops.
📡 Real-Time Tracking
Drivers use a lightweight mobile app to send GPS updates every few seconds.
Parents and managers view the live vehicle position in their dashboards.
Key Optimizations:
- Compressed location payloads to reduce bandwidth usage.
- WebSocket-based live updates for instant map refresh.
- Idle detection to pause updates when the vehicle isn’t moving, saving battery and data.
🔔 Automated Notifications
Communication is critical in transportation. We integrated an SMS notification system to keep all stakeholders informed.
Triggers include:
- Morning route reminders.
- Delay alerts in case of traffic or incidents.
- Drop-off confirmations for parents and managers.
Our backend event system ensures:
- No redundant messages.
- Minimal API cost.
- Accurate, real-time triggers.
⚡ Scalability & Performance
From day one, we built RouteBot to scale:
- Modular services: separate modules for authentication, routing, notifications, and tracking.
- Database indexing for fast location queries.
- Async job queues for notifications and heavy processing.
This allows us to handle thousands of vehicles and passengers without performance degradation.
📎 Learn More
We’re publishing more technical deep-dives on our blog:
👉 Visit RouteBot.com
If you’re working on route optimization, fleet management, or real-time tracking, I’d love to connect and exchange ideas.
Top comments (0)