// Articles

Guides and deep dives

Guides, tutorials, and comparisons to help you build better backend applications.

Filter by category: Go Development (59)

Useful resources for building Go applications.

Go Modules Cheat Sheet

A handy reference for common operations with Go modules

Cheat Sheet
How to Connect a Go App to RDS Postgres

Connecting Go to Amazon RDS for PostgreSQL with pgx: the connection string, TLS with the RDS certificate bundle, pool sizing against max_connections, IAM database authentication tokens, network setup, and an approach where the database is provisioned from the Go code.

7 Min Read
How to Use sqlc with Postgres in Go

Set up sqlc for a Go service on Postgres: config, schema from migrations, query annotations, optional filters, transactions, and wiring the generated code to a managed database.

7 Min Read
GORM vs sqlc: Which Go Database Library to Use

How GORM and sqlc model tables, write queries, handle migrations and transactions, and where each one fits in a Go backend on Postgres.

8 Min Read
How to Use Amazon SQS from Go

Send, receive and delete SQS messages with the AWS SDK for Go v2, with long polling, visibility timeouts, batch deletes, dead-letter queues and a graceful consumer loop.

7 Min Read
How to Build a WebSocket Server in Go

Push live order updates to browsers from a Go backend with coder/websocket or gorilla/websocket, including origin checks, cookie auth, pings, slow-client handling and fan-out across more than one instance.

9 Min Read
Middleware in Go: Logging, Recovery, Auth and Rate Limits

How HTTP middleware works in Go, how to write request ID, logging and panic recovery middleware for net/http, in which order to chain them, and how Encore middleware targets endpoints by tag and reads auth data.

8 Min Read
Dependency Injection in Go: Constructors, Wire, Fx and Service Structs

How to pass dependencies into Go services so they are easy to test: plain constructors, interfaces for fakes, Uber's Fx container, what happened to Google Wire, and Encore service structs with initService.

8 Min Read
Deploy a Fiber App to Google Cloud Run

Run a Go Fiber v3 API on Cloud Run with Cloud SQL in your own GCP account, with Encore or with a Dockerfile, the Cloud SQL connector and gcloud by hand.

6 Min Read
How to Add Cron Jobs to a Go net/http App

Run scheduled jobs next to a standard library ServeMux API, such as expiring stock holds and a nightly sales snapshot, with Encore cron jobs, robfig/cron or EventBridge Scheduler.

7 Min Read
How to Add Secrets to a Go net/http App

Keep a webhook HMAC key and a carrier API token out of a standard library net/http repository, with Encore secrets set per environment or with .env files and AWS Secrets Manager on ECS.

7 Min Read
How to Add Object Storage to a Go net/http App

Let a standard library ServeMux issue signed upload and download URLs for private invoice PDFs, using Encore on S3 or Cloud Storage, or the AWS SDK by hand.

14 Min Read
How to Add Pub/Sub to a Go net/http App

Publish an order-placed event from a standard library ServeMux handler and process it in idempotent subscribers, using Encore on SNS and SQS or GCP Pub/Sub, or the AWS SDK by hand.

10 Min Read