> ## Documentation Index
> Fetch the complete documentation index at: https://docs.go-mizu.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Quick Start

> Build your first Mizu app in 5 minutes.

This guide gets you from zero to running app as fast as possible. You'll create a simple JSON API with one route.

## Prerequisites

* Go 1.22 or later installed ([download](https://go.dev/dl/))
* A terminal and text editor

Verify Go is installed:

```bash theme={null}
go version
# go version go1.22.0 darwin/arm64
```

## Step 1: Create a project

```bash theme={null}
mkdir myapp && cd myapp
go mod init myapp
```

## Step 2: Install Mizu

```bash theme={null}
go get github.com/go-mizu/mizu
```

## Step 3: Create main.go

Create a file named `main.go`:

```go theme={null}
package main

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

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

    app.Get("/", func(c *mizu.Ctx) error {
        return c.JSON(200, map[string]string{
            "message": "Hello, Mizu!",
        })
    })

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

## Step 4: Run it

```bash theme={null}
go run main.go
```

You'll see:

```
INFO server starting addr=:3000
```

## Step 5: Test it

Open a new terminal and run:

```bash theme={null}
curl http://localhost:3000
```

You'll get:

```json theme={null}
{"message":"Hello, Mizu!"}
```

Press `Ctrl+C` in the first terminal to stop the server.

## What just happened?

1. **`mizu.New()`** created an app with a router and default middleware
2. **`app.Get("/", ...)`** registered a handler for GET requests to "/"
3. **`c.JSON(200, ...)`** sent a JSON response with status 200
4. **`app.Listen(":3000")`** started the HTTP server

## Add more routes

Expand your `main.go`:

```go theme={null}
package main

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

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

    // Homepage
    app.Get("/", func(c *mizu.Ctx) error {
        return c.JSON(200, map[string]string{
            "message": "Hello, Mizu!",
        })
    })

    // Get user by ID
    app.Get("/users/{id}", func(c *mizu.Ctx) error {
        id := c.Param("id")
        return c.JSON(200, map[string]string{
            "id":   id,
            "name": "User " + id,
        })
    })

    // Create a user
    app.Post("/users", func(c *mizu.Ctx) error {
        var input struct {
            Name string `json:"name"`
        }
        if err := c.BindJSON(&input, 1<<20); err != nil {
            return c.JSON(400, map[string]string{"error": err.Error()})
        }
        return c.JSON(201, map[string]string{
            "id":   "123",
            "name": input.Name,
        })
    })

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

Test the new routes:

```bash theme={null}
# Get a user
curl http://localhost:3000/users/42

# Create a user
curl -X POST http://localhost:3000/users \
  -H "Content-Type: application/json" \
  -d '{"name": "Alice"}'
```

## Project structure

For larger apps, organize code into packages:

```
myapp/
├── main.go           # Entry point
├── go.mod
├── go.sum
├── handlers/         # HTTP handlers
│   └── users.go
├── services/         # Business logic
│   └── user.go
└── models/           # Data types
    └── user.go
```

## What's next?

<CardGroup cols={2}>
  <Card title="Core Concepts" icon="book-open" href="/guides/concepts/overview">
    Learn how Mizu components work together.
  </Card>

  <Card title="Build an API" icon="code" href="/guides/first-api">
    Create a complete REST API tutorial.
  </Card>

  <Card title="Project Structure" icon="sitemap" href="/guides/project-structure">
    Best practices for organizing your code.
  </Card>

  <Card title="Deployment" icon="cloud" href="/guides/deployment">
    Deploy your app to production.
  </Card>
</CardGroup>
