- Run
docker-compose up
- Make sure you have go:1.15+ installed
- Create a config file in /etc/boiler/config.toml (use setup/config.toml as a reference)
- Start a postgres database and configure the host,name,user and password in /etc/boiler/config.toml
- Run setup/init.sql in postgres console.
- Run
go build -o boiler && ./boiler
You may run into permission issues because it will try to create private key file and log file. You may just run the binary with sudo (not recommended)
Add -f argument while running the binary to write log into file instead of stdout.
utils/
(utility functions)setup/
(docker-compose, config samples and initial sql file)models/
routes/
(API endpoint routes and middlewares)store/
(initialisation of database and other dependencies)api/
(API handler functions)postman/
(Postman exports)
/api/v1/auth/signup
/api/v1/auth/login
/api/v1/auth/logout
/api/v1/profile
You can find the postman exports in postman/
github.com/go-chi/chi
for routinggithub.aaakk.us.kg/go-playground/validator/v10
for validating json fieldsgithub.aaakk.us.kg/golang-jwt/jwt
for jwt tokensgithub.aaakk.us.kg/google/uuid
for generating UUIDgithub.aaakk.us.kg/sirupsen/logrus
for logginggithub.aaakk.us.kg/spf13/viper
for reading config filegithub.aaakk.us.kg/stretchr/testify
for mocks
- user:
string
- password:
string
- host:
string
- port:
string
- name:
string
(database name) - ssl:
boolean
(if SSL is enabled or not) - caCertPath:
string
(only applies if SSL is enabled) - userCertPath:
string
(only applies if SSL is enabled) - userKeyPath:
string
(only applies if SSL is enabled)
- logging:
enum{"TRACE","DEBUG","ERROR","INFO"}
listen: string
(listen address, for example: "127.0.0.1:8081" )
- used postgres as database.
- used JWT for authentication instead of saving tokens in database.
- added an extra
/api/v1/profile
API to show full authentication flow.