After 5 years of Go services, here's the boilerplate I wish existed
The author, after building six Go services over five years, created a reusable Go boilerplate template to streamline common production requirements. The template includes features like observability, graceful shutdown, retry mechanisms, DLQ, and protection against SSRF. It aims to reduce repetitive setup by offering a well-structured, opinionated foundation for new microservices.
- ▪The boilerplate is designed for Go 1.25 and includes built-in support for observability, retry logic, dead-letter queues (DLQ), and SSRF-safe HTTP clients.
- ▪It uses a package-by-feature directory structure to improve scalability and maintainability, avoiding common anti-patterns like models/controllers/services separation.
- ▪The template includes a custom MongoDB command monitor with a janitor goroutine to prevent memory leaks from uncompleted database commands.
- ▪A make scaffold command allows developers to quickly generate new features with consistent structure and wiring.
- ▪The project addresses gaps in existing Go boilerplates by integrating production-ready components in an opinionated, not kitchen-sink, manner.
Opening excerpt (first ~120 words) tap to expand
try { if(localStorage) { let currentUser = localStorage.getItem('current_user'); if (currentUser) { currentUser = JSON.parse(currentUser); if (currentUser.id === 372116) { document.getElementById('article-show-container').classList.add('current-user-is-article-author'); } } } } catch (e) { console.error(e); } rock288 Posted on May 17 After 5 years of Go services, here's the boilerplate I wish existed #go #opensource #microservices #observability TL;DR: I open-sourced rock288/go-mongo-boilerplate — a Go 1.25 service template that ships the boring production stuff (observability, retry, DLQ, SSRF-safe HTTP, health splits, graceful shutdown) so you don't write it for the 7th time. Click "Use this template" and start with make scaffold name=Order.
…
Excerpt limited to ~120 words for fair-use compliance. The full article is at DEV.to (Top).