2000-00-00
Stex stands for Stockholm Exit and is a commute planner for the Stockholm subway. Unlike standard travel planners, Stex optimizes your journey by calculating the exact platform position (Front, Middle, or Back) based on the subway exit closest to your final destination—whether it's a station or a specific street address.
Calculates optimal exit even when searching by street address
Circuit Breakers ensure stability even if external APIs fail
Caffeine Caching reduces latency and API calls
Stex was actually the first idea I ever had for a project - but like most “one day I’ll build this” ideas, it gathered a bit of digital dust before I finally gave it a shot (read: a year). The idea came from pure frustration, SL used to show which subway door would put you closest to the exit, and then... they just stopped. I missed it every time I found myself sprinting down a platform. So, I thought, why not build it myself? I knew the logic would be quite complex, and I wasn’t even sure it was fully possible, considering API limitations and costs. The frontend wasn’t the main focus either, so I decided on a single-page without too much fluff. It's built in React.js, mainly because I wanted to try it out.
Before I wrote a single line of code, I did a lot of research. The first question was whether this project was even feasible without turning into a paid side project. I looked into different APIs to see what was available for free, what kind of data I could actually access, and what I would need to make the logic work.
Once I knew it was possible, I started planning properly. I created a backlog, user flows, and the diagrams I needed to understand both the problem and the solution. From the start, I knew I wanted to host the application somewhere so my friends could actually use it, which meant researching free (or at least cheap) options for frontend, backend and database. With that in mind, I sketched out the overall structure, what components I needed, how the logic would work, how data would flow through the system, and how everything would fit together. I also had a rough idea of how I wanted the design to look - simple, clean and focused on functionality rather than visuals.
Where do I even begin? Initially, fetching a station and all its
entrances resulted in excessive database queries. I solved this by
implementing JOIN FETCH in JPQL to retrieve all
related data in a single optimized query. Relying on external APIs
(SL/Trafiklab) meant the app could crash if they went down. I
implemented the Circuit Breaker pattern using
Resilience4j. Now, if the external service fails, the app degrades
gracefully or serves cached data instead of hanging.