silverfish
Three Jatri screens in Bangla: every direct train from Dhaka to Chattogram sold out, the line drawn ticket by ticket with the best chain in bold, and the way it found: board Sonar Bangla Express at Biman Bandar.

Case study 04 / 042026

Jatri

My part
All of it: product, design, API, worker, deploy
Used by
Friends and family, by invite
Try it
demo.railway.silverfish.dev, no invite needed
Built with
Next.js 16, Hono, SQLite, web push, passkeys
Also
A Firefox add-on and an Android app
Tests
Over 200, with node:test

Every direct train sold out? There's often still a way.

A seat finder for Bangladesh Railway. The real one is invite-only, for friends and family; anyone can try the demo. It watches a route and sends a push the moment a seat opens. When the direct trains are full it looks for what the railway would still sell: a longer ticket on the same train, two tickets split along the way, a change at a real junction, or, in a deep search, the whole line ticket by ticket.

Try the demorailway.silverfish.dev (invite only)

Where it stood

Bangladesh Railway sells tickets online, and on the routes people actually travel the direct trains are often sold out. Seats do come back when someone cancels, but only to whoever happens to be refreshing at that moment.

And sold out isn't the whole story. The railway sells its seats in quotas for each stretch of the line, so a longer ticket on the same train, or two tickets split at a station on the way, can have seats when the direct one doesn't. Nobody checks all of those by hand.

Jatri in Bangla: Find a way, from Dhaka to Chattogram on a small map, today, one seat in any class.
Pick a route and a day. Bangla and English, light and dark, down to 360px wide.
Jatri's results: direct trains, seven trains, all sold out, each listed with every class sold out.
Dhaka to Chattogram: all seven direct trains, every class sold out.

What I decided

A push the moment a seat opens

A watch is a route, the days and the classes you'd take. A worker checks it on a jittered interval, one request per login, route and day however many watches share it, and alerts once per opening, not every time it looks.

Find a way, planned from the public timetables

When the direct trains are full, the planner works out from the free timetables which other tickets could work: a longer ticket on the same train, two tickets split at its busiest stops, or a change at a real junction, never a detour much slower than the fastest way. Then it asks the railway only about those, at most 24 searches, 1.5 seconds apart.

A deep search, the line ticket by ticket

From every station a chain of tickets with seats can reach, it tries every ticket onward, destination first. It learns which stretches each train doesn't sell online and doesn't ask about them again for three weeks. When nothing gets all the way, it shows the closest chains and what could cover each gap.

Your railway login, kept to a minimum

Jatri needs your login to the railway's site to search. A small add-on hands it over after you log in on the railway's own page, so your password never reaches me. Sign-in to Jatri itself is passkeys only, and every personal value in the database (routes, dates, seats, the railway login) is sealed with AES-256-GCM, backups too.

Jatri's results after a deep search: seven direct trains all sold out, then 20 other ways, the first on Sonar Bangla Express from Biman Bandar.
After the deep search: 20 other ways, easiest first.
Jatri's line map from Dhaka to Chattogram: green arcs for tickets with seats, the best chain in bold from Biman Bandar to Chattogram, a dashed red link from Dhaka, and Akhaura marked where a chain gets stuck.
The line, ticket by ticket: every ticket with seats an arc, the best chain in bold, the missing link dashed red.
Jatri's journey: Biman Bandar 7:27 to Chattogram 11:55 on Sonar Bangla Express, four Shovan seats left, with a map of the route.
The way it found: take the train from Biman Bandar, 22 minutes up the line, where four seats are left.
Jatri's journey map: the route from Biman Bandar to Chattogram in blue across Bangladesh, with a timeline to play the train along it.
The same journey on a map of the whole country, drawn from open data, nothing fetched at runtime.

What changed

MeasureBeforeAfter
When a seat comes backRefresh and hopeA pushonce per opening
When the direct trains are fullGive upOther wayschecked for you
Tickets checked in a deep searchOne at a time, by handUp to 3501.5 s apart

Before is checking the railway's own site by hand. The screens on this page run on sample seats over the real timetable, so they don't show anyone's journey.

What I'd do next

A signed build of the Firefox add-on, so installing it is one tap instead of a developer's detour, and Bangla names for every station on the map.

Hire meStep 1 of 3

Let's build something.

Three quick steps. I read every message myself and reply within a day.

What are we building? pick any that fit
When do you need it?

Rather chat? Messengerhello@silverfish.dev