storyblok (CLI)
The storyblok CLI enables developers to manage spaces via the Management API with tools for migrations, components, and schema type generation.
Requirements
Section titled “Requirements”- Node.js LTS (version 22.x or higher is recommended)
Installation
Section titled “Installation”Install the CLI globally by running the following command:
npm install -g storyblok@lateststoryblok [command] [subcommand] [options]Example
Section titled “Example”A complete example illustrating the package’s functionalities: pulling components from a space and storing them locally in separate files, enabling developers to edit the schemas.
storyblok components pull --space 12345 --separate-filesThis command will fetch all components and their dependencies (folders, tags, whitelists) from the space 12345, generating the following folder structure on your root:
.storyblok/└── components/ └── 12345/ ├── COMPONENT_NAME.json # Single component ├── groups.json # Component groups ├── COMPONENT_NAME.presets.json # Component presets └── tags.json # Component tagsFrom this point the user can modify the schemas locally, add them to version control and push them to a space.
Commands
Section titled “Commands”| Command | Description |
|---|---|
login | Authenticate via email or token. Credentials stored in ~/.storyblok/credentials.json. |
create | Scaffolds a new project using Storyblok with the preferred technology stack. |
user | Retrieve the current authenticated user details. |
languages pull | Fetch the languages configured for the space’s Internationalization. |
components pull | Fetch available components and their dependencies (Folders, Tags, Whitelists) from a space. |
components push | Push local components to a space. |
datasources pull | Fetch available datasources and their entries. |
datasources push | Push local datasources to a space. |
datasources delete | Delete a datasource. |
migrations generate | Create a migration file for a specific component in a space. |
migrations run | Execute migrations for stories in a space. |
migrations rollback | Revert migrations previously applied to stories within a space. |
types generate | Generate TypeScript declaration files (.d.ts) based on Storyblok component schemas. |
signup | Open the Storyblok signup page in the browser to create a new user account. |
logout | Log out of a Storyblok account and remove stored credentials. |
Global options
Section titled “Global options”| Flag | Description | Default |
|---|---|---|
-v, --verbose | Enable verbose output for debugging and error reporting. | false |
-s, --space | Target’s space ID. Available only for space operations. | |
-p, --path | Path to store and read resources from. Available only for operations that generate local artifacts. | .storyblok |
Get in touch with the Storyblok community