All projects
WikiWeaver — Turn any Wikipedia article into a structured, visual knowledge map.
Web · React Native · cloudWorking prototype

WikiWeaver

Turn any Wikipedia article into a structured, visual knowledge map.

Why this exists

A Wikipedia article is a wall of prose with a structure hidden inside it — entities, patterns, frameworks, the people who matter, the books that anchor it. Existing tools either summarise or do vector search; neither shows you the *shape* of the topic. The brief was an LLM that doesn’t summarise but classifies, so the structure that’s implicit in the text becomes explicit and explorable.

The proof point

AI as a categoriser, not a chatbot. The value here isn’t generation — it’s the ontology the model imposes (15 purpose-based categories, importance scored 1–10, frequency counted) over otherwise unstructured prose. Bolt that to a contract-first API (OpenAPI as source of truth, Zod and React Query hooks generated from the same spec) and the same model serves a web app, a native mobile app, and a design-QA sandbox without the contract drifting.

How it works

WikiWeaver is a pnpm-workspaces monorepo: an Express 5 API server, a React 19 + Vite web client, a React Native + Expo mobile client, and a Vite-based component sandbox. All three clients consume the same generated API client; the OpenAPI spec in `lib/api-spec` is the source of truth, and Orval generates both the Zod validators and the React Query hooks from it. Contracts can’t drift because the clients don’t hand-write them.

The web client queries Wikipedia directly for search and article fetch, then posts the article text to `/api/ontology/extract`. The server first checks an `ontology_cache` keyed on `(userId, title)`; on a miss, it calls OpenAI with a purpose-based classification prompt that emits 10–30 entities across the 15 categories and persists the result. Cache hits skip the model entirely — and repeat visits cost nothing.

The UI is built around the structure the model returns: a tabbed facts browser with frequency filtering and per-item filtering, an interactive force-directed mind map of entities and their relationships, and a chat-style exploration thread that interleaves Wikipedia results with extracted facts. History is local-first for guests and synced to Postgres for signed-in users; exports cover PDF, DOCX, Markdown, and plain text.

Architecture

Web
React 19 · primary client
Mobile
React Native · Expo
Sandbox
component preview
Contract
OpenAPI · single source of truth
API server
Express 5 · auth · ontology
PostgreSQL
Drizzle · ontology cache
OpenAI
purpose-based classifier
Wikipedia API
client-direct
OpenAPI is the source of truth; Orval generates Zod validators and React Query hooks for every client. The contract cannot drift.

What an architect can take from it

  1. 01OpenAPI → generated Zod + React Query hooks is the cleanest cross-client contract there is. The spec is the API; the clients can’t lie.
  2. 02Cache LLM responses by their natural key — `(user, article)` here. Most expensive AI flows in production are doing work they already did.
  3. 03“AI as categoriser” is an underexploited pattern. When the value is the *structure* imposed over content, the model is a classifier, not a generator.