CLI
The Saastro CLI helps you initialize your project and add components.
Installation
You can run the CLI directly with npx:
npx saastro <command>
Or install it globally:
npm install -g saastro
Commands
init
Initialize your project with Saastro UI configuration.
npx saastro init
This command will:
- Create a
components.jsonconfiguration file - Configure your Tailwind CSS
- Add required CSS variables
- Set up the
cnutility function
Options:
| Option | Description |
|---|---|
-y, --yes | Skip confirmation prompts |
-c, --cwd <path> | Set working directory |
add
Add components to your project.
npx saastro add [components...]
Examples:
# Add a single component
npx saastro add button
# Add multiple components
npx saastro add button card badge
# Add all components
npx saastro add --all
Options:
| Option | Description |
|---|---|
-y, --yes | Skip confirmation prompts |
-o, --overwrite | Overwrite existing files |
-a, --all | Add all available components |
-p, --path <path> | Custom path for components |
diff
Check for updates to components.
npx saastro diff [component]
Shows the difference between your local component and the registry version.
Configuration
The CLI uses a components.json file in your project root:
{
"$schema": "https://ui.saastro.io/schema.json",
"style": "default",
"tailwind": {
"config": "tailwind.config.mjs",
"css": "src/styles/globals.css",
"baseColor": "slate"
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils"
}
}
Configuration Options
| Property | Description |
|---|---|
style | The style preset to use (default, new-york) |
tailwind.config | Path to your Tailwind config file |
tailwind.css | Path to your global CSS file |
tailwind.baseColor | Base color for the theme |
aliases.components | Import alias for components |
aliases.utils | Import alias for utilities |
Registry
Components are fetched from the Saastro registry at https://ui.saastro.io/r/.
You can also use a custom registry by setting the SAASTRO_REGISTRY_URL environment variable.