Knowledge Base updated: 2026-11-19
Storybook knowledge base
Orientation
Storybook is a TypeScript monorepo for developing, testing, documenting, and distributing UI components. Its product runtime comprises a Node-based server and CLI, a browser manager application, and a browser preview that renders user stories.
code/core contains the shared runtime contracts, configuration and preset resolution, server orchestration, manager, and preview APIs. Framework, renderer, builder, and addon packages adapt that core to application technologies and product features.
Monorepo tooling lives in code/lib, scripts, workspace configuration, and CI-oriented utilities. External compatibility validation is maintained separately in ecosystem-qa, while test applications and sandboxes exercise supported integrations.
Critical runtime state crosses the manager/preview boundary through shared channel events and preview annotations. Build and server state is assembled from user configuration, presets, framework and builder selection, and generated manifests.
flowchart TD
User[Storybook user project] --> CLI[CLI and core-server]
CLI --> Presets[Preset and config resolution]
Presets --> Frameworks[Framework packages]
Frameworks --> Builders[Vite / Webpack builders]
Builders --> Server[Development server / static build]
Server --> Manager[Manager UI]
Server --> Preview[Preview runtime]
Manager <--> Channel[Shared channel APIs]
Preview <--> Channel
Preview --> Renderers[Renderer packages]
Renderers --> Stories[CSF stories and components]
Addons[Addon ecosystem] --> Manager
Addons --> Preview
Tooling[CLI, codemods, automation] --> User
QA[Ecosystem QA and test fixtures] --> Tooling
flowchart LR
Config[User configuration] --> CoreServer[core-server]
CoreServer --> Select[Framework and builder selection]
Select --> Dev[Development mode]
Select --> Build[Static build]
Dev --> Manifests[Story and MDX manifests]
Build --> Output[Static Storybook output]
Glossary
- CSF: Component Story Format, the module format Storybook analyzes to identify stories and metadata.
- Manager: The browser application that provides Storybook navigation, controls, settings, and addon panels.
- Preview: The browser runtime that loads and renders selected stories.
- Preset: A composable configuration layer used to select and configure Storybook features, frameworks, and builders.
- Autoblock: CLI tooling that detects unsupported or incompatible project conditions and blocks or guides upgrades.
Codebase-wide invariants
- Manager and preview communication uses shared channel contracts rather than direct runtime coupling; see
code/core/src/manager/**andcode/core/src/preview-api/**. - Core-server assembles behavior through presets and manifests, so framework and builder integrations must be selected through core configuration paths; see
code/core/src/core-server/presets/**andcode/core/src/core-server/utils/manifests/**. - Package-manager behavior is centralized behind the common package-manager abstraction; see
code/core/src/common/js-package-manager/**. - Framework packages adapt applications while renderer packages own framework-facing preview rendering; see
code/frameworks/**andcode/renderers/**. - Repository upgrade safeguards are implemented in CLI tooling and must remain covered by tests; see
code/lib/cli-storybook/src/autoblock/**.
Routing table
code/core/src/common/**-> Storybook runtime architecturecode/core/src/core-server/**-> CLI and server lifecyclecode/core/src/manager/**-> Manager UIcode/core/src/preview-api/**-> Preview runtime and story renderingcode/core/src/csf-tools/**-> Story format and analysiscode/lib/csf-tools/**-> Story format and analysiscode/frameworks/**-> Framework and build integrationcode/builders/builder-vite/**-> Vite and Webpack builderscode/builders/builder-webpack5/**-> Vite and Webpack builderscode/frameworks/angular/**-> Framework packagescode/frameworks/angular-vite/**-> Framework packagescode/frameworks/react-*/**-> Framework packagescode/frameworks/vue*/**-> Framework packagescode/frameworks/svelte*/**-> Framework packagescode/frameworks/nextjs/**-> Framework packagescode/renderers/**-> Renderer packagescode/presets/react-webpack/**-> Webpack presetscode/presets/server-webpack/**-> Webpack presetscode/addons/**-> Addon ecosystemcode/addons/a11y/**-> User-facing addonscode/addons/docs/**-> User-facing addonscode/addons/links/**-> User-facing addonscode/addons/onboarding/**-> User-facing addonscode/addons/pseudo-states/**-> User-facing addonscode/addons/themes/**-> User-facing addonscode/addons/vitest/**-> Testing and agent addonscode/addons/mcp/**-> Testing and agent addonscode/lib/**-> Developer workflowscode/lib/cli-storybook/**-> Project setup and migrationcode/lib/codemod/**-> Project setup and migrationtest-storybooks/**-> Testing fixtures and sandboxescode/sandboxes/**-> Testing fixtures and sandboxesscripts/**-> Repository automation and release tooling- nx.json -> Repository automation and release tooling
.github/**-> Repository automation and release toolingagent-eval/**-> Agent evaluation platformecosystem-qa/**-> Ecosystem quality assurance