Building a Graph Component Library
Case study — designing and shipping a React network-graph library for several teams, and why rendering tech, API shape and Storybook mattered most.
On this page
At Sky I led the design and delivery of a React component library for visualising networks: nodes, links, groupings, and the interactions people need to understand a network at a glance. Several teams and external clients were going to use it, which shaped almost every decision. This is what I learnt — patterns, not internals.
The problem
Teams were relying on a capable commercial graph library, but we wanted something we owned: themeable for different products, testable, and fast enough for large networks.
Decision 1: rendering technology beats API niceties
The biggest risk wasn’t features; it was scale. DOM and SVG rendering are pleasant to work with but fall over once you reach a few thousand nodes. Canvas gets you further. WebGL keeps a ten-thousand-node graph interactive because the GPU does the heavy lifting.
So we benchmarked candidate libraries with generated graphs at 100, 1,000 and 10,000 nodes before writing any product code. The benchmark made the decision obvious and settled a debate that opinions alone wouldn’t have.
Decision 2: match the old API, then improve it
To make adoption painless we kept the public API close to the library we were replacing. That let teams move screen by screen instead of all at once — progressive overload for a codebase.
Decision 3: headless, compound components
A library used by several products will never match any one product’s design, so we shipped behaviour with minimal styling and exposed composable parts — canvas, panels, zoom controls — plus events for selection and editing. More on that pattern in Headless Component Libraries.
Decision 4: Storybook as the contract
Every functional requirement got a story. Stakeholders could see progress without a demo meeting, developers could build features in isolation, and interaction tests ran against the same stories. Storybook became the shared definition of done.
What I’d do again
- Benchmark the scary requirement first.
- Make migration incremental by design, not by heroics.
- Treat documentation and demos as part of the product, not an afterthought.
What I’d do differently
Decide earlier how the package and its Storybook live together. Keeping stories beside components is fastest for development, but you also want to test that the built package imports and renders correctly in a consuming app.
- #graph-visualisation
- #react
- #webgl
- #storybook
- #component-libraries
↩ Linked from (8)
Shift Left Testing · Removing Secrets from Git History · Building a Graph Component Library
These notes were the groundwork for an in-house network graph library — the full story is in Building a Graph Component Library, and the API design lessons in Headless Component Libraries. Storybook became the place wher…
- Headless Component LibrariesGrowing
…ed, when three products are using the same library and nobody has forked it. I learnt this most clearly while Building a Graph Component Library.
- Pathways into CybercrimeGrowing
…choosing WebGL graph renderers and building an in-house network graph library (Graph Visualisation Libraries, Building a Graph Component Library). Now I build real-time data interfaces for a living. The problems are diff…
When I replaced a commercial graph library with our own, we didn't swap it in one release. We matched the old API closely enough that screens could move across one at a time — see the case study.
- Social Network AnalysisGrowing
…regation of parallel edges, and a renderer that copes with thousands of nodes (Graph Visualisation Libraries, Building a Graph Component Library). Graph thinking is one of the most portable skills I have.
- StorybookGrowing
…n-house network graph library, where it was the docs, the demo and the test harness at once — the story is in Building a Graph Component Library. The design principles that make components story-friendly are in Headless…
…twork logic of each use case was core and belonged with the teams who understood it. The same thinking shaped Building a Graph Component Library: we built in-house only once it was clear the capability was specific enoug…
↪ Links to (2)
Related by topic
- Growingcase study
Smart TV Apps on Low-End Devices
Frontend craft - Growingcase study
Building a Low-Code BPMN Workflow Platform
Frontend craft - Growingcase study
Chairing a Cross-Team UI Guild
Career - Growingcase study
Driving a TypeScript Codebase to Zero Errors
Frontend craft