mizu new command creates a new Mizu project by generating files from a template. Think of templates as starter kits - each one sets up a complete project structure so you can start coding right away instead of creating files manually.
Basic Usage
[path]- Where to create the project (optional, defaults to current directory)--template- Which template to use (required)
Quick Examples
Understanding the Command
When you runmizu new myapp --template api, here’s what happens:
- Creates the directory - A new folder called
myappis created - Generates files - Template files are copied with your project name filled in
- Sets up Go module - The
go.modfile is created with the correct module path - Reports success - Shows you what was created
Available Templates
To see all available templates:Flags Reference
Required Flags
Optional Flags
Detailed Flag Explanations
—template, -t (Required)
Specifies which template to use. This is the only required flag.—list
Lists all available templates without creating a project.—dry-run
Shows exactly what files would be created without actually creating them. This is useful for:- Previewing the project structure
- Checking for conflicts before overwriting
- Understanding what a template includes
—force
Overwrites existing files without asking. Use this carefully!--force, if files already exist:
—name
Sets the project name explicitly. By default, the name is derived from the path.- Package names
- Log messages
- Config files
—module
Sets the Go module path. This is important for imports within your project.- Other packages import your code
- You run
go getto download your project - Go resolves dependencies
github.com/username/project- For GitHub projectsexample.com/project- For local developmentcompany.com/team/project- For internal projects
—license
Sets the license identifier. Default isMIT.
—var (Custom Variables)
Pass custom variables to templates. This flag can be used multiple times..Vars.key. Template authors can document which variables their templates support.
Working with Paths
Current Directory
Create files in the current directory:New Directory
Create a new directory for the project:Nested Path
Create a project in a nested path:Absolute Path
You can also use absolute paths:JSON Output
For scripting and automation, use--json:
JSON with Dry Run
Combine--json with --dry-run to get a machine-readable plan:
JSON Error Output
Errors are also returned as JSON:Common Workflows
Start a New Project
The most common workflow:Preview Before Creating
If you’re unsure what a template contains:Start Fresh
If you want to reset a project to the template defaults:Scripted Project Creation
For automation (CI/CD, scripts):Template Variables
Templates have access to these built-in variables:
Plus any custom variables you pass with
--var.
Error Messages
Unknown Template
mizu new --list to see valid template names.
Files Already Exist
--force to overwrite, or choose a different path.
Invalid Path
Exit Codes
Next Steps
After creating a project:Run Your Project
Start the development server
Explore Templates
Learn what each template includes