How vinura2006/ceylon-track works
Ceylon Track is a real-time passenger information system for Sri Lanka Railways. Passengers use schedule and station information, follow journeys, and receive live train status and disruption alerts; staff and administrators manage train operations and GPS sharing. The backend is an Express API backed by PostgreSQL, with WebSocket updates and scheduled jobs. The graph preserves the README’s major capabilities and the indexed route modules. Some route internals were not excerpted, so those links show documented mounting or indexed references rather than inferred calls between features.
Main entry points: index.js Express API · pool.js PostgreSQL · auth.js Account and login · schedules.js Train schedules
Components 28
API and realtime
- Express API
backend/index.js - WebSocket updates
backend/websocket.js - PostgreSQL
backend/db/pool.js
Identity and access
- Account and login
backend/routes/auth.js - Multi-factor auth
backend/routes/mfa.js - GPS sessions
backend/routes/sessions.js - Token verification
backend/middleware/authenticate.js - Role authorization
backend/middleware/authorize.js - Request validation
backend/middleware/validate.js
Rail information
- Train schedules
backend/routes/schedules.js - Timetable and routes
backend/routes/timetable.js - Station directory
backend/routes/stations.js - Disruption feed
backend/routes/disruptions.js - Journey watches
backend/routes/journeywatch.js - Watch subscriptions
backend/routes/watch.js
Live operations
- GPS updates
backend/routes/gps.js - Staff operations
backend/routes/staff.js - Assignments
backend/routes/assignments.js - Last-stop status
backend/routes/laststop.js - Administration
backend/routes/admin.js
Alerts and internals
- Watcher notifier
backend/jobs/notificationChecker.js - Email delivery
backend/services/notifications.js - Reliability refresh
backend/jobs/reliabilityRefresh.js - TTL cache
backend/utils/simpleCache.js - Audit logging
backend/utils/auditLogger.js
Other components
- Passengers
- Rail staff
- GPS hardware
Connections 46
- Passengers → Express API: request information
- Rail staff → Express API: manage operations
- GPS hardware → Express API: push coordinates
- Express API → Account and login: mounts routes
backend/index.js - Express API → Multi-factor auth: mounts routes
backend/index.js - Express API → Train schedules: mounts routes
backend/index.js - Express API → Station directory: mounts routes
backend/index.js - Express API → Watch subscriptions: mounts routes
backend/index.js - Express API → Staff operations: mounts routes
backend/index.js - Express API → GPS updates: mounts routes
backend/index.js - Express API → Disruption feed: mounts routes
backend/index.js - Express API → Assignments: mounts routes
backend/index.js - Express API → Last-stop status: mounts routes
backend/index.js - Express API → Timetable and routes: mounts routes
backend/index.js - Express API → Journey watches: mounts routes
backend/index.js - Express API → Administration: mounts routes
backend/index.js - Express API → GPS sessions: mounts routes
backend/index.js - Express API → WebSocket updates: attaches server
backend/index.js - Express API → PostgreSQL: queries health
backend/index.js - Account and login → PostgreSQL: reads and writes
backend/routes/auth.js - Account and login → Token verification: authenticates requests
backend/routes/auth.js - Account and login → Role authorization: checks roles
backend/routes/auth.js - Token verification → PostgreSQL: checks revocation
backend/middleware/authenticate.js - Multi-factor auth → PostgreSQL: queries records
backend/routes/mfa.js - GPS sessions → PostgreSQL: manages sessions
backend/routes/sessions.js - Train schedules → PostgreSQL: queries schedules
backend/routes/schedules.js - Train schedules → TTL cache: caches results
backend/routes/schedules.js - Timetable and routes → PostgreSQL: queries timetable
backend/routes/timetable.js - Station directory → PostgreSQL: queries stations
backend/routes/stations.js - Station directory → TTL cache: caches results
backend/routes/stations.js - Disruption feed → PostgreSQL: queries disruptions
backend/routes/disruptions.js - Journey watches → PostgreSQL: queries journeys
backend/routes/journeywatch.js - Watch subscriptions → PostgreSQL: stores watches
- GPS updates → PostgreSQL: stores coordinates
backend/routes/gps.js - Staff operations → PostgreSQL: updates operations
backend/routes/staff.js - Assignments → PostgreSQL: queries assignments
backend/routes/assignments.js - Last-stop status → PostgreSQL: queries status
backend/routes/laststop.js - Administration → PostgreSQL: manages records
backend/routes/admin.js - Watcher notifier → PostgreSQL: reads watches
backend/jobs/notificationChecker.js - Watcher notifier → Email delivery: sends alerts
backend/jobs/notificationChecker.js - Reliability refresh → PostgreSQL: refreshes cache table
backend/jobs/reliabilityRefresh.js - Express API → Reliability refresh: schedules refresh job
backend/index.js - WebSocket updates → PostgreSQL: reads train data
backend/websocket.js - Account and login → Audit logging: logs actions
backend/routes/auth.js - Staff operations → Audit logging: logs actions
backend/routes/staff.js - Administration → Audit logging: logs actions
backend/routes/admin.js