# Data flow — storybookjs/storybook

> Canonical page: https://codevetter.com/unpack/storybook/data-flow

# Data flow — storybookjs/storybook

Scanned commit dc9b30e8fd8a71383ec01b9510f38bee51457e8a (2026-10-02). Generated by codevetter codevetter 1.15.0 on 2026-10-02.

Source inspection; upstream code and tests were not executed.

Configuration enters through CLI options and project presets, then supplies story discovery, builders, and runtime feature gates. The server produces an index whose import paths connect static discovery to executable preview modules. Channel events carry selections, args, and results between realms. Persistence is explicit: browser preferences, rewritten story files, static snapshots, and instance discovery records have different owners.
- dev() combines CLI input with a default ./.storybook config directory, development mode, cache, and package metadata before withTelemetry invokes buildDevStandalone(). — [code/core/src/cli/dev.ts#L37-L62](https://github.com/storybookjs/storybook/blob/dc9b30e8fd8a71383ec01b9510f38bee51457e8a/code/core/src/cli/dev.ts#L37-L62)
- Story specifiers are normalized once and shared by reference; watched story changes invalidate individual index entries, while preview configuration changes invalidate the complete index. — [code/core/src/core-server/dev-server.ts#L38-L50](https://github.com/storybookjs/storybook/blob/dc9b30e8fd8a71383ec01b9510f38bee51457e8a/code/core/src/core-server/dev-server.ts#L38-L50) [code/core/src/core-server/utils/index-json.ts#L41-L58](https://github.com/storybookjs/storybook/blob/dc9b30e8fd8a71383ec01b9510f38bee51457e8a/code/core/src/core-server/utils/index-json.ts#L41-L58)
- extractStories converts an absolute source path to an importPath, derives titles from the matching specifier, and delegates extraction to the first matching indexer's createIndex(). — [code/core/src/core-server/utils/StoryIndexGenerator.ts#L400-L422](https://github.com/storybookjs/storybook/blob/dc9b30e8fd8a71383ec01b9510f38bee51457e8a/code/core/src/core-server/utils/StoryIndexGenerator.ts#L400-L422)
- StoryStore resolves storyId through the index, calls importFn(importPath), processes the CSF exports, combines story/component/project annotations, and initializes args and hook state. — [code/core/src/preview-api/modules/store/StoryStore.ts#L149-L155](https://github.com/storybookjs/storybook/blob/dc9b30e8fd8a71383ec01b9510f38bee51457e8a/code/core/src/preview-api/modules/store/StoryStore.ts#L149-L155) [code/core/src/preview-api/modules/store/StoryStore.ts#L195-L224](https://github.com/storybookjs/storybook/blob/dc9b30e8fd8a71383ec01b9510f38bee51457e8a/code/core/src/preview-api/modules/store/StoryStore.ts#L195-L224)
- Manager updateStoryArgs emits UPDATE_STORY_ARGS with a ref target; Preview.onUpdateArgs updates the args store, rerenders or remounts matching renders, and emits STORY_ARGS_UPDATED. — [code/core/src/manager-api/modules/stories.ts#L758-L764](https://github.com/storybookjs/storybook/blob/dc9b30e8fd8a71383ec01b9510f38bee51457e8a/code/core/src/manager-api/modules/stories.ts#L758-L764) [code/core/src/preview-api/modules/preview-web/Preview.tsx#L350-L369](https://github.com/storybookjs/storybook/blob/dc9b30e8fd8a71383ec01b9510f38bee51457e8a/code/core/src/preview-api/modules/preview-web/Preview.tsx#L350-L369)
- Controls serializes changed args with csfId/importPath; initializeSaveStory parses them, mutates the selected CSF export or duplicate, formats printed source, and writes the file. — [code/core/src/controls/manager.tsx#L38-L54](https://github.com/storybookjs/storybook/blob/dc9b30e8fd8a71383ec01b9510f38bee51457e8a/code/core/src/controls/manager.tsx#L38-L54) [code/core/src/core-server/utils/save-story/save-story.ts#L62-L105](https://github.com/storybookjs/storybook/blob/dc9b30e8fd8a71383ec01b9510f38bee51457e8a/code/core/src/core-server/utils/save-story/save-story.ts#L62-L105)
- Manager Store.setState first awaits React's state update, then persists the delta through a URL handler, session storage, or local storage; initial state gives session values precedence over local values. — [code/core/src/manager-api/store.ts#L89-L96](https://github.com/storybookjs/storybook/blob/dc9b30e8fd8a71383ec01b9510f38bee51457e8a/code/core/src/manager-api/store.ts#L89-L96) [code/core/src/manager-api/store.ts#L136-L158](https://github.com/storybookjs/storybook/blob/dc9b30e8fd8a71383ec01b9510f38bee51457e8a/code/core/src/manager-api/store.ts#L136-L158)
- Static service queries require load/staticPath/staticInputs, validate each input, execute against fresh runtimes, merge snapshots by logical path, and serialize JSON into outputDir/services. — [code/core/src/shared/open-service/server.ts#L66-L116](https://github.com/storybookjs/storybook/blob/dc9b30e8fd8a71383ec01b9510f38bee51457e8a/code/core/src/shared/open-service/server.ts#L66-L116) [code/core/src/shared/open-service/server.ts#L125-L135](https://github.com/storybookjs/storybook/blob/dc9b30e8fd8a71383ec01b9510f38bee51457e8a/code/core/src/shared/open-service/server.ts#L125-L135)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
