What is Create Zustand CLI?
Create Zustand CLI is an interactive command-line tool that scaffolds Zustand stores based on your specifications. You answer a series of prompts about your store requirements, and the CLI generates a ready-to-use store file with all the necessary configuration.Key benefits
Save time and effort
No more copying and pasting boilerplate code or manually setting up store structure. The CLI generates everything you need in seconds.Supports multiple configurations
Choose between JavaScript or TypeScript, add persistence with Zustand middleware, define initial state with nested objects, and configure custom actions—all through simple prompts.Consistent store structure
Ensure all your Zustand stores follow the same pattern and best practices across your project.Save default configurations
You can save your preferred settings as defaults to speed up future store creation even more.Features
- Interactive prompts - Answer questions about your store and let the CLI handle the rest
- TypeScript support - Generate fully-typed stores with proper interfaces
- Persistence middleware - Optionally add state persistence to localStorage
- Custom initial state - Define complex initial state with nested objects using JSON
- Action generation - Specify actions to include in your store
- Package manager choice - Works with both npm and yarn
- Custom paths - Define where your store files should be created
- Configuration saving - Save your preferences for faster store creation
The CLI automatically installs Zustand if it’s not already in your project dependencies.
What you’ll create
Depending on your choices, the CLI generates different store templates: Basic JavaScript store:Next steps
Installation
Install the CLI tool on your machine
Quick start
Create your first store in minutes