Overview
Mbus is a web application for searching and viewing Marprom bus departures. It provides a user-friendly interface to select departure and arrival stations, browse available routes, and view accurate, up-to-date schedules.
Features
- Search for bus departures by station and date
- View detailed schedule and route information
- Fast, responsive UI with modern design
Tech Stack
Frontend:
- React
- TypeScript
- Shadcn UI
- TanStack Query & Router
Backend:
- Go
- PostgreSQL
- Redis
- OpenRouteService API
Background
I have recently moved to Maribor – carless by choice (or let's say, by circumstance) and quickly found myself deep in the maze of public transportation.
While I'm all for using buses, I ran into a few challenges:
Marprom's website doesn't let you simply enter a "From" and "To" to check departures. Instead, it relies on static PDFs for each station and direction (not exactly ideal when you're on the move).
While there is an interactive map that shows departures, lines, and directions, it's only truly usable on desktop. On mobile, it's clunky and lacks key trip info like duration, arrival times, and distance (all things I find really helpful when planning a journey).
So… I built my own tool.
I was used to tools like those from Arriva and AP MS, which I relied on during my high school and university days while commuting, so I built something similar for Maribor.
Implementation
The recipe for this little project looked like this:
- Scraped all data from the interactive map Marprom provides
- Stored it in a relational database
- Built a REST API in Go
- Built the frontend in React for an app-like experience
- Deployed the whole thing to a VPS
Performance Considerations
Some performance optimizations along the way:
- Moved station search to the client side to reduce unnecessary server requests
- Used a virtualized list to efficiently render 200+ stations without performance issues
- Used React Query on the frontend for improved UX and to avoid requesting the same data twice, combined with Redis caching on the backend to store generated departure tables and reduce recomputation
Results
The app is live and available at mbus.perkz.cloud
Lessons Learned
- Web scraping can be a powerful tool when official APIs aren't available
- Database design matters – proper normalization and indexing significantly improved query performance
- Caching strategies (both client and server-side) are crucial for responsive user experiences
- Mobile-first design is essential for public transportation apps
- VPS deployment provides flexibility and control over the entire stack