Skip to main content
An App is the main entry point for your web server. It wraps an HTTP server, manages its lifecycle, and handles graceful shutdown when the process receives a stop signal.

What an App does

When you create an app with mizu.New(), you get:

Create an app

Every Mizu project starts by creating an App:
When this runs:
  1. mizu.New() creates an app with a router and default logger
  2. app.Get("/", ...) registers a handler for GET requests to ”/”
  3. app.Listen(":3000") starts the HTTP server
The terminal shows startup logs:

Starting the server

Mizu provides three ways to start your server:
All three methods block until the server stops. They also handle graceful shutdown when the process receives SIGINT (Ctrl+C) or SIGTERM.

Configuration

Configure the app by setting fields after creation:

Graceful shutdown

When your app receives a stop signal (SIGINT or SIGTERM):
  1. New connections refused - The server stops accepting new connections
  2. Active requests complete - Running requests continue until finished (up to ShutdownTimeout)
  3. Clean exit - Server exits with success status
This prevents dropped connections during deployments. Your load balancer can redirect traffic while the old instance drains.
If requests don’t finish within ShutdownTimeout, they’re terminated.

Health check endpoints

Mizu provides two health check handlers for load balancers and orchestrators like Kubernetes:
How they differ:
  • Liveness (/livez): “Is the process running?” Used by Kubernetes to decide if the pod should be restarted
  • Readiness (/readyz): “Can it handle traffic?” Used by load balancers to route traffic
During graceful shutdown, /readyz returns 503 so load balancers stop sending new traffic, while /livez continues returning 200 so the pod isn’t killed prematurely.

Access the underlying server

For advanced configuration, access the http.Server instance:

Complete example

Next steps

Routing

Define URLs and HTTP methods.

Handler

Write request handling logic.