Redesigning the ÜSAFE architecture
My undergraduate thesis. I documented the architecture of a safe walking-routes app, built without diagrams or written decisions, and designed a target architecture so routing can scale without dragging the rest along.
- Type
- University
- My role
- Thesis author
- Year
- 2026
- Status
- Design proposal
What ÜSAFE is
ÜSAFE is a mobile app that calculates walking routes based on a risk index per street segment, instead of optimizing only for time. The person picks between the safest route, a balanced one or the shortest.
A team of 6 of us built it for the university’s Software Fair. It worked, but the fair’s deadlines left no diagrams, defined boundaries or written decisions.
A year later I took it as the case study for my thesis, which I wrote alone.
How I approached it
The work had five steps.
- Map the existing architecture. I traced each user story to the components and endpoints that implemented it, and documented it with the C4 model.
- Write down the decisions. Decisions that were implicit in the code were recorded as ADRs.
- Define the quality attributes. I prioritized eight, using the Head First Software Architecture framework.
- Diagnose. I identified which parts of the architecture limited those attributes.
- Design and compare. I proposed a target architecture and compared it with the current one through scenarios.
What I found
- Routing competes with the rest of the system. Calculating a route runs Dijkstra three times, once per profile. In Node that calculation blocks the event loop and competes with authentication and reports.
- The monolith scales as a whole. Cloud Run scales the entire container even when only routing needs more resources.
- The app polls. It asks for new reports over HTTP every few seconds, which loads the server and uses the user’s data.
- The panels recalculate everything. There’s no cache, and lists fetch every record to paginate on the client.
- The system has to be prepared for Law 21.719 on personal data protection, which takes effect in December 2026.
What I proposed
Clients
- Mobile appReact Native. Routes, reports and emergency button.
- Web panelReport moderation, historical data uploads and dispatch.
Entry
- API GatewaySingle entry point. Validates the token, applies rate limiting and routes.
- Supabase AuthIdentity with JWT and the role assigned server-side.
Services
- Modular monolith · FastifyOne module per domain, with service, domain and repository layers.
- Geo context · GoIn-memory graph, Dijkstra with a priority queue and parallel routes with goroutines.
Integration
- EventsA validated report triggers a risk recalculation for the affected segments.
- Cursor reconciliationIncremental every hour and full every night, in case an event is lost.
- PushFirebase Cloud Messaging announces new reports.
Data
- PostgreSQLThe monolith database. Only the repository layer queries it.
- PostgreSQL with PostGISThe Geo context's own database, with street segments and their risk.
A modular monolith by domain. Each domain has service, domain and repository layers, and only the repository talks to the database.
An independent Geo context in Go. Routing is the part that competes with the rest, so it’s the one that leaves the monolith. Go can serve routes in parallel with goroutines over a shared copy of the graph, and the service scales on its own.
Integration through events, not a shared database. When a report is validated, the backend emits an event and the Geo context recalculates the risk of the affected segments. Cursor reconciliation covers a lost event or a broker outage.
A single entry point. The API Gateway validates the token and applies rate limiting, and the app and the panel know a single URL.
Push instead of polling, plus server-side caching and pagination in the panels.
Scope
It is a design proposal evaluated analytically, with scenarios for each quality attribute. Implementation is the next step.