Skip to content
/ go-api-template Public template

Boilerplate of Go project for API server with Lint, Docker, Air, Gin, CI/CD, Git Hooks (Lefthook) and more.

Notifications You must be signed in to change notification settings

wiyco/go-api-template

Repository files navigation

go-api-template

Gin starter repository.

Docs

Development

  1. Linter
  2. Running the app

Linter

First, you need to install golangci-lint.

Please run the following script according to your environment:

Tip

Make sure that ~/go/bin is exist in PATH.

macOS

brew install golangci-lint

Windows & Linux

curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "$(go env GOPATH)/bin" v1.60.3

Important

For Windows, use Git Bash.

Running the app

Run with Docker to develop with live-reloading (hot-reload).

docker compose up

API route is localhost:8080 as the root.

Modules

  1. air
  2. godotenv
  3. gorm
  4. uuid

1. air

Used for live-reloading (hot-reload) development.

Environment variables library such as dotenv (e.g. .env).

3. gorm

ORM library.

4. uuid

Used to generate UUIDs.

About

Boilerplate of Go project for API server with Lint, Docker, Air, Gin, CI/CD, Git Hooks (Lefthook) and more.

Resources

Stars

Watchers

Forks