Overview
MND (My Next Destination) is a multi-platform university transit navigation system built for Shahjalal University of Science and Technology in Sylhet, Bangladesh. The system provides intelligent route planning that combines scheduled free bus services with on-demand local transportation (CNG/rickshaw).Node.js Backend
Express REST API with TypeScript
Flutter Mobile
Cross-platform iOS/Android app
React Web
Web dashboard for route planning
High-Level Architecture
Backend Architecture (Node.js)
Project Structure
Core Components
Graph Engine (graph.ts)
Graph Engine (graph.ts)
Manages the transportation network as a graph data structure.Key Features:
- Loads 19 nodes (locations) from
nodes.json - Loads 289 edges (connections) from
edges.json - Builds adjacency list for efficient traversal
- Implements Dijkstra’s shortest path algorithm
- Supports bus, local, and walking modes
Route Planner (planner.ts)
Route Planner (planner.ts)
Implements 4 routing strategies to find optimal paths.Strategies:
- Direct Bus - Single bus from origin to destination
- Bus + Local - Bus as far as possible, then CNG/rickshaw
- Transfer - Multi-leg journey with bus transfers
- Local Only - Fallback when buses are unavailable
- Fastest route (minimum total time)
- Least local route (minimum paid transport)
REST API (server.ts)
REST API (server.ts)
Express.js server exposing route planning and user features.Endpoints:
GET /api/routes- Plan a routeGET /api/nodes- Get all locationsGET /api/routes/list- Get bus routesPOST /api/auth/send-link- Magic link loginGET /api/favorites- User’s saved routesGET /api/buses/upcoming- Next buses from location
Distance Matrix Client
Distance Matrix Client
Fallback to Google Maps when graph data is insufficient.Use Cases:
- Local transport segments not in graph
- Walking distances between nodes
- Real-time traffic estimates
- Caches API responses for 7 days
- Reduces API costs (Google charges per request)
- Tracks monthly/daily usage limits
Mobile App Architecture (Flutter)
Project Structure
State Management
MND uses Provider for state management:The Flutter app uses Google Maps Flutter plugin to display routes with turn-by-turn directions.
Web Dashboard Architecture (React)
Key Features
Route Planning
Interactive map with origin/destination selection
Schedule Browser
View all bus schedules and departure times
Admin Panel
Manage routes, buses, and user data
Analytics
Usage statistics and popular routes
Data Flow
Route Planning Request Flow
Authentication Flow (Magic Link)
File-Based Database
Instead of a traditional database, MND uses JSON files for data persistence:JSON Data Files
- nodes.json
- edges.json
- routes.json
- users.json
- favorites.json
Stores all 19 locations in the network:
Technology Stack
Backend
- Runtime: Node.js 18+
- Framework: Express.js
- Language: TypeScript
- API Style: REST
- Data Storage: JSON files
Mobile
- Framework: Flutter 3.x
- Language: Dart
- State Management: Provider
- Maps: Google Maps Flutter
- HTTP: Dio
Web
- Framework: React 18
- Language: TypeScript
- Styling: Tailwind CSS
- Maps: Google Maps JavaScript API
- Routing: React Router
External APIs
- Google Maps Distance Matrix API
- Google Maps Geocoding API
- Email (for magic link auth)
Deployment Architecture
Backend Deployment
Deploy Node.js API to cloud platform:
- Recommended: Railway, Render, or Heroku
- Environment Variables: Store API keys, secrets
- Port: 3000 (configurable via
PORTenv var)
Mobile App
Build and distribute Flutter apps:
- Android: Google Play Store (
.apkor.aab) - iOS: Apple App Store (TestFlight for beta)
- Update
api_config.dartwith backend URL
Performance Considerations
Graph Loading
Graph data (19 nodes, 289 edges) loads in < 50ms on server startup.
Route Planning
Typical route planning request completes in 100-300ms (without external API calls).
API Caching
Distance Matrix results cached for 7 days, reducing repeated API costs.
Concurrent Users
Node.js handles hundreds of concurrent requests efficiently.
Next Steps
Explore Routing
Learn how the 4 routing strategies work
Graph Model
Understand the network data structure
Transport Modes
Learn about buses, local transport, and walking
API Reference
Explore all API endpoints