boilerplate code for http api server on go with stdlib, chi, pgx, go-redis, log/slog, oapi-codegen, fx, and sqlc
- clone repository
- run
make renameto rename repository and project names- repository name :
pocj8ur4in/boilerplate-go->your-username/your-repository-name - project name :
boilerplate->your-project-name
- repository name :
- change names of directories and files
internal/app/boilerplate->internal/app/your-project-namecmd/boilerplate->cmd/your-project-namegrafana/provisioning/dashboards/boilerplate-dashboard.json->grafana/provisioning/dashboards/your-project-name-dashboard.json
- run
make prepareto update dependencies and continue setup - create
config.jsonfile by copyingconfig.example.jsonand changing the values - add github actions secrets on your github repository
CODECOV_TOKEN: for codecov
- register your repository on codecov
- push to your github repository
- run
make docker devto run the application in development mode with docker compose - run
make go testto run the tests (some tests require docker to be running) - run
make go buildto build the application - run
make go runto run the application
- fork this repository
- create a new branch
- make your changes
- run
make go lintto run linter (golangci-lint) - run
make go fmtto run formatter (golangci-lint) - run
make go secto run security scan (gosec) - run
make openapi generateto generate OpenAPI spec (openapi spec files in /api directory) - run
make sqlc generateto generate SQL code (sql files in /sql directory) - create a pull request and check if github actions are passing
- wait for the pull request to be merged
This project is licensed under the MIT License - see the LICENSE file for details.