Rocket Boilerplate
Scaffold a production-ready Go backend in seconds — not hours.
Why Rocket Boilerplate?
Setting up a production-grade Go backend from scratch takes hours — wiring Postgres, Redis, Docker, config management, logging, project layout, migrations, tests … it all adds up.
Rocket Boilerplate eliminates that cold-start problem. One command, three prompts, and you get a battle-tested project structure that follows Go community best practices.
"Stop copy-pasting from old projects. Launch your next API in 30 seconds."
Features
| Feature |
Details |
| Framework Choice |
Pick Gin, Chi, or Net/HTTP — handler & router code adapts automatically |
| Postgres Integration |
Connection pooling, health checks, database/sql with lib/pq |
| Redis Integration |
Pub/Sub ready via go-redis, background worker included |
| Docker Compose |
One-file infra: Postgres 15 + Redis 7, volumes pre-configured |
| Clean Architecture |
cmd/ • internal/ • pkg/ layout per Go standard project layout |
| Database Migrations |
SQL migration files in migrations/, auto-loaded by Docker |
| Unit Tests |
Example test suite for services with table-driven tests |
| Environment Config |
.env file + godotenv with safe fallback defaults |
| Structured Logging |
Lightweight pkg/logger with INFO/ERROR levels |
| Background Workers |
Redis Pub/Sub worker goroutine ready to process async jobs |
Demo
Tip: Record a 30-second screen capture with ScreenToGif and replace the placeholder above.
Quick Start
1. Install the Extension
- Open VS Code
- Go to the Extensions panel (
Ctrl+Shift+X)
- Search for
Rocket Boilerplate
- Click Install
Or install via the CLI:
code --install-extension Harshvardhan.rocket-boilerplate
2. Scaffold Your Project
- Open a workspace folder in VS Code.
- Open the Command Palette (
Ctrl+Shift+P / Cmd+Shift+P).
- Type and run
Initialize Production Backend.
- Answer three prompts:
| Prompt |
Example |
| Project name |
my-api |
| Go module path |
github.com/yourname/my-api |
| HTTP framework |
Gin / Chi / Net/HTTP |
- Done! Your project is ready.
3. Run It
cd my-api
go mod tidy
docker-compose up -d # starts Postgres & Redis
go run cmd/server/main.go # starts the server on :8080
Test the health endpoint:
curl http://localhost:8080/health
# {"status":"ok"}
Create a user:
curl -X POST http://localhost:8080/users \
-H "Content-Type: application/json" \
-d '{"email": "hello@example.com"}'
Generated Project Structure
my-api/
├── cmd/
│ └── server/
│ └── main.go # Application entry point
├── internal/
│ ├── config/
│ │ └── config.go # Env-based configuration
│ ├── db/
│ │ └── postgres.go # Postgres connection + pooling
│ ├── handlers/
│ │ └── user_handler.go # HTTP handlers (framework-specific)
│ ├── models/
│ │ └── user.go # Data models / structs
│ ├── queue/
│ │ └── redis.go # Redis client + Pub/Sub
│ ├── routes/
│ │ └── routes.go # Router setup (framework-specific)
│ ├── services/
│ │ ├── user_service.go # Business logic + DB queries
│ │ └── user_service_test.go # Unit tests
│ └── workers/
│ └── worker.go # Background job processor
├── migrations/
│ └── 0001_init.sql # Initial DB schema
├── pkg/
│ └── logger/
│ └── logger.go # Structured logger
├── .env # Environment variables
├── docker-compose.yml # Postgres + Redis infra
├── go.mod # Go module definition
└── README.md # Project documentation
Framework Comparison
Not sure which framework to pick? Here's a quick guide:
|
Gin |
Chi |
Net/HTTP |
| Performance |
Fastest (radix tree router) |
Very fast |
Fast (stdlib) |
| Middleware |
Built-in (CORS, logging, recovery) |
Composable middleware stack |
Manual |
| Learning curve |
Low |
Low |
Lowest |
| Dependencies |
gin-gonic/gin |
go-chi/chi |
None (stdlib) |
| Best for |
REST APIs, microservices |
Idiomatic Go APIs |
Minimal services, learning |
Configuration
The generated .env file contains:
PORT=8080
DB_DSN=postgres://postgres:postgres@localhost:5433/my-api?sslmode=disable
REDIS_ADDR=localhost:6379
All values have safe defaults. The app works out of the box with the included Docker Compose stack.
Architecture
Request → Routes → Handlers → Services → Database
↓
Redis Pub/Sub → Workers (async)
- Routes wire HTTP paths to handlers.
- Handlers parse requests and return responses.
- Services contain business logic and talk to the database.
- Workers process background jobs via Redis Pub/Sub.
- Config loads environment variables with fallback defaults.
Requirements
| Tool |
Version |
Required? |
| Go |
1.21+ |
Yes |
| Docker |
20+ |
Recommended (for Postgres & Redis) |
| VS Code |
1.107+ |
Yes |
Roadmap
We're actively improving Rocket Boilerplate. Here's what's coming:
- [ ] MongoDB support — choose Mongo instead of Postgres
- [ ] JWT authentication — optional auth middleware scaffolding
- [ ] gRPC template — generate proto files + gRPC server
- [ ] CI/CD pipelines — GitHub Actions / GitLab CI templates
- [ ] Kubernetes manifests — Deployment, Service, ConfigMap
- [ ] Makefile generation — common tasks (
build, test, migrate, lint)
- [ ] Swagger/OpenAPI — auto-generate API docs
- [ ] Custom templates — bring your own template directory
FAQ
Can I use this without Docker?
Yes. Just point DB_DSN and REDIS_ADDR in your .env to your own Postgres and Redis instances.
Does it overwrite existing files?
No. If a folder with the same project name already exists, the extension will show an error and stop.
Can I add more services/handlers later?
Absolutely. The generated code follows Go's standard project layout. Add new files in internal/services/, internal/handlers/, etc., and wire them up in internal/routes/routes.go.
Which Go version is required?
Go 1.21 or later. The generated go.mod targets 1.21.
Contributing
Contributions are welcome! Here's how:
- Fork the repo
- Create your feature branch (
git checkout -b feat/amazing-feature)
- Commit your changes (
git commit -m 'Add amazing feature')
- Push to the branch (
git push origin feat/amazing-feature)
- Open a Pull Request
Please open an issue first for major changes.
Support
If Rocket Boilerplate saved you time, consider:
License
MIT © Harshvardhan
Built with love for the Go community. Keywords: go golang backend boilerplate scaffold generator template production-ready postgres redis docker gin chi rest api microservice vscode extension