A production-ready monorepo template for building scalable web applications with Go backend and TypeScript frontend. Built with modern best practices, clean architecture, and comprehensive tooling.
- Monorepo Structure: Organized with Turborepo for efficient builds and development
- Go Backend: High-performance REST API with Echo framework
- Authentication: Integrated Clerk SDK for secure user management
- Database: PostgreSQL with migrations and connection pooling
- Background Jobs: Redis-based async job processing with Asynq
- Observability: New Relic APM integration and structured logging
- Email Service: Transactional emails with Resend and HTML templates
- Testing: Comprehensive test infrastructure with Testcontainers
- API Documentation: OpenAPI/Swagger specification
- Security: Rate limiting, CORS, secure headers, and JWT validation
go-boilerplate/
├── backend/ # Go backend application
├── packages/ # Frontend packages (React, Vue, etc.)
├── package.json # Monorepo configuration
├── turbo.json # Turborepo configuration
└── README.md # This file
- Go 1.24 or higher
- Node.js 22+ and Bun
- PostgreSQL 16+
- Redis 8+
- Clone the repository:
git clone https://github.com/sriniously/go-boilerplate.git
cd go-boilerplate
- Install dependencies:
# Install frontend dependencies
bun install
# Install backend dependencies
cd backend
go mod download
- Set up environment variables:
cp backend/.env.example backend/.env
# Edit backend/.env with your configuration
-
Start the database and Redis.
-
Run database migrations:
cd backend
task migrations:up
- Start the development server:
# From root directory
bun dev
# Or just the backend
cd backend
task run
The API will be available at http://localhost:8080
# Backend commands (from backend/ directory)
task help # Show all available tasks
task run # Run the application
task migrations:new # Create a new migration
task migrations:up # Apply migrations
task test # Run tests
task tidy # Format code and manage dependencies
# Frontend commands (from root directory)
bun dev # Start development servers
bun build # Build all packages
bun lint # Lint all packages
The backend uses environment variables prefixed with BOILERPLATE_
. Key variables include:
BOILERPLATE_DATABASE_*
- PostgreSQL connection settingsBOILERPLATE_SERVER_*
- Server configurationBOILERPLATE_AUTH_*
- Authentication settingsBOILERPLATE_REDIS_*
- Redis connectionBOILERPLATE_EMAIL_*
- Email service configurationBOILERPLATE_OBSERVABILITY_*
- Monitoring settings
See backend/.env.example
for a complete list.
This boilerplate follows clean architecture principles:
- Handlers: HTTP request/response handling
- Services: Business logic implementation
- Repositories: Data access layer
- Models: Domain entities
- Infrastructure: External services (database, cache, email)
# Run backend tests
cd backend
go test ./...
# Run with coverage
go test -cover ./...
# Run integration tests (requires Docker)
go test -tags=integration ./...
- Use environment-specific configuration
- Enable production logging levels
- Configure proper database connection pooling
- Set up monitoring and alerting
- Use a reverse proxy (nginx, Caddy)
- Enable rate limiting and security headers
- Configure CORS for your domains
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.