No description
Find a file
2017-09-25 20:25:18 +02:00
api initial commit 2017-09-25 20:19:57 +02:00
auth initial commit 2017-09-25 20:19:57 +02:00
cmd initial commit 2017-09-25 20:19:57 +02:00
database initial commit 2017-09-25 20:19:57 +02:00
email initial commit 2017-09-25 20:19:57 +02:00
logging initial commit 2017-09-25 20:19:57 +02:00
models initial commit 2017-09-25 20:19:57 +02:00
public add example SPA client 2017-09-25 20:25:18 +02:00
templates/email initial commit 2017-09-25 20:19:57 +02:00
testing initial commit 2017-09-25 20:19:57 +02:00
vendor vendor dependencies with dep 2017-09-25 20:20:52 +02:00
.gitignore initial commit 2017-09-25 20:19:57 +02:00
Gopkg.lock vendor dependencies with dep 2017-09-25 20:20:52 +02:00
Gopkg.toml vendor dependencies with dep 2017-09-25 20:20:52 +02:00
main.go initial commit 2017-09-25 20:19:57 +02:00
README.md initial commit 2017-09-25 20:19:57 +02:00

Go Restful API Boilerplate

Easily extendible RESTful API boilerplate aiming to follow idiomatic go and best practice.

Features

  • PostgreSQL support including migrations using go-pg
  • Structured logging with Logrus
  • Routing with chi router
  • JWT Authentication using jwt-go with passwordless email authentication (could be easily extended to use passwords instead)
  • Configuration using viper
  • CLI features using cobra
  • dep for dependency management

Environment Variables

Name Type Default Description
PORT int 3000 http port
LOG_LEVEL string debug log level
LOG_TEXTLOGGING bool false defaults to json logging
DATABASE_URL string postgres://postgres:postgres@localhost:5432/gobase?sslmode=disable PostgreSQL connection string
AUTH_LOGIN_URL string http://localhost:3000/login client login url as sent in login token email
AUTH_LOGIN_TOKEN_LENGTH int 8 length of login token
AUTH_LOGIN_TOKEN_EXPIRY int 11 login token expiry in minutes
AUTH_JWT_SECRET string random jwt sign and verify key - value "random" sets random 32 char secret at startup
AUTH_JWT_EXPIRY int 15 jwt access token expiry in minutes
AUTH_JWT_REFRESH_EXPIRY int 60 jwt refresh token expiry in minutes
EMAIL_SMTP_HOST string email smtp host
EMAIL_SMTP_PORT int email smtp port
EMAIL_SMTP_USER string email smtp username
EMAIL_SMTP_PASSWORD string email smtp password
EMAIL_FROM_ADDRESS string from address used in sending emails
EMAIL_FROM_NAME string from name used in sending emails