talira

Lightweight, composable HTTP router for Go services built on net/http

open sourceMITfree

chi is a small router for building HTTP services in Go, made for large REST APIs that stay maintainable as they grow. It is fully compatible with net/http, so any standard handler or middleware works with it, and it is built on the context package for request-scoped values, cancellation and timeouts. The core router is about 1,000 lines with no dependencies outside the standard library; optional packages add middleware, response rendering and route documentation generation.

Problems it solves

  • route HTTP requests in a Go REST API without a heavy framework
  • organise a growing Go API into route groups and sub-routers
  • add middleware to Go handlers that stays compatible with net/http

Features

  • Route groups, inline middleware and mounting sub-routers
  • Works with any net/http handler or middleware
  • Request context for values, cancellation and timeouts
  • Optional middleware package (logging, request IDs, recovery and more)
  • docgen generates routing docs as JSON or Markdown
  • No dependencies beyond the Go standard library

Alternatives

The same job

These do what chi does.

  1. Gin The fastest full-featured HTTP web framework for Go
  2. go-restful Lean Go package for building REST-style web services
  3. Echo High performance, minimalist Go web framework
  4. Fiber Express inspired web framework written in Go
  5. go-zero A cloud-native Go microservices framework with a code generation CLI
  6. Iris Web framework for Go whose builder makes out-of-order setup a compile error

Compare chi with the top 3