Releases: justyn-clark/go-chi-postgres-starter
Releases · justyn-clark/go-chi-postgres-starter
Go Chi Postgres Starter v1.0.0
🚀 Go Chi Postgres Starter v1.0.0
A production-ready Go REST API starter template with Chi Router and PostgreSQL 18.
✨ Key Features
🔒 Security & Protection
- JWT Authentication - Secure token-based authentication with role support
- Rate Limiting - IP-based token bucket algorithm (10 req/sec default)
- Request Body Limits - 1MB limit to prevent DoS attacks
- Security Headers - X-Frame-Options, CSP, XSS protection, HSTS ready
- Password Hashing - bcrypt with proper cost
- Input Validation - Struct validation with go-playground/validator
🛡️ Reliability & Resilience
- Graceful Shutdown - Signal handling (SIGINT/SIGTERM) with 30s timeout
- Panic Recovery - Stack trace logging on panics
- Health Checks - Database-aware health endpoint (
/api/health) - Database Migrations - golang-migrate integration
- Connection Pooling - Production-ready pool config (MaxConns: 25, MinConns: 5)
📊 Observability
- Structured Logging - Zerolog with configurable levels
- Request Logging - Method, path, status, duration, bytes
- Prometheus Metrics -
/metricsendpoint with HTTP metrics - Request ID - Per-request tracking for debugging
⚡ Performance
- Response Compression - gzip compression (level 5)
- Database Pooling - Optimized connection pool settings
- Goroutine Utilities - Production-ready concurrency patterns
🛠️ Developer Experience
- OpenAPI/Swagger - Auto-generated interactive docs (
/swagger/index.html) - Live Reload - Air integration for development
- CI/CD - GitHub Actions (test, lint, build)
- Docker Support - docker-compose for database and Redis
- Queue System - Pluggable background job processing (Redis/in-memory)
- Comprehensive Documentation - README, guides, and inline docs
🎯 What's Included
- ✅ Chi Router - Lightweight, standard library compatible router
- ✅ pgx/v5 - High-performance PostgreSQL driver
- ✅ golang-migrate - Database migrations
- ✅ JWT Authentication - Secure token-based auth system
- ✅ Zerolog - Structured logging
- ✅ Rate Limiting - IP-based with token bucket algorithm
- ✅ Prometheus Metrics -
/metricsendpoint - ✅ Queue System - Redis/in-memory background jobs
- ✅ Deployment Ready - Dockerfile + Fly.io & Railway configs
📦 Quick Start
# Clone the repository
git clone https://github.com/justyn-clark/go-chi-postgres-starter.git
cd go-chi-postgres-starter
# Create database
createdb go_api_starter
# Run migrations
export DATABASE_URL="postgresql://postgres:postgres@localhost:5432/go_api_starter?sslmode=disable"
make migrate-up
# Start the API
make run📚 Documentation
🔗 Links
- Repository: https://github.com/justyn-clark/go-chi-postgres-starter
- API Documentation: Available at
/swagger/index.htmlafter starting the server
Full Changelog: https://github.com/justyn-clark/go-chi-postgres-starter/compare/v1.0.0