Case study
The Backroads Challenge
A flag game covering 196 countries with three difficulty tiers, a countdown timer, streaks, passport stamps, and a saved best score. First built in vanilla JavaScript, then rebuilt as a React component in 2026.
- Built with
- React · TypeScript · Tailwind CSS · flagcdn
- Try it
- Play the quiz

The idea
Travelling makes you realise how much of the world you can't place on a map. I wanted something that would help me, and anyone else, learn flags and capitals in a way that feels like a game rather than a flashcard deck.
Most geography quizzes I tried were either too easy or brutally hard. So the Backroads Challenge has three fixed tiers, and you pick the one that matches what you know.
How it plays
- The Boardroom (easy). The 32 best-known countries. The capital is shown as a clue, and there's no timer.
- The Backroads (medium). Around 100 countries. You're asked for the country or its capital, the wrong options come from the same region, there's one hint per flag, and a 25-second countdown.
- The Explorer (hard). The flag and nothing else, options from the same continent, a 15-second countdown, and all 196 countries in play.
Each round is ten flags. Correct answers build a streak and earn a passport stamp. The results page grades you as an Explorer, Traveler, or Tourist, lists the countries you missed with their capitals, and saves your best score for each level.
Version 1: vanilla JavaScript
The first version was a single script with no framework: game state, timers, and DOM updates by hand, a circular SVG countdown, and the 196-country dataset embedded in the file so the game needed no API. Flags came from flagcdn.com by country code, with the next flag preloaded.
Version 2: the 2026 rebuild
When I redesigned this site, the quiz was the one page that still looked and behaved like the old one. An audit also found a real bug: the flag image's alt text named the country, so screen readers read out the answer. I rebuilt it as a React component with:
- Separated game logic. Round building, answer options, and grading are pure TypeScript functions, kept apart from the interface.
- A fairer timer. The countdown starts only once the flag has loaded, and you choose your level on a start screen instead of being dropped into a timed question.
- One-screen play on phones. Flag, question, and a two-by-two answer grid fit without scrolling.
- Keyboard and screen reader support. Answer with 1–4, move on with Enter, and hear the result announced, without the answer leaking early.
- Reasons to replay. Passport stamps, a best score saved on your device, a review of misses, and a share button.
What I learned
- Accessibility bugs can be game bugs. A helpful-looking alt text quietly gave away every answer.
- DOM timing is subtle. Caching an element at script load pointed at a skeleton React had already removed. Querying at the moment of use fixed it.
- SVG goes a long way. The timer needed no canvas and no animation library.
- Event delegation needs
closest(). Adding letter badges inside answer buttons broke click handling until I matched one.target.closest('.option-btn').
Play the Backroads Challenge and see how far you get on Explorer.