Modern Go starter using Fiber v2 and sqlx with a pragmatic developer workflow.
- Go 1.24
- Fiber v2 HTTP framework
- sqlx with PostgreSQL (
lib/pq) - Environment management via
godotenv - JWT utilities (
github.com/golang-jwt/jwt/v5) - Error tracking with Sentry (optional)
- Google Cloud Storage helper (optional)
- Live reload with Air (
.air.toml,./bin/air) - Database migrations with golang-migrate
- Dockerfile for production builds
- Makefile with common tasks
.
├─ .air.toml
├─ .env.example
├─ Dockerfile
├─ Makefile
├─ public/
│ ├─ docs/
│ └─ email-template/
├─ script/
│ ├─ setup.sh
│ ├─ release.sh
│ └─ bump-version.sh
├─ src/
│ ├─ app/
│ │ └─ database/
│ │ └─ migrations/ # migration .sql files
│ ├─ config/
│ ├─ lib/
│ └─ main.go # application entrypoint
├─ bin/ # local tools (air, migrate, etc.)
├─ go.mod
└─ go.sum
- Go 1.24+
- PostgreSQL database
- golang-migrate
- Global:
brew install golang-migrate(macOS), or see https://github.com/golang-migrate/migrate - Or adjust
CMD_MIGRATEinMakefileto point to your local binary
- Global:
- Clone the repository
- Copy environment file
cp .env.example .env
- Edit
.envand set at least:APP_NAME,APP_ENV,APP_PORTDB_CONNECTION,DB_HOST,DB_PORT,DB_USERNAME,DB_PASSWORD,DB_DATABASE
- Create your database in PostgreSQL
- Run database migrations
make db/migration/up
- Start in development mode (hot-reload)
App runs on
make dev
http://localhost:${APP_PORT}
- help: show available commands
make help - deps/update: upgrade deps and tidy
make deps/update
- db/migration/create: create a new migration
make db/migration/create # then enter a name, files appear in src/app/database/migrations - db/migration/up / down: apply or rollback migrations
make db/migration/up make db/migration/down
- build: produce a binary into
./cmd/${APP_NAME}make build
- start: build and run the binary
make start
- setup, release, release/bump: utility scripts under
script/ - tag/staging, tag/release: create version tags for deployments
- Local development reads
.env(viagodotenv). - Migrations use
DATABASE_URLderived from theDB_*variables inMakefile. - Air config is in
.air.tomland uses./bin/airby default.
Build a minimal production image and run it:
docker build -t gofi:local .
docker run --env-file .env -p 8000:8000 gofi:localNotes:
- The container exposes port
8000by default. - Ensure your env vars are suitable for the container environment (e.g., DB host is reachable from the container).
- This template doesn’t ship opinionated test/lint tools by default. Add your preferred stack (e.g.,
go test ./...,golangci-lint) as needed.
This project is licensed under the terms of the MIT License. See LICENSE.md.