/go-chi-template

Starter template for building RESTful APIs in Go with Chi

Primary LanguageGoMIT LicenseMIT

go-chi-template

A simple and idiomatic REST API boilerplate in Go using Chi, designed for clarity, modularity and extensibility.
Includes Swagger documentation, basic validation and a clean separation of concerns.

โœจ Features

  • ๐Ÿงฑ Modular project structure (cmd/, internal/)
  • ๐Ÿ”€ Routing and middleware with chi
  • ๐Ÿ“„ Swagger UI documentation (/docs)
  • โœ… Request validation with go-playground/validator
  • ๐Ÿงช Unit-test friendly structure
  • ๐Ÿณ Minimal Docker support
  • ๐Ÿงฐ Designed as a reusable starter template

๐Ÿ“ฆ Technologies

  • Go 1.22+
  • chi v5
  • logrus
  • swaggo/swag for Swagger
  • go-playground/validator

๐Ÿš€ Getting Started

# Install swag if not already installed
go install github.com/swaggo/swag/cmd/swag@latest

# Generate Swagger docs
swag init -g cmd/server/main.go

# Run the server
go run ./cmd/server