Tommy Westphall Snowglobe
Universe Theory

A tracker for finding, updating, and graphing all the shows pertaining to the Tommy Westphall theory.

What is the Tommy Westphall Snowglobe Universe Theory?

The Tommy Westphall Universe is a theory rooted in the final moments of the St. Elsewhere series finale. In the show’s conclusion, it is revealed that the entire story unfolded within the mind of an autistic boy, represented by a snow globe. This theory, first proposed by Dwayne McDuffie, suggests that a large number of fictional episodic television shows exist within a single fictional universe imagined by Tommy Westphall. These shows are theorized to be interconnected through television crossovers, spin-offs, and shared characters, settings, products, and locations, all contributing to a vast fictional universe that exists entirely within the boy’s imagination.

The Main Attraction

How this problem was solved

The project turns the "Tommy Westphall Universe" fan theory — the idea that hundreds of TV shows are secretly connected through character and setting crossovers — into an interactive, explorable graph. The build had three parts. First, a Python scraper pulls the canonical list of connected shows from the Tommy Westphall Fandom wiki using its MediaWiki API, rather than parsing raw HTML, which is far more reliable and avoids the anti-scraping walls that blocked earlier attempts against IMDB. Second, that same script infers crossover relationships (edges) by checking which show pages link to which other show pages within the dataset, then writes the results out as nodes.json and edges.json. Third, a React front end built on ReactFlow fetches that JSON at runtime and renders it as a graph, using the dagre layout engine to auto-position hundreds of nodes so the graph stays readable instead of needing manual placement. A search bar highlights matching shows and fades everything else, making it usable even at full scale.

Technologies used

The front end is a Create React App project using React 19, ReactFlow (@xyflow/react) for the graph canvas, and dagre for automatic graph layout. Data collection is handled by a small Python script using the requests library against Fandom's MediaWiki JSON API. The site is static and deploys to GitHub Pages via the gh-pages npm package. Data flows one-directionally: Python scraper → JSON files → fetched by the React app at runtime, so the front end never needs to know how the data was gathered.

Future steps to improve the project

Worth tackling next: caching/rate-limiting the scraper more aggressively so it can run on a schedule (e.g. GitHub Actions) and keep the graph current automatically; adding metadata to each node (network, air years, poster art) so clicking a show shows more than just its name; clustering or filtering by network/genre/decade so the graph is easier to explore at 500+ nodes; adding a "shortest path" feature so users can ask "how is Show A connected to Show B"; and writing tests for the layout and data-loading logic.