An open API service indexing awesome lists of open source software.

https://github.com/go-mizu/mizu

Zero-dependency web framework built entirely on Go's standard library
https://github.com/go-mizu/mizu

framework go

Last synced: 30 days ago
JSON representation

Zero-dependency web framework built entirely on Go's standard library

Awesome Lists containing this project

README

          

# Mizu

[![Go Reference](https://pkg.go.dev/badge/github.com/go-mizu/mizu.svg)](https://pkg.go.dev/github.com/go-mizu/mizu)
[![Go Report Card](https://goreportcard.com/badge/github.com/go-mizu/mizu?v=0.2.2)](https://goreportcard.com/report/github.com/go-mizu/mizu)
[![Codecov](https://codecov.io/gh/go-mizu/mizu/graph/badge.svg?token=zgSciJ8HJz)](https://codecov.io/gh/go-mizu/mizu)

> A lightweight, composable web framework for Go.


Mizu logo

Mizu [ć°´] - means waterđź’§ in Japanese - helps you build clear and reliable web applications using modern Go. It keeps things simple, close to the standard library, and gives you the control you expect as a Go developer.

### Overview

Mizu is designed to make building web servers in Go straightforward and enjoyable. It provides just enough structure to handle routing, middleware, templates, and streaming without hiding how `net/http` works underneath.

Everything in Mizu is built to feel natural to Go developers. You can start with a few lines of code, and as your project grows, the same patterns still apply. There are no custom DSLs or hidden global states—just plain Go that compiles fast and reads cleanly.

### Quickstart

Install Mizu and create a simple web app:

```bash
go get github.com/go-mizu/mizu@latest
```

Create `main.go`:

```go
package main

import "github.com/go-mizu/mizu"

func main() {
app := mizu.New()

app.Get("/", func(c *mizu.Ctx) error {
return c.Text(200, "Hello, Mizu!")
})

app.Listen(":3000")
}
```

Run it:

```bash
go run main.go
```

Open [http://localhost:3000](http://localhost:3000) in your browser.

### CLI Installation

The Mizu CLI provides project scaffolding and development tools.

**Using Go install:**

```bash
go install github.com/go-mizu/mizu/cmd/mizu@latest
```

This downloads and installs the CLI from the published module.

**From source (for development):**

```bash
git clone https://github.com/go-mizu/mizu.git
cd mizu
make workspace # Creates go.work for local development
make install
```

This builds the CLI using your local changes and installs to `$HOME/bin`. Ensure this directory is in your `PATH`.

**Verify installation:**

```bash
mizu version
```

### Using the CLI

The CLI provides commands for creating projects, running development servers, working with service contracts, and exploring middlewares.

**Create a new project:**

```bash
# List available templates
mizu new --list

# Create a project from a template
mizu new ./myapp --template minimal

# Create a frontend project with a specific framework
mizu new ./myapp --template frontend:react
mizu new ./myapp --template frontend:vue

# Preview what will be created (dry run)
mizu new ./myapp --template api --dry-run
```

Available templates include:
- `minimal` - Smallest runnable Mizu project
- `api` - JSON API service with recommended layout
- `web` - Full-stack web app with views and components
- `contract` - Code-first API contract with REST, JSON-RPC, and OpenAPI
- `live` - Real-time interactive app with live views
- `sync` - Offline-first app with sync and reactive state
- `frontend:*` - Frontend frameworks (react, vue, svelte, angular, next, nuxt, htmx, alpine, preact, sveltekit)
- `mobile:*` - Mobile apps (ios, android, flutter, dotnet, reactnative)

**Run in development mode:**

```bash
cd myapp
mizu dev

# Pass arguments to your application
mizu dev -- --port 3000
```

The `dev` command auto-detects your main package (checking `cmd/` or the current directory) and runs it. Use `--cmd` to specify a custom path if needed.

**Work with service contracts:**

```bash
# List all methods from a contract
mizu contract ls

# Show method details
mizu contract show todo.Create

# Call a method
mizu contract call todo.Create '{"title":"Buy milk"}'

# Export OpenAPI spec
mizu contract spec > openapi.json

# Generate code from a contract definition
mizu contract gen contract.go
```

**Explore middlewares:**

```bash
# List all available middlewares
mizu middleware ls

# Filter by category
mizu middleware ls -c security

# Show middleware details
mizu middleware show helmet
```

**Global flags:**

| Flag | Description |
|----------------|-----------------------------------|
| `--json` | Emit machine-readable JSON output |
| `--no-color` | Disable colored output |
| `-q, --quiet` | Reduce output to errors only |
| `-v, --verbose`| Increase verbosity (repeatable) |
| `-h, --help` | Show help |

### Contributing

Mizu is an open project, and everyone is welcome.
If you enjoy Go and want to help build a clean, modern framework, you are encouraged to contribute.

You can:

- Report issues or suggest improvements
- Improve examples and documentation
- Write middleware or helper packages
- Share your ideas and feedback in GitHub discussions

Every contribution helps make Mizu better. Thoughtful code, good design, and clear documentation are all equally valuable.

### License

MIT License © 2025 Mizu Contributors

Mizu keeps web development in Go clear, explicit, and enjoyable from the first line of code to production.