
2026-09-10
Some projects start with a technical question. This one started with a gift idea: make taking the subway instead of driving feel a little more rewarding, and a lot more fun.
The result is You + The Subway, "a very serious relationship tracker". You open it on your phone, press one big button that says I took the subway today 🚇, and watch the money you didn't spend on driving add up. Meanwhile, the app slowly narrates your car's heartbreak.
You can try it at subway-girlfriend.web.app.
Setup, the day-30 milestone with confetti, and the dashboard
Because it was a gift, the bar wasn't "feature-complete". It was "delightful to use every single day". That meant a few rules:
localStorage. No sign-up, no server, nothing to break or pay for.The fun part only works if the number is believable. "Trips × ticket price" overstates the savings. The real comparison is what driving would have cost minus what the subway costs.
On first launch, the app asks for four numbers: kilometers you'd drive per day, cost per kilometer, the monthly toll (bom in Norwegian) you'd pay if driving, and the price of a monthly subway pass. Every logged day then contributes:
function netSavingsForDay(settings, iso) { const daysInMonth = daysInMonthFor(iso) const { kmPerDay, costPerKm, bomMonthly, metroMonthlyFee } = settings return kmPerDay * costPerKm + bomMonthly / daysInMonth - metroMonthlyFee / daysInMonth }
With the defaults (40 km/day at 3.50 kr/km, a 2,500 kr monthly toll and a 393 kr pass), a day in a 30-day month is worth:
The subway pass is a flat monthly fee. The obvious approach is to subtract it as one lump sum, but then the counter would sit at 0 kr for the first few days of every month while you "pay off" the pass. That feels terrible on exactly the days you most need encouragement.
Instead, both the toll and the pass are spread across every day of the month. Savings show up from day one, and if you ride consistently, it nets out to the same honest total by the end of the month. If your numbers ever make the running total negative (say, a short commute), the app doesn't show a scary minus sign. It shows a small 🔒 note with how many kroner are left before the pass is covered.
Weekly, monthly and all-time stats
Every logged day is stored as a plain "YYYY-MM-DD" string. The tempting shortcut, new Date().toISOString().slice(0, 10), is a classic bug: toISOString() converts to UTC, so late in the evening in Norway it can already return tomorrow's date, and you'd log the wrong day. Building the string from local date parts avoids that entirely:
function isoDate(date) { const y = date.getFullYear() const m = String(date.getMonth() + 1).padStart(2, '0') const d = String(date.getDate()).padStart(2, '0') return `${y}-${m}-${d}` }
A nice side effect: ISO date strings sort correctly as plain strings, so "is this day in this week?" becomes a simple string comparison like iso >= start && iso <= end.
The streak counts consecutive days ending today. But if it required today, every streak would show as broken each morning until you'd actually ridden. So the count starts from today if it's logged, and from yesterday otherwise:
export function computeStreak(loggedDays) { const logged = new Set(loggedDays) let cursor = logged.has(todayISO()) ? todayISO() : addDays(todayISO(), -1) let streak = 0 while (logged.has(cursor)) { streak++ cursor = addDays(cursor, -1) } return streak }
You can also tap any day on the calendar to fix a mistake or fill in a day you forgot. A habit tracker that can't forgive a forgotten tap gets abandoned quickly.
The personality lives in a list of milestone messages that escalate as the day count grows:
export const MILESTONES = [ { days: 100, message: "100 days. The subway wants to meet your parents." }, { days: 60, message: "60 days. Your car filed a missing person report." }, { days: 30, message: "30 days?! At this point, you're basically dating the subway." }, { days: 7, message: "A full week! Your car is starting to think you're seeing someone else." }, { days: 3, message: "Your car misses you." }, // ... ]
The list is sorted highest first, and the first entry you've reached wins. Adding a new joke is a one-line change, which made it easy to keep adding them.
Hitting a milestone day (1, 3, 7, 14, 21, 30, 60, 100) also fires confetti. It's about 40 lines of plain DOM: 60 small colored rectangles (in subway-line colors) with a randomized CSS fall animation, cleaned up a few seconds later. Pulling in a library felt like overkill for one celebratory burst.
It's a Vite + React + Tailwind app, built to static files and deployed on Firebase Hosting with a GitHub Action, so pushing to main updates the live site. Since there's no backend, hosting is just files, and the app works the same whether one person or a hundred use it.