What is the Mizu CLI?
The CLI offers:mizu new: Create new projects from templatesmizu dev: Run development server with hot reloadmizu contract: Generate SDKs and OpenAPI specsmizu version: Show version information
Installation
Using Go Install
$GOPATH/bin is in your PATH:
Verify Installation
Creating Projects
Basic Usage
Available Templates
| Template | Description | Use Case |
|---|---|---|
minimal | Basic server with one route | Learning, simple services |
api | REST API with validation | APIs, microservices |
contract | Contract-based service | Multi-transport APIs |
web | Server-rendered website | Websites, blogs |
live | Real-time UI updates | Dashboards, chat |
sync | State synchronization | Collaborative apps |
frontend:react | React SPA with Go backend | Full-stack apps |
frontend:vue | Vue SPA with Go backend | Full-stack apps |
frontend:svelte | Svelte SPA with Go backend | Full-stack apps |
mobile:flutter | Flutter app backend | Mobile backends |
mobile:reactnative | React Native backend | Mobile backends |
Examples
Template Options
Development Server
Basic Usage
- Automatic recompilation on file changes
- Fast restart
- Preserved terminal output
Options
With Frontend
For full-stack projects, run both servers:Contract Operations
Generate SDKs
Generate OpenAPI Spec
Contract Options
Project Structure by Template
Minimal Template
API Template
Contract Template
Frontend Template (React)
Global Flags
Available for all commands:| Flag | Description |
|---|---|
--help, -h | Show help |
--version, -v | Show version |
--verbose | Verbose output |
--json | Output as JSON |
--no-color | Disable colored output |
Exit Codes
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error |
| 2 | Invalid arguments |
| 3 | File/directory error |
| 4 | Network error |
Common Workflows
New API Project
Full-Stack Project
Generate Client SDKs
Production Build
Configuration
Environment Variables
| Variable | Description | Default |
|---|---|---|
MIZU_PORT | Default port | 3000 |
MIZU_ENV | Environment | development |
MIZU_LOG_LEVEL | Log level | info |
Config File
Create.mizu.yaml in your project: