An opinionated golang boilerplate that uses golang community standards project layout.
This project follows SOLID & Clean Architecture.
It could be used as monolith or microservices, just put the backend parts on internal
folder.
Below are the steps if you want to run locally without docker
-
Set required environment variable
ENV=local
-
Set configuration
Change
config/local.yaml
configuration value properly and make sure can connect to blank MySQL database properly -
Run migration
make migrate
-
Add seed data
make seed
-
Run app
make run
-
Open the browser
Visit the url
go test -v ./internal/user/...
Below are the steps if you want to run locally with docker & docker compose
-
Build docker image
Generate the docker imgae by this command:
docker build --rm -t starterkitapi -f dockerfile.api .
-
Run with docker compose
Copy the sample.env to .env and adjust it then run the docker compose with this command:
docker-compose up
-
Open the browser
Visit the url
-
Quit & Cleanup
Click Ctrl+C to quit in console then run these commands below to clean up all things:
docker-compose rm -v
Golang Project Layout https://github.com/golang-standards/project-layout
Go REST API starter kit https://github.com/qiangxue/go-rest-api
Go Starter Kit https://github.com/qreasio/go-starter-kit
Ari Maulana - maulana.ari@protonmail.com