Template Project of Web Backend API
Use Following Techstack
- Go : Modern Programing Language
- gqlgen : Use GraphQL Schema
- sqlc : SQL based OR Mapper
- dbmate : Migration Tool
- task : Task Runner
Assuming the use of MacOS
- Install followings
- Go 1.23
- Docker Environmet (ex. Docker Desktop)
-
Execute following commands
$ go install github.com/go-task/task/v3/cmd/task@latest $ task setup # add 'export PATH="/opt/homebrew/opt/libpq/bin:$PATH"' to .zshrc etc.
$ task up
# wait a minutes...
$ task migrate # setup db
$ task test
$ task integration-test
$ task gql-gen
# OR Mapper Code from DML
$ task sqlc-gen
# Model Code from DDL
$ task migrate # generate `db/schema.sql` through `dbmate migrate`
$ task sqlc-gen
# migrate
$ task migrate
# rollback
$ task rollback