Production-ready in 90 seconds. No headaches, just clean code.
GRAB is a Go boilerplate that doesn't waste your time β highly tested, Docker-ready, fully documented, with everything you need.
π Full Documentation β’ π Quick Start β’ β¨ Live Demo
You know the pain: Starting a new Go project means days of configuring Docker, wiring up authentication, setting up migrations, writing boilerplate code, and praying your hot-reload actually works.
GRAB changes that.
make quick-start # β One command. 90 seconds. You're building features.This is the real deal. The production-grade boilerplate you wish you had from day one:
β
Clean Architecture β Handler β Service β Repository (GO industry standard)
β
Security & JWT Auth β Rate limiting, CORS, input validation built-in
β
Database Migrations β PostgreSQL with version control & rollback
β
Comprehensive Tests β Unit + integration with CI/CD pipeline
β
Interactive Docs β Auto-generated Swagger + Postman collection
β
Structured Logging β JSON logs with request IDs and tracing
β
Structured Error Handling β Consistent API errors with codes and details
β
Production Docker β Multi-stage builds, health checks, optimized images
β
Environment-Aware β Dev/staging/prod configs + Make automation & more
β
Graceful Shutdown β Zero-downtime deployments with configurable timeouts
β
Hot-Reload (2 seconds!) β Powered by Air, not magic
And that's just scratching the surface. Check the full documentation to see everything GRAB offers.
Not some random structure β follows official Go project layout + battle-tested community patterns from golang-standards/project-layout. The same architecture used by Gin, GORM, and production Go services.
- π Shipping Fast β Launch MVPs and production APIs in days, not weeks
- π₯ Team Projects β Consistent standards everyone understands
- ποΈ Scaling Up β Architecture that grows with your business
- π Learning Go β See how pros structure real-world applications
Get your API running in under 2 minutes:
- Docker and Docker Compose
- Git
π‘ Want to run without Docker? See the Manual Setup Guide in the documentation.
git clone https://github.com/vahiiiid/go-rest-api-boilerplate.git
cd go-rest-api-boilerplate
make quick-startπ Done! Your API is now running at:
- API Base URL: http://localhost:8080/api/v1
- Swagger UI: http://localhost:8080/swagger/index.html
- Health Check: http://localhost:8080/health
Open http://localhost:8080/swagger/index.html to explore and test all endpoints interactively.
Import the pre-configured collection from api/postman_collection.json with example requests and tests.
π Ready to Build?
- π Development Guide β Learn how to add models, routes, and handlers
- π‘ TODO List Tutorial β Complete step-by-step feature implementation from scratch
Most boilerplates give you code. GRAB gives you a professional development workflow.
- JWT-based auth (HS256) β Secure, stateless, ready for production
- Context helpers β Type-safe user extraction (no more casting nightmares)
- Password security β Bcrypt hashing with best-practice cost factor
- Rate limiting β Token-bucket protection against abuse built-in
-
PostgreSQL + GORM β Production-grade ORM with relationship support
-
golang-migrate β Industry-standard migrations with timestamp versioning
-
Complete migration CLI β Create, apply, rollback with ease
make migrate-create NAME=add_posts_table # Create with timestamp make migrate-up # Apply all pending make migrate-down # Rollback last (safe) make migrate-down STEPS=3 # Rollback multiple make migrate-status # Check current version make migrate-goto VERSION=<timestamp> # Jump to specific version
-
Safety features β Confirmation prompts, dirty state detection
-
Transaction support β BEGIN/COMMIT wrappers for data integrity
-
Connection pooling β Configured for performance out of the box
π Migrations Guide
- 2-second hot-reload β Powered by Air, actually works in Docker
- One command to rule them all β
make quick-starthandles everything - Development & production β Separate optimized configs
- Multi-stage builds β Tiny production images (~20MB)
π Docker Guide
- Auto-generated Swagger β Interactive API explorer at
/swagger/index.html - Full documentation site β Not just README, real guides at vahiiiid.github.io/go-rest-api-docs
- Step-by-step tutorials β Build a TODO app from scratch
- Postman collection β Import and test immediately
π Full Documentation
- Comprehensive coverage β Handlers, services, and repositories all tested
- In-memory SQLite β No external dependencies for tests
- Table-driven tests β Go idiomatic testing patterns
- CI/CD ready β GitHub Actions configured and working
π Testing Guide
- Structured API errors β Consistent JSON format with code, message, and details
- Machine-readable codes β NOT_FOUND, VALIDATION_ERROR, etc.
- Validation details β Clear field-level error messages
- Centralized middleware β Single error handler for all endpoints
π Error Handling Guide
- Clean layers β Handler β Service β Repository (no shortcuts)
- Dependency injection β Proper DI, easy to mock and test
- Domain-driven β Organize by feature, not by layer
- Official Go layout β Follows golang-standards/project-layout
π Development Guide
The easiest way to develop with hot-reload and zero setup:
make up # Start containers with hot-reload
make logs # View logs
make test # Run all tests
make lint # Check code quality
make lint-fix # Auto-fix linting issues
make down # Stop containersWhat you get:
- π₯ Hot-reload β Code changes reflect in ~2 seconds (powered by Air)
- π¦ Volume mounts β Edit code in your IDE, runs in container
- ποΈ PostgreSQL β Database on internal Docker network
- π All tools pre-installed β No Go installation needed on host
Production-grade migrations using golang-migrate:
make migrate-create NAME=add_todos_table # Create new migration
make migrate-up # Apply all pending
make migrate-down # Rollback last migration
make migrate-status # Check current versionFor long-running migrations:
go run cmd/migrate/main.go up --timeout=30m --lock-timeout=1mAll environments use SQL migrations for consistency and safety.
Want to run natively? You'll need Go 1.24+ installed.
make build-binary # Build binary to bin/server
make run-binary # Build and run (requires PostgreSQL on localhost)π Full Setup Guide for native development
GRAB includes optimized production builds:
make docker-up-prod # Start production containersWhat's included:
- β Multi-stage Docker builds (minimal image size)
- β Health check endpoints
- β Environment-based configuration
- β No development dependencies
- β Production logging
Ready for:
- AWS ECS/Fargate β Container orchestration
- Google Cloud Run β Serverless containers
- DigitalOcean App Platform β Platform-as-a-service
- Kubernetes β Self-managed orchestration
- Any VPS β Using Docker Compose
π Deployment Guide for step-by-step instructions
We welcome contributions from developers of all skill levels! Pick up any open issues labeled hacktoberfest or good first issue, fork the repository, make your changes, and submit a pull request. Whether it's bug fixes, new features, documentation improvements, or test enhancements - every contribution counts! π
Complete guides covering everything:
- π Getting Started β Installation and configuration
- π» Development Guide β Building features
- π‘ TODO Tutorial β Step-by-step implementation
- π³ Docker Guide β Container workflows
- ποΈ Migrations β Database schema management
- π§ͺ Testing β Writing and running tests
β οΈ Error Handling β Structured API errors- π Swagger β API documentation
- βοΈ Configuration β Environment setup
Documentation lives in a separate repository. To contribute:
- Visit github.com/vahiiiid/go-rest-api-docs
- Follow the contributing guidelines
- Submit pull requests for improvements
For code contributions, see CONTRIBUTING.md
We β€οΈ contributions! See CONTRIBUTING.md for:
- Code style guidelines
- Pull request process
- Testing requirements
- Commit conventions
- Fork the repository
- Create a feature branch (
git checkout -b feat/amazing-feature) - Make your changes
- Run tests and linter (
make lint-fix && make lint && make test) - Commit your changes (
git commit -m 'feat: add amazing feature') - Push to the branch (
git push origin feat/amazing-feature) - Open a Pull Request
- Gin β Fast HTTP web framework
- GORM β Developer-friendly ORM
- golang-migrate β Database migration toolkit
- Viper β Configuration management
- golang-jwt β JWT implementation
- swaggo β Swagger documentation generator
- Air β Hot-reload for development
This project is licensed under the MIT License - see the LICENSE file for details.
- π Read the Documentation
- π Report Bugs
- π¬ Ask Questions
- β Star this repo if you find it helpful!
Made with β€οΈ for the Go community
β Star β’ π Docs β’ π Issues β’ π¬ Discussions



