go-chi/chi

Web Framework
import "github.com/go-chi/chi/v5"

Lightweight, idiomatic HTTP router for Go built on net/http. Composable middleware.

Example

package main

import (
    "net/http"
    "github.com/go-chi/chi/v5"
)

func main() {
    r := chi.NewRouter()
    r.Get("/", func(w http.ResponseWriter, r *http.Request) {
        w.Write([]byte("Hello!"))
    })
    http.ListenAndServe(":3000", r)
}

Key Types & Functions

NewRouterMuxRouterURLParamMiddleware

About go-chi/chi

The go-chi/chi package (imported as github.com/go-chi/chi/v5) belongs to the Web Framework category of Go packages. Lightweight, idiomatic HTTP router for Go built on net/http. Composable middleware.

Go's standard library is one of the language's greatest strengths, providing production-ready implementations for networking, cryptography, encoding, I/O, and more. The go-chi/chi package follows Go's philosophy of simplicity and composability — small, focused packages that combine through interfaces like io.Reader and io.Writer.

When using go-chi/chi in production, follow Go best practices: handle errors explicitly, use context for cancellation and timeouts, prefer composition over inheritance, and write table-driven tests. The Go documentation at pkg.go.dev provides comprehensive API references and examples for every exported type and function.

Related Packages