httpx: A Small, Fluent HTTP Client for Go That Stays Close to `net/http`

Go’s standard net/http package is excellent. It’s mature, reliable, performant, and provides almost everything you need to build HTTP clients. But there is one thing I’ve always found myself writing repeatedly: boilerplate. Creating requests, attaching headers, configuring authentication, handling response status codes, decoding JSON, closing response bodies, managing timeouts, and implementing retries — these are common tasks in almost every backend application. I wanted something that would make these operations simpler without introducing another heavy abstraction or a collection of third-party dependencies. ...

November 28, 2026 · 9 min · Saddam H

Scalability Essentials for APIs in High-Traffic Services

When developing APIs for services in a company with a large user base, scalability becomes a critical consideration. Scaling an API in production for such a company requires keeping certain fundamentals in mind. Today, I’ll discuss a few key points that you should also keep in mind when approaching this challenge. Here’s a breakdown of some key techniques and strategies you can use: API Optimizations Reduce Payload Size: Send only the necessary data in responses and avoid including unnecessary properties, as every byte contributes to network overhead, even if it’s just a single byte. Response Compression: Enable compression techniques like Gzip or Brotli to reduce payload size and accelerate data transfer. Pagination and Filtering: For large datasets, implement pagination and filtering mechanisms to limit the amount of data sent in a single request. Stateless Applications: Design application servers to be stateless, processing only request-specific information without storing or persisting data locally. Persist state-related information, such as user authentication or preferences, externally using databases, in-memory caches (e.g., Redis).This approach ensures that application servers can be easily scaled up or down during deployment to handle varying request loads, improving flexibility, fault tolerance, and scalability. Concurrency: Leverage concurrency to optimize performance when handling multiple tasks simultaneously. For instance, if an API request requires data from two or more services, you can make those service calls concurrently instead of sequentially. This reduces the overall response time by executing tasks in parallel, making better use of system resources. Consider using gRPC for inter-service communication, as it provides efficient, low-latency, and strongly-typed communication between services in a microservices architecture. ...

November 22, 2024 · 7 min · Saddam H

Generate API Documentation Easily with Docgen: A Simple, Open-Source Tool

In this tutorial, I’ll introduce you to an open-source tool that makes creating amazing API documentation effortless! If you’re working with REST APIs and exposing them through HTTP/JSON, there’s a good chance you’re already using Postman to test, debug, and manage collections. When collaborating with teams, especially Android or iOS developers, you often need to share your API documentation. This typically involves sharing the Postman collection in JSON format along with manually written documentation to describe the API. ...

May 15, 2020 · 3 min · Saddam H

An easy way to validate Go request

When building REST APIs or web applications in Go, one of the essential tasks is validating incoming request data. Having worked on various small to medium-sized projects in Golang—most of which are microservices providing RESTful APIs—I’ve employed several approaches to handle data validation. Among these, there’s one method I frequently rely on. For validating application/json or text/plain requests, I begin by defining a struct type to represent the specific request payload. Then, I implement a Validate method on that struct to encapsulate the validation logic. ...

October 18, 2017 · 2 min · Saddam H