v2.0 — AI-Optimized, RBAC, Production-Ready

Production-Ready Go API in 90 Seconds

Docker-ready, AI-optimized, fully tested. The Go boilerplate that doesn't waste your time.

terminal
$ git clone https://github.com/vahiiiid/go-rest-api-boilerplate.git
$ cd go-rest-api-boilerplate
$ make quick-start
🔧 Installing development tools...
🐳 Building Docker containers...
🗄️ Running database migrations...
🚀 Starting API server with hot-reload...
 
✅ API running at http://localhost:8080/api/v1
📚 Swagger UI at http://localhost:8080/swagger/index.html
🏥 Health check at http://localhost:8080/health
🔐 JWT Auth 🐳 Docker 📚 Swagger 🔥 Hot Reload 🤖 AI-Ready 🧪 Tested
90s Setup Time
🔥 ~2s Hot Reload
📦 ~15MB Docker Image
📚 23+ Doc Pages
🔐 7 Auth Endpoints
85%+ Test Coverage

Everything You Need to Ship Fast

From authentication to deployment — GRAB gives you a complete, production-grade foundation so you can focus on building features.

🔐

JWT Auth & Security

OAuth 2.0 BCP compliant with refresh token rotation, reuse detection, and bcrypt hashing.

🔑

Role-Based Access

Many-to-many RBAC with JWT integration, admin CLI, and middleware protection.

🏗️

Clean Architecture

Handler → Service → Repository. Official Go layout with dependency injection.

🐳

Docker-First

2-second hot-reload, multi-stage builds, ~15MB production images.

🗄️

Database & Migrations

PostgreSQL + GORM with golang-migrate. Version-controlled schema changes.

🤖

AI-Optimized

Built-in rules for GitHub Copilot, Cursor, Windsurf, and AGENTS.md.

🧪

Tested & CI/CD

Unit + integration tests, in-memory SQLite, GitHub Actions pipeline.

📦

Standardized APIs

Consistent JSend-inspired envelope format with pagination and metadata.

🏥

Health Checks

Kubernetes-ready liveness/readiness probes with RFC-compliant responses.

See It In Action

From clone to running API in three commands.

terminal
$ git clone https://github.com/vahiiiid/go-rest-api-boilerplate.git
Cloning into 'go-rest-api-boilerplate'...
remote: Enumerating objects: 850, done.
remote: Total 850 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (850/850), done.
 
$ cd go-rest-api-boilerplate
$ ls
Dockerfile Makefile README.md cmd/ configs/ docker-compose.yml
go.mod go.sum internal/ migrations/ scripts/ tests/

Clean Architecture That Scales

Following official Go project layout and battle-tested community patterns.

🌐
HTTP Request
 
🛡️
Middleware
Auth · Rate Limit · CORS
📡
Handler
HTTP Layer
⚙️
Service
Business Logic
🗄️
Repository
Data Access
🐘
PostgreSQL
 

Separation of Concerns

Each layer has a single responsibility. Changes in one layer don't affect others.

Easy to Test & Mock

Built-in dependency injection makes testing straightforward with interfaces.

Scales With Your Team

Domain-driven structure lets teams work independently on different features.

Built for Production, Not Just Demos

Every feature is production-tested and follows industry best practices.

  • OAuth 2.0 BCP compliant JWT with HS256 signing
  • Automatic refresh token rotation with family tracking
  • Token reuse detection with family revocation
  • SHA-256 token hashing before storage
POST /api/v1/auth/login
{
  "email": "user@example.com",
  "password": "SecurePass123!"
}

→ 200 OK
{
  "success": true,
  "data": {
    "access_token": "eyJhbGciOiJIUzI1NiIs...",
    "refresh_token": "dGhpcyBpcyBhIHJlZnJl...",
    "token_type": "Bearer",
    "expires_in": 900
  }
}

Built With Amazing Tools

Production-grade technologies you already know and trust.

GO

Go

Language

🍸

Gin

Web Framework

🗃️

GORM

ORM

🐘

PostgreSQL

Database

Docker Containers
GitHub Actions CI/CD
Swagger API Docs
Air Hot-Reload
Viper Config
golang-migrate Migrations

Perfect For

🚀

Shipping Fast

Launch MVPs and production APIs in days, not weeks.

👥

Team Projects

Consistent standards and patterns everyone understands.

🏗️

Scaling Up

Architecture that grows with your business.

📖

Learning Go

See how professionals structure real-world applications.

Ready to Build?

Get your production-ready Go API running in under 2 minutes. Free and open source.

Open Source MIT License Production-Ready

If GRAB saves you time, give us a ★ on GitHub — it helps others discover the project.