CityBus
A full-stack public transit platform — a Flutter app over a FastAPI and PostgreSQL/PostGIS backend, with realistic GTFS data modeling, route planning, and real-time vehicle tracking.



Project Overview
CityBus is a production-like transit system built as a databases course final project, with the data model as the core deliverable. It models real-world GTFS data for Skopje's bus network to power journey planning and live vehicle tracking.
The stack pairs a Flutter client (Riverpod, GoRouter, Dio, flutter_map) with an async FastAPI backend on PostgreSQL 16 + PostGIS 3.5, all orchestrated with Docker Compose and covered by a CI test suite.
Key Features
- GTFS-modeled transit data for Skopje's bus network on PostgreSQL + PostGIS
- Journey planning via a Connection Scan Algorithm with transfer awareness
- Real-time vehicle tracking over WebSockets (~2s updates) with REST fallback
- KNN stop-proximity search, trigram text search, and GiST-indexed geometries
- Flutter client with flutter_map / OpenStreetMap and Riverpod state management
- Dockerized FastAPI backend with SQLAlchemy 2 (async), Alembic, and CI tests
Database & Architecture
The schema uses stop_times as its finest grain — one row per scheduled (trip, stop) event — with surrogate bigint keys alongside preserved GTFS natural keys, and an interval type to handle after-midnight service. The planner runs a Connection Scan Algorithm over pre-computed connections with 120s transfer buffers, while a background simulator interpolates vehicle positions and broadcasts them to WebSocket clients.