Rio has no single source for where its transit is. Three public SMTR paths cover the city's buses and BRT; the trains, metro, tram, ferries and intercity buses have no public machine-readable data at all. A naive map would paper over that — inventing positions, collapsing a failed fetch into 'no vehicles', or drawing a days-old parked snapshot as a moving bus.
— Case study 17
Transit Pulse
A live public-transport map for Rio, honest about which data exists

project overview
A live map of Greater Rio's buses and BRT where every operator is shown as live, scheduled-only or no-public-data, fed by a resilient streaming pipeline that records each provider's response byte-for-byte before it ever draws a vehicle.
shipped outcome
A recorded demo that keeps working with the live backend switched off: the real Rio map, line and bus exploration with the view held in the URL, colour-by-speed, static GTFS routes and stop lists for selected lines, and a time machine that scrubs the recorded hours and plays them at 1×/10×/60× with fading trails. The production raw log ships to S3 with checksum manifests, and a separate rebuild job writes the same tables as the live consumer, so a projection lost to a crash is reproduced exactly from the log.
- Role
- Data platform and product engineering
- Timeline
- 2026 — recorded demo live
- Year
- 2026
- Team
- Solo
The site in motion
One adapter per provider normalizes to a single canonical event; nothing downstream knows which provider it came from. Every response is written to an immutable raw log on S3 before anything is published, so the broker (Redpanda, 24-hour retention) is only a buffer and the database is a rebuildable projection. The API serves a snapshot from memory — it queries the database at most once per new minute, never per request — and the web app draws vehicles with MapLibre and deck.gl behind an amber letreiro that states live, stale or failed plainly. Coverage is shown in three honest tiers, and within 'live', 'no vehicles', 'fetch failed' and 'stale past five minutes' stay distinct, never zero.
A recorded demo that keeps working with the live backend switched off: the real Rio map, line and bus exploration with the view held in the URL, colour-by-speed, static GTFS routes and stop lists for selected lines, and a time machine that scrubs the recorded hours and plays them at 1×/10×/60× with fading trails. The production raw log ships to S3 with checksum manifests, and a separate rebuild job writes the same tables as the live consumer, so a projection lost to a crash is reproduced exactly from the log.
— Interface evidence
The product, not a placeholder
These are the verified interface captures from the project build. Scroll inside taller frames to inspect each complete page.




— Delivery process
From operating constraint to shipped system
The work is sequenced around risk. Domain rules and failure states come before interface polish; automation arrives before handoff.
A truthful source inventory
Every Rio operator checked against live sources: city buses (SPPO and the new Sistema RIO) and BRT are public through three keyless SMTR paths; rail, metro, tram, ferries and intercity buses have no public machine-readable data. The map says so rather than guessing.
One canonical event
An adapter polls the ITS API one UTC minute at a time, stores each response byte-for-byte in the raw log, and publishes a single versioned event shape to Redpanda — the supplier made part of a vehicle's identity after two AVL suppliers were found reusing the same id.
Rebuildable projections
A consumer writes positions and feed-status to TimescaleDB; a separate rebuild job replays the raw log into the same tables through the same code, idempotently, so live and rebuilt tables match. The API answers from an in-memory snapshot, never a per-request query.
The screen, and a time machine
A full-bleed Rio map with the letreiro, line and bus panels whose view lives in the URL, static GTFS routes, a non-map table, and a timeline that scrubs and plays the recorded hours with fading trails — then a static replay exported to S3 and CloudFront that outlives the backend.
— System architecture
Clear boundaries, explicit responsibilities
Each layer has one job and a narrow contract. That keeps external services replaceable and product behavior testable.
letreiro / rio
live · stale · failed
no vehicles ≠ fetch failed
api snapshot
from memory · 1 query / min
coverage / 3 tiers
Go adapters
One adapter per provider, each emitting one canonical event; the raw provider response is written to S3 before anything is published.
Redpanda
Versioned topics for positions and feed-status; the broker is a 24-hour buffer, the raw log on S3 is the system of record.
TimescaleDB + PostGIS
A positions hypertable and a feed-status table; the live consumer and the rebuild job share one idempotent, order-independent write path.
Go API + Next.js
The API answers from an in-memory snapshot refreshed at most once per minute; the web app draws it with MapLibre and deck.gl, with a static replay on CloudFront.
— What shipped
Product capabilities
Honest coverage, in three tiers
Every operator is live, scheduled-only or no-public-data; within live, 'no vehicles', 'fetch failed' and 'stale past five minutes' are each shown as themselves, never collapsed into zero.
A time machine over recorded hours
Scrub the last hours and play them at 1×/10×/60× with fading trails; the playhead minute lives in the URL, and 'Só posições reais' turns off the interpolation between real fixes.
A replay that outlives the backend
The deployed demo runs entirely from a compact, checksum-pinned export on S3 and CloudFront — the live pipeline can be switched off and the recording still plays.
— Engineering pressure
Challenges resolved
The same bus reported twice
Two AVL suppliers reported the same SPPO vehicle id from different devices — 3,114 colliding (vehicle, time) pairs with different positions. Resolved by making the supplier part of a vehicle's identity, so neither fix is silently dropped.
A timestamp that lied about its zone
The legacy SPPO feed stamps positions with a 'Z' that is not UTC — it is São Paulo time. Each source's clock is converted explicitly to real UTC in the adapter, so the time machine scrubs the right minute.
'Real-time' over polled sources
Nothing is pushed; the adapter polls one minute at a time and the map interpolates between the real fixes. The product says so plainly — the honesty is the feature, and the streaming rigour lives in the pipeline.
verified project destinations
next transmission
Need a system this deliberate?
Bring the operating problem. We will shape it into a clear product brief and a buildable next step.
Start a project