
WikiPhilosophy
Search any word on Wikipedia and trace its path to philosophy
Timeline
Nov 2022
Role
Solo
Team
Solo
Status
CompletedTechnology Stack
Key Challenges
- Implementing the first-hyperlink traversal reliably — the first link in a Wikipedia article is buried inside markup, italics, and nested tags, and the algorithm has to skip parens, hatnotes, and citations to find a valid mainspace link
- Handling Wikipedia API edge cases gracefully — disambiguation pages, dead-end articles, missing links, and the small percentage of paths that never reach Philosophy
- Decoupling the Flutter Web frontend from a separate Python backend API, then shipping the frontend as a static PWA on GitHub Pages
- Making Flutter Web feel responsive and installable — PWA support, random keyword search, and a layout that works from phone to desktop out of a single Dart codebase
Key Learnings
- The Getting to Philosophy phenomenon (~95% of Wikipedia articles converge) is a surprisingly fun way to explore the graph structure of human knowledge
- Splitting the frontend and backend into two repos keeps each deployable independently — the static site on GitHub Pages, the API wherever it runs
- Flutter 3.3.6 / Dart 2.18.2 can ship a responsive, installable web app from a single codebase, blurring the line between mobile and web toolkits
- PWA support turns a Flutter web app into something that feels native — add to home screen, offline shell, no app store required
The Problem
There's a well-known internet curiosity: type almost any word into Wikipedia, follow the first hyperlink in that article, then follow the first hyperlink in the next article, and repeat. If you do this long enough — surprisingly often — you end up on the Philosophy page. The phenomenon has been tested and re-tested for over a decade, and somewhere around 95% of articles eventually converge there. It's a fun reminder that Wikipedia's internal link graph is far from random.
The journey is rarely direct. Most paths funnel through a handful of surprisingly common hub articles — Science, Knowledge, Reality, Consciousness — before terminating at Philosophy. Some chains take five hops. Others take twenty. Either way, the exercise always teaches you something you didn't know about how Wikipedia is wired together.
I wanted to see it for myself. Rather than click through dozens of tabs by hand, I built a small app that does the clicking for you and visualises the path.
What I Built
WikiPhilosophy is a Flutter Web app that takes any word, fetches its Wikipedia article, extracts the first valid hyperlink, follows it, and keeps going until it lands on Philosophy. Each step is rendered as a card, so you can watch the journey unfold — and pick up a few things you didn't expect along the way.
It's a frontend-only web app: the heavy lifting (Wikipedia queries, link extraction, traversal) is delegated to a separate Python backend. The Flutter side handles UI, search input, random keyword discovery, and rendering the chain. Built with Flutter 3.3.6 and Dart 2.18.2, packaged as a PWA, deployed to GitHub Pages.
- Frontend: imsudip/wikiphilosophy
- Backend: imsudip/wikiphilosophy-backend-api
- Live: imsudip.github.io/wikiphilosophy
How It Works
The core algorithm is a simple loop, but the details are where it gets interesting:
- Resolve the article. Take the user's search term, hit the backend, and get back a structured article payload (title, parsed body, first link).
- Pick the first valid hyperlink. Wikipedia's body markup is messy — links inside parentheses, italicised terms, citations, and hatnotes all carry
<a>tags. The "first link" has to be the first one that points to another mainspace article, skipping parens, see-also boxes, and footnote markers. - Repeat until you hit Philosophy. Visit that article, extract its first link, and so on. Cap the loop at a reasonable depth (around 50 hops) to guard against dead ends and cycles.
- Return the path. Send the full chain back to the Flutter client, which renders each step as a tappable card.
A typical chain looks something like this:
Coffee → Drink → Liquid → State of matter → Physics → Natural science
→ Science → Knowledge → Epistemology → Philosophy ✓
Ten hops, one surprise: who knew Coffee was a State of matter away from Philosophy?
Architecture
Two repos, two runtimes, one user experience.
Flutter Web (GitHub Pages)
│
├── Search input + random keyword
├── Renders the path as a stack of cards
├── PWA manifest + service worker
│
└── HTTPS → wikiphilosophy-backend-api (Python)
│
├── Wikipedia article fetch + parse
├── First-link extraction
└── Traversal loop with hop cap
Splitting the apps this way made deployment simple: the Flutter build outputs static assets that ship straight to GitHub Pages, while the Python API runs wherever it's hosted. Each repo can evolve independently, and the static frontend has no server-side dependencies at all.
Why Flutter Web?
I was already comfortable with Flutter for mobile, and the same widgets render cleanly on the web. For a small, single-screen app like this, shipping one Dart codebase that targets phone, tablet, and desktop is hard to beat. PWA support means the same bundle is installable on Android and iOS without an app store round-trip.
Features
- Beautiful UI — clean, focused layout that puts the path front and centre
- Search any word — type anything and the traversal starts from that Wikipedia article
- Random keyword search — don't know where to start? A random keyword picker kicks off the journey for you
- Responsive design — works on phone, tablet, and desktop from a single Flutter codebase
- PWA support — installable, app-like experience without going through an app store
- GPL v3.0 — open source, copyleft, free to fork and learn from
Building It Yourself
If you want to run it locally:
git clone https://github.com/imsudip/wikiphilosophy.git
cd wikiphilosophy
flutter pub get
flutter runThe backend lives in a separate repo (imsudip/wikiphilosophy-backend-api) and can be pointed at any compatible API endpoint.
Links
- GitHub: imsudip/wikiphilosophy
- Live: imsudip.github.io/wikiphilosophy
- Backend API: imsudip/wikiphilosophy-backend-api
- License: GPL v3.0
Timeline
The repo was created back in 2021 but sat unused until November 2022, when the WikiPhilosophy project was built in a focused session — Flutter Web frontend plus a separate Python backend API, both pushed in the same week.
- Nov 2022 — Built in a focused session: Flutter Web app implementing the "Getting to Philosophy" first-hyperlink traversal algorithm, with a separate Python backend API; deployed to GitHub Pages
