u/Big_Concentrate58

I built a production-ready Go REST API boilerplate with Gin – feature-based structure, multi-version Swagger, dual DB support
▲ 0 r/golang

I built a production-ready Go REST API boilerplate with Gin – feature-based structure, multi-version Swagger, dual DB support

Hey r/golang!

I've been working on a Go REST API boilerplate that I wanted to share with the community.

After spending too much time figuring out how to structure Go projects,

I put together golang-structure, a clean starting point that makes the

important decisions for you, while leaving the opinionated ones (logger,

error handling, DB driver, email provider) completely up to you.

Key decisions made for you:

- Feature-based (domain-driven) structure — not layer-based

- Multi-version Swagger (v1 + v2) out of the box

- MongoDB + PostgreSQL folders included (you wire them up)

- Air for hot reload, godotenv for env management

- Intentionally minimal main.go

What's left for you to choose:

- Logger (zap, slog, logrus — your call)

- Error handling style

- DB driver (gorm, pgx, mongo-driver — your call)

- Middleware (JWT, CORS, rate limiting — your call)

GitHub: https://github.com/kiwiscode/golang-structure

Would love feedback on the structure, especially from people who've

scaled Go APIs in production. Happy to discuss any decisions made here!

u/Big_Concentrate58 — 5 days ago