As someone living in Brussels, I’ve always been interested in finding efficient ways to navigate the city’s public transport system. So, I decided to build STIB-TUI, a simple yet powerful Terminal User Interface (TUI) that allows users to fetch real-time information from the STIB API, which provides data for the city's buses, trams, and metros.
The goal of STIB-TUI was to create a user-friendly tool to get live transport data directly from the terminal, without needing to rely on a browser or mobile app. I built it using Python’s curses library, which allows for creating text-based interfaces that can display data in a clean and interactive way within the terminal.
How STIB-TUI Works
STIB-TUI connects to the STIB API, which offers a rich dataset including real-time departure times, route details, and station locations. This API is an excellent resource for developers and transit enthusiasts—it’s well-documented and easy to integrate. With a few API calls, users can quickly get live updates on any transport line they are interested in, directly from their terminal.
Using the curses library, I was able to build an interactive interface that lets users enter a station name and receive the waiting time for each line at this station in real time within a minimalist terminal window. The text-based nature of the interface made it both lightweight and fast, ideal for developers or tech-savvy users who prefer the terminal environment.
What I Learned
Building TUIs with Curses: Prior to this project, I hadn’t worked much with terminal interfaces. Learning to use the curses library was a fun challenge that opened up a new way of interacting with data. It taught me how to manage user input and display data in a clean, efficient manner without a graphical UI.
Working with APIs: While I’ve worked with APIs before, integrating with the STIB API was a unique experience because of the real-time nature of the data. I learned how to handle and display rapidly changing information in a user-friendly way, while also considering performance and data accuracy.
Understanding Public Transport Data: The STIB dataset is incredibly detailed, and working with it gave me insights into how public transport systems are structured. It was fascinating to see how route data, schedules, and live updates come together to power the city's transport system.
Overall, STIB-TUI was a rewarding project that combined practical problem-solving with hands-on learning about text-based interfaces and real-time data integration. If you’re a public transport user in Brussels or just interested in building TUIs, I highly recommend exploring the STIB API—it’s a great resource!