Skip to content

Build web apps in Go, at ease

Routing, data, accounts, queues, mail, storage, search, AI and translations in one framework, built on net/http. One binary runs it all.

From zero to an app with accounts

go install anetos.dev/anetos/cli/cmd/anetos@latest

anetos new blog && cd blog # templ views, sessions, CSRF, SQLite by default
go tool anetos make:auth   # accounts: password, Google, GitHub, API tokens
go run . migrate
go tool anetos dev         # rebuild and reload on every change

go build -o blog . && ./blog   # web, queue workers and the scheduler, in one binary

Handlers that say what they take

Input structs say where each value comes from and how it's checked. The handler gets it ready to use, and returns typed output or an error that becomes the right HTTP response.

// CreateNote binds from JSON or a form; the rules run before the handler.
type CreateNote struct {
	Title string   `json:"title" validate:"required|max:200"`
	Body  string   `json:"body" validate:"max:10000"`
	Tags  []string `json:"tags" validate:"max:5|distinct|alpha_dash"`
}

func (h *Notes) Store(c *web.Ctx, in CreateNote) (web.Responder, error) {
	note := &Note{Title: in.Title, Body: in.Body, Tags: in.Tags}
	if err := db.Create(c, note); err != nil {
		return nil, err
	}
	return web.Created(note), nil // 201, as JSON
}

r.Post("/notes", web.H(h.Store)).Name("notes.store")

Status

Anetos is pre-release: v0.3, the first public version, is in progress, and APIs will change until 1.0. Follow along or help on GitHub; the roadmap says what's done and what's next.