Quickstart
Install sb-mig, configure Storyblok credentials, and run the first safe commands.
Quickstart
Requirements
sb-mig 6.x requires Node.js 22 or Node.js 24+.
node --versionInstall
Install the CLI globally:
npm install --global sb-migOr run it through your package manager in project scripts.
Configure credentials
Create a .env file in the project where you run sb-mig:
STORYBLOK_OAUTH_TOKEN=your-management-token
STORYBLOK_SPACE_ID=12345
STORYBLOK_ACCESS_TOKEN=your-delivery-tokenThe OAuth token is used for Storyblok Management API writes. The access token is used for Delivery API reads, including translated language publish-state checks.
Optional project config
Create storyblok.config.js or storyblok.config.mjs when defaults are not enough:
export default {
componentsDirectories: ["src", "storyblok"],
schemaFileExt: "sb.js",
datasourceExt: "sb.datasource.js",
rolesExt: "sb.roles.js",
sbmigWorkingDirectory: "sbmig",
};First read-only checks
Start with discovery and inspection commands:
sb-mig discover components --all
sb-mig language-publish-state --from 12345 --languages all --fileName baseline
sb-mig published-layer-export --from 12345 --startsWith blog/ --fileName blog-layersWhen you have a component usage query file, run the beta inspection command without writing to Storyblok:
sb-mig inspect component-usage \
--from 12345 \
--all \
--query flex-group-width-childFirst safe write preview
Run migrations with --dry-run before a real write:
sb-mig migrate content --all \
--from 12345 \
--to 12345 \
--migration migration-name \
--publicationMode preserve-layers \
--dry-run \
--fileName first-previewDry runs write local artifacts under sbmig/migrations and do not update Storyblok.
sb-mig