Easily extendible RESTful API boilerplate aiming to follow idiomatic go and best practice.
The goal of this boiler is to have a solid and structured foundation to build upon on.
Any feedback and pull requests are welcome and highly appreciated. Feel free to open issues just for comments and discussions.
The following feature set is a minimal selection of typical Web API requirements:
- Configuration using viper
- CLI features using cobra
- PostgreSQL support including migrations using go-pg
- Structured logging with Logrus
- Routing with chi router and middleware
- JWT Authentication using jwt-go with example passwordless email authentication
- Request data validation using ozzo-validation
- HTML emails with gomail
- Clone this repository
- Create a postgres database and set environment variables for your database accordingly if not using same as default
- Run the application to see available commands:
go run main.go
- First initialize the database running all migrations found in ./database/migrate at once with command migrate:
go run main.go migrate
- Run the application with command serve:
go run main.go serve
- Go to http://127.0.0.1:8001/recruiter-api/v1/swagger to view the swagger API docs
chechout src/web/docs
folder for swagger API documentation
Package auth/pwdless contains example api tests using a mocked database.