---
title: Quickstart
description: Create a workers-go project from the Cloudflare template, run it locally, and deploy it.
sidebar:
  label: Quickstart
  order: 1
---

The fastest way to start is the `Deploy to Cloudflare` button, which creates and deploys a project for you — no local setup required.

<a href="https://deploy.workers.cloudflare.com/?url=https%3A%2F%2Fgithub.com%2Fsyumai%2Fworker-go-deploy" target="_blank" rel="noopener"><img src="https://deploy.workers.cloudflare.com/button" alt="Deploy to Cloudflare" /></a>

To create a project manually, follow the steps below.

## Requirements

- Node.js (and npm)
- Go 1.24.0 or later

## Create a project

1. **Create a new Worker project**

    Scaffold a project from the `worker-go` template.

    ```bash
    npm create cloudflare@latest -- --template github.com/syumai/workers-go/_templates/cloudflare/worker-go
    ```

    For a smaller Wasm binary, use the TinyGo template instead. It requires TinyGo 0.42.0 or later — TinyGo 0.41.x cannot build `net/http` for Wasm.

    ```bash
    npm create cloudflare@latest -- --template github.com/syumai/workers-go/_templates/cloudflare/worker-tinygo
    ```

2. **Initialize Go modules**

    ```bash
    cd my-app
    go mod init
    go mod tidy
    ```

3. **Start the dev server**

    ```bash
    npm start
    ```

4. **Verify the worker**

    ```bash
    curl http://localhost:8787/hello
    ```

    You will see **"Hello!"** as the response.

## Write your handler

Implement an `http.Handler` and pass it to `workers.Serve()`.

```go
package main

import (
	"net/http"

	"github.com/syumai/workers-go"
)

func main() {
	http.HandleFunc("/hello", func(w http.ResponseWriter, req *http.Request) {
		w.Write([]byte("Hello!"))
	})
	workers.Serve(nil) // if nil is given, http.DefaultServeMux is used
}
```

## Deploy

```bash
npm run deploy
```

The build pipeline of the template compiles your Go code to Wasm and copies the runtime assets — see [Build and deploy](/cloudflare/build) for how it works under the hood.
