Watermarked preview · swipe or use ← →
Build REST Services That Handle Real Traffic
Go for Backend APIs
Build REST Services That Handle Real Traffic · Book Two of the Go for Absolute Beginners Series
Writing a Go service that works on your laptop takes a weekend. Writing one that holds up in production — one you can hand off to a colleague, wake up at 3 AM to fix, and trust with real user data — takes something else entirely.
Go for Backend APIs covers the gap between knowing Go and knowing how to build backend services with it. It picks up where Book One leaves off, taking the task-management service from that book through sixteen chapters and five parts of genuine production concerns: authentication, authorization, database access, pagination, rate limiting, observability, and deployment.
Part I — Architecture. Layered architecture that keeps handlers, services, repositories, and domain logic cleanly separated. A configuration system that reads from environment variables with proper validation. Structured logging with Go's slog package so every request can be traced through the system.
Part II — The Database Layer. database/sql from first principles: connection pool tuning, parameterized queries, PostgreSQL-specific patterns, and schema migrations with golang-migrate. The full task repository implementation with proper error mapping from database error codes to domain errors the HTTP layer can act on.
Part III — Authentication & Authorization. JWT authentication with constant-time password comparisons that prevent timing attacks. Role-based authorization that correctly separates ownership checks from admin privileges, with the SQL patterns that enforce those rules at the database level rather than relying on application logic alone.
Part IV — API Quality. RFC 7807 problem+json error responses that clients can parse and act on. Chainable request validation. Cursor-based pagination that stays fast on tables with millions of rows. Token-bucket rate limiting with per-user and per-IP limits. Context-propagated timeouts at every layer so slow database queries cannot hold the entire server hostage.
Part V — Observability & Deployment. The four golden signals as Prometheus metrics. Liveness and readiness health checks with the semantics Kubernetes expects. A multi-stage Dockerfile that produces a minimal production image, wired to a complete Docker Compose stack, with a smoke test script and production deployment checklist.
By the final chapter the service handles authentication, authorization, validation, pagination, rate limiting, metrics, and graceful shutdown. Every line is code you wrote yourself. Every decision is one you understood before you made it.
ISBN: 978-8-19215-801-2 · Pages: 387 · Edition: First, 2026
Level: Requires beginner-level Go familiarity — Book One of this series, or equivalent experience.
No reviews yet — be the first to share your thoughts.
Share your experience with this book. Reviews are moderated before publication to keep discussions useful and respectful.