goscaf generates opinionated, production-quality Go project boilerplate via an interactive CLI. Stop copy-pasting skeleton code between projects. Start with:
- Graceful shutdown with OS signal handling
- Structured JSON logging (slog, zerolog, or zap)
- Your choice of HTTP framework (gin, fiber, chi, echo, gorilla/mux)
- Viper-powered config with
.envsupport - Optional infra clients: Redis, Kafka, NATS
- Multi-stage distroless Dockerfile + docker-compose
- Makefile, GitHub Actions CI, golangci-lint - ready to go on day one
go install github.com/iyashjayesh/goscaf@latestbrew install goscaf-dev/tap/goscafgit clone https://github.com/iyashjayesh/goscaf.git
cd goscaf
make installgoscaf init my-apiSample prompt flow:
? Module name: (github.com/your-org/my-api)
? Go version: (1.25.0)
? HTTP framework: gin
? Structured logger: slog (stdlib)
? Add Viper for config & env management? (Y/n)
? Add Redis client (go-redis)? (y/N)
? Add Kafka client (franz-go)? (y/N)
? Add NATS client? (y/N)
? Add Dockerfile + docker-compose? (Y/n)
? Add Makefile? (Y/n)
? Add GitHub Actions CI? (Y/n)
? Add golangci-lint config? (Y/n)
? Add Swagger/OpenAPI scaffold? (y/N)
βββββββββββββββββββββββββββββββββββββββββββ
Scaffolding project: my-api
Module: github.com/your-org/my-api
Go: 1.25.0
Framework: gin
Logger: slog
βββββββββββββββββββββββββββββββββββββββββββ
β cmd/main.go
β go.mod
β .gitignore
β .env.example
β internal/config/config.go
β internal/handler/handler.go
β internal/server/server.go
β Dockerfile
β docker-compose.yml
β Makefile
β .github/workflows/ci.yml
β .golangci.yml
β Running go mod tidy...
β go mod tidy
β Project created successfully!
Next steps:
cd my-api
cp .env.example .env
make docker-up
make run
goscaf init my-api --defaults
goscaf init my-api --framework fiber --logger zap --redis --kafka --docker| Flag | Default | Description |
|---|---|---|
--module |
"" |
Go module path |
--go-version |
1.25.0 |
Go version (1.23, 1.24, 1.25) |
--framework |
gin |
HTTP framework (gin|fiber|chi|echo|gorilla|none) |
--logger |
slog |
Structured logger (slog|zerolog|zap) |
--viper |
true |
Add Viper for config & env management |
--redis |
false |
Add Redis client (go-redis/v9) |
--kafka |
false |
Add Kafka client (franz-go) |
--nats |
false |
Add NATS client |
--docker |
true |
Add Dockerfile + docker-compose |
--makefile |
true |
Add Makefile |
--github |
true |
Add GitHub Actions CI |
--lint |
true |
Add golangci-lint config |
--swagger |
false |
Add Swagger/OpenAPI scaffold |
--defaults |
false |
Skip all prompts, use recommended defaults |
--output |
. |
Output directory |
my-api/
βββ cmd/
β βββ main.go # Entrypoint with graceful shutdown
βββ internal/
β βββ config/
β β βββ config.go # Viper (or stdlib) config loader
β βββ server/
β β βββ server.go # HTTP server for chosen framework
β βββ handler/
β βββ handler.go # HTTP handlers
βββ pkg/
β βββ redis/redis.go # (if selected) go-redis wrapper
β βββ kafka/kafka.go # (if selected) franz-go producer+consumer
β βββ nats/nats.go # (if selected) NATS client wrapper
βββ .github/
β βββ workflows/ci.yml
βββ .env.example
βββ .gitignore
βββ .golangci.yml
βββ Dockerfile
βββ docker-compose.yml
βββ go.mod
βββ Makefile
| Target | Description |
|---|---|
make run |
go run ./cmd/main.go |
make build |
Build binary to bin/<name> |
make test |
go test -race -cover ./... |
make test-coverage |
Generate coverage.html report |
make lint |
golangci-lint run ./... |
make fmt |
gofmt -s -w . && goimports -w . |
make tidy |
go mod tidy |
make docker-up |
docker compose up -d |
make docker-down |
docker compose down |
make docker-logs |
docker compose logs -f app |
make clean |
Remove bin/, coverage.* |
make install-tools |
Install golangci-lint + goimports |
| Flag value | Import path |
|---|---|
gin |
github.com/gin-gonic/gin |
fiber |
github.com/gofiber/fiber/v2 |
chi |
github.com/go-chi/chi/v5 |
echo |
github.com/labstack/echo/v4 |
gorilla |
github.com/gorilla/mux |
none |
stdlib net/http |
# Clone and build
git clone https://github.com/iyashjayesh/goscaf.git
cd goscaf
make build
# Run the smoke test
make smoke-testPRs welcome! Please open an issue first for major changes.