- Install golang 1.17
- open project
- run in terminal/bash/powershell/anything that works in that OS
go get
go mod tidy
- proceed install SQLBoiler by using:
go install github.com/volatiletech/sqlboiler/v4@latest
go install github.com/volatiletech/sqlboiler/v4/drivers/sqlboiler-mysql@latest
*note: if using postgres use sqlboiler-psql instead of sqlboiler-mysql. though i'm not sure if the migration works in postgres or need adjustment, just try it. - copy
sqlboiler.toml.example
tosqlboiler.toml
- copy
.env.example
to.env
- edit database configuration in both
sqlboiler.toml
and.env
- run migration by running
go run .\migration\migrate.go --up
- install Fiber CLI for hot reload support
go get -u github.com/gofiber/cli/fiber
- run the server by
fiber dev
- any changes to code will be automatically recompiled
- run the command
./make_migration.sh {name}
or.\make_migration.ps1 {name}
, thentimestamp_{name}.up.sql
andtimestamp_{name}.down.sql
is created - in up.sql insert any sql query to add/modify tables
- in down.sql insert any sql query that revert anything did in up.sql
- Apply migration:
go run .\migration\migrate.go --up
this will apply all available migrations - Revert migration:
go run .\migration\migrate.go --down --step={number}
replace {number} with how many version needed to revert if not specified, only revert 1 version - Force migration version:
go run .\migration\migrate.go --force={version_number}
- Check current version:
go run .\migration\migrate.go
- Build for current OS:
.\build.ps1
|./build.sh
- Build for other OS:
.\build.ps1 {OS} {ARCH}
|./build.sh {OS} {ARCH}
- replace {OS} and {ARCH} with valid value
See OS and ARCH list here
example, windows creating linux x64 binary using
.\build.ps1 linux amd64
- there's only checking mechanism for this boilerplate, proceed by entering data manually to database before testing.
- password used for
users
table is usingbcrypt
, use any online generator or just get some data from laravel projects if any
- App Login
- Cleanup Junk JWT Token
- All these tutorials are made for windows and powershell, but there's bash script just in case for those who's using *nix based machine.