A simple go backend template using :
- gin web framework
- atlas for migrations
- sqlc to compile SQL queries to type-safe go code
postgresql
with the pgx driverdocker
for easy deployment and good local dx- goth to manage multi-provider auth, right now only Google added (see .env.example)
Auth is configured to send a short-lived jwt token. There is an endpoint to refresh the token.
There is also a github action configured to run test and migrate database when updates are pushed on prod
branch
gh repo clone aecsar/go-backend
# copy .env.example to .env and add values
# start development with docker compose
make dev
# run tests
make test
# run coverage
make coverage
# create a new migration
# make sure to have atlas installed
curl -sSf https://atlasgo.sh | sh
# create the migration
# make sure to have sqlc installed
brew install sqlc
make generate-migration name=your_migration_name
# run migrations
make migrate-up