Use this file to discover all available pages before exploring further.
The mizu contract command helps you work with service contracts. A contract defines what your API can do - the methods, their inputs, and their outputs. This command lets you discover, explore, call methods, view schemas, and export specifications like OpenAPI directly from the command line.
A service contract defines the interface of your API:
What methods are available
What data each method accepts
What data each method returns
When you build APIs with the contract template, your services are automatically discoverable. The mizu contract command lets you explore and interact with these APIs from the command line.
# List all available methodsmizu contract ls# Show details about a specific methodmizu contract show todo.Create# Call a method with JSON datamizu contract call todo.Create '{"title":"Buy milk"}'# Export the OpenAPI specificationmizu contract spec > openapi.json
By default, commands connect to http://localhost:8080. You can change this in several ways:
# Pass as argumentmizu contract ls http://api.example.com# Use the --url flagmizu contract ls --url http://api.example.com# Use environment variableexport MIZU_URL=http://api.example.commizu contract ls
todo todo.Create POST /api/todo Create a new todo item todo.List GET /api/todo List all todo items todo.Get GET /api/todo/{id} Get a todo by ID todo.Update PUT /api/todo/{id} Update a todo item todo.Delete DELETE /api/todo/{id} Delete a todo item
todo.Create POST /api/todo Create a new todo itemInput (CreateTodoInput): title string required The title of the todo item description string Optional description priority integer Priority level (1-5)Output (Todo): id string required Unique identifier title string required Todo title description string Description completed boolean required Completion status createdAt string required Creation timestamp
# Start by listing what's availablemizu contract ls# Pick a method and see its detailsmizu contract show users.Create# Try calling itmizu contract call users.Create '{"name":"Alice","email":"alice@example.com"}'
# In terminal 1: Run your servermizu dev# In terminal 2: Test your methodsmizu contract call todo.Create '{"title":"Test item"}'mizu contract call todo.List
#!/bin/bash# Verify API is working# Wait for server to startsleep 5# Check discovery worksif ! mizu contract ls --json > /dev/null; then echo "API discovery failed" exit 1fi# Check a specific methodRESULT=$(mizu contract call health.Check)if [ $? -ne 0 ]; then echo "Health check failed" exit 1fiecho "API is healthy"