This post was written as part of my submission to the **Kiroween 2026 hackathon* (Resurrection category).*
Why Resurrect a Paper Railway Timetable in 2026?
Before smartphone transit apps, rail travel in Japan revolved around two artifacts: the thick printed railway timetable (Jikokuhyo / 時刻表) and the staffed Midori-no-Madoguchi (みどりの窓口) ticket counter, where station clerks flipped pages, circled boarding and alighting times in red grease pencil, warned travelers about tight platform transfers, and caught rail-pass pitfalls before issuing a perforated magnetic ticket (Kippu / 切符).
Today, live cloud apps have replaced both—until your Shinkansen enters a mountain tunnel, you arrive at Narita Airport without a local SIM, or you cross a rural Hokuriku corridor with zero signal.
Inspired by my earlier Japan rail map project (trainjapan.me), I built TrainJapan Planner from scratch for Kiroween 2026 as a standalone, 100% offline-first PWA that brings back the tactile Jikokuhyo sheet, the classic Japanese Train Diagram (列車ダイヤ), and the station-master planning desk—with zero backend and zero runtime API calls.
- Live Offline PWA: https://jia881.github.io/trainjapan-planner/
- Open-Source Repo (MIT): https://github.com/jia881/trainjapan-planner
What It Does
- Deterministic Offline Routing Engine (
src/engine/):- Pure TypeScript earliest-arrival timetable search over a curated representative dataset (8 major Japanese rail corridors, 37 bilingual EN/JA stations, 104 daily services across 06:00–22:30).
- Evaluates JR Pass coverage & surcharges (catching the classic Nozomi / Mizuho supplement trap and offering a covered-only Hikari / Sakura alternative).
- Scales realistic station transfer minimums across three instant Transfer Pace buttons (
0.8× Brisk,1.0× Standard,1.5× Relaxed)—switching Demo 2 (Tokyo → Hakata) to1.5×immediately reroutes around a tight 10-minute Shin-Osaka transfer.
- Interactive Paper Jikokuhyo & Pure-SVG Train Diagram (列車ダイヤ):
- Authentic printed timetable grid with
レ(pass-through),∥(bypassed),指(all-reserved),JR, and+¥symbols. Clicking any itinerary leg circles its boarding and alighting cells in red grease pencil (○); clicking any stop cell lets you plan directly from that train (Plan from here). - Toggle to Train Diagram (列車ダイヤ) to view a zero-dependency Marey time-distance SVG chart where steeper Nozomi stringlines visibly overtake Hikari trains, with the selected leg highlighted in crimson.
- Authentic printed timetable grid with
- Retro Kippu Slip, Inspection Stamp, & Zero-Backend Sharing:
- Printable
@media printticket slip, pure-CSS 改札入鋏 (ticket-gate inspection stamp) animation,localStorageoffline Saved Trips Pocket, and URL Hash sharing (#plan=STA_SHIN_OSAKA~STA_KANAZAWA~400~1~0) so travelers can share offline itineraries without any server.
- Printable
- Verified True Offline Mode:
- A cache-first Service Worker (
public/sw.js) parsesindex.htmlduringinstallto precache hashed./assets/chunks immediately, plus a Tunnel Test (トンネル模擬) toggle andnavigator.onLinelive indicator.
- A cache-first Service Worker (
How I Built It with Kiro (Specs + Steering + Hooks + Property Tests)
Because I built this solo as a university junior under a tight 36-hour sprint window alongside another competition deadline and upcoming finals, unstructured vibe-coding would have caused scope creep and broken edge cases. Kiro's Spec-Driven Development workflow kept the entire build disciplined across two iterations:
1. Steering Files Locked the Architecture Early (.kiro/steering/)
I defined three workspace steering documents up front:
-
product.md— enforced the Resurrection framing, single-feature depth, and honest framing of the bundled schedule as a curated representative reference timetable. -
tech.md— mandated Vite + React 19 + TypeScript (strict: true), integer minutes since00:00(preventingDate/timezone bugs), zero React/DOM imports insrc/engine/, and zero external network requests. -
structure.md— defined exact folder boundaries and three mandatory verification gates (validate:timetables,typecheck,test,build).
2. Iterative Spec-Driven Development (Two Complete Specs in .kiro/specs/)
- Phase 1 Spec (
.kiro/specs/jikokuhyo-offline-planner/): Kiro generatedrequirements.mdin strict EARS syntax (WHEN ... THE SYSTEM SHALL ...),design.md(including Mermaid architecture and 14 formal correctness properties), and a wave-orderedtasks.md. - Phase 2 Spec (
.kiro/specs/resurrection-polish/): Once the core PWA deployed cleanly, I added a second feature spec to plan and execute the SVG Train Diagram, Tunnel Test toggle, Kippu gate stamp, URL hash sharing, bidirectional grid clicking, andfast-checkproperty tests cleanly without breaking existing contracts.
3. Dual Kiro Agent Hooks Guarded Data & Engine (.kiro/hooks/)
Instead of relying on manual discipline, I wired two v1 PostFileSave Kiro hooks:
-
timetable-integrity.json— watchessrc/data/.*\.json$and runsnpm run validate:timetables(checking monotonic timestamps, valid station references, direction ordering, and JR Pass rules). -
engine-test-guard.json— watchessrc/engine/.*\.ts$and runsnpm testautomatically.
4. Model-Based Property Testing with fast-check
Using Kiro, I paired src/engine/router.ts against an independent brute-force earliest-arrival reference oracle in src/engine/__tests__/generators.ts and properties.test.ts (100 random iterations per property across generated multi-line interchange graphs), verifying:
- Earliest-arrival optimality vs. the independent oracle
- Strict determinism and transfer-pace monotonicity (
arrival(0.8×) <= arrival(1.0×) <= arrival(1.5×)) - JR Pass coverage/surcharge summation consistency
- Round-trip integrity for both
SavedTrip(localStorage) andshareHashURL encoding
All 57 automated tests (34 unit/UI + 19 fast-check property tests + 4 Phase-2 integration tests) pass in ~2.5s locally and in GitHub Actions CI.
Verifying Offline Mode Yourself
- Open https://jia881.github.io/trainjapan-planner/ (or click Tunnel Test in the top bar for an instant preview).
- Open Chrome DevTools → Network → switch throttling to Offline.
- Reload the page: the Service Worker serves the entire app and timetable dataset locally (
OFFLINE MODE ACTIVE — LOCAL TIMETABLE,0 API Calls / SW Active, zero console errors). - Switch between Jikokuhyo 時刻表 and Train Diagram 列車ダイヤ, toggle 1.5× Relaxed pace, stamp your Kippu, and test printing.
Takeaways
Using Kiro's Steering + two sequential Specs + Agent Hooks turned a 36-hour solo student sprint into a reproducible engineering pipeline: zero external dependencies, 57 passing tests including oracle-backed property tests, and an offline Japanese railway desk that resurrects the craft of paper timetables for modern travelers.
Check out the live app at jia881.github.io/trainjapan-planner and the full .kiro/ workflow at github.com/jia881/trainjapan-planner!