Skip to content

crazyoptimist/gin-starter

Repository files navigation

Gin Starter

This is a REST API boilerplate.

It uses:

  • Gin for routing
  • Gorm with Postgres database
  • Viper for configuration management
  • JWT for authentication
  • Swagger for API documentation
  • Air for live reloading in development
  • Redis for caching

Development

Install air for live reloading.

go install github.com/cosmtrek/air@latest
air

Test

make test

Build

make build

Binaries will be generated inside PROJECT_ROOT/bin/

DB Migration

make migrate

API Documentation

gin-swagger is used for API documentation.

To browse the API documentation, open BASE_URL/swagger/index.html.

Generate/update docs:

go install github.com/swaggo/swag/cmd/swag@latest

make docs

License

MIT

Made with ❤️ by crazyoptimist