API Design
166 items tagged with "api-design"
Best Practices18
Google API Design Guide
Opinionated REST and gRPC design rules: resource-oriented URIs, plural nouns, pagination, errors.
Microsoft REST API Guidelines
Cross-company REST consistency rules (nouns, verbs, versioning, errors).
Stripe API Versioning Policy
Backwards-compatible evolution strategy and pinned versions for API consumers.
Backends for Frontends (BFF)
An architecture pattern that gives each frontend client its own tailored backend service, instead of forcing web, mobile, and other clients to share one general-purpose API.
API Gateway Pattern
An architecture pattern that places a single entry point in front of backend services to handle routing, authentication, rate limiting, and other cross-cutting concerns.
Richardson Maturity Model
A four-level model for grading how fully an HTTP API embraces REST, from RPC-style endpoints up to hypermedia controls (HATEOAS).
OpenAPI Specification Best Practices
Guidance for writing accurate, machine-readable OpenAPI documents that describe HTTP APIs and drive docs, client SDKs, mocks, and contract tests.
GraphQL API Best Practices
Practical guidance for designing GraphQL schemas and servers: typed schemas, pagination, error handling, query cost limits, and avoiding the N+1 problem.
gRPC Best Practices
Guidance for building high-performance gRPC services with Protocol Buffers: service design, streaming, deadlines, error codes, and backward-compatible schema evolution.
API-First Design
An approach that treats the API contract as a product designed before implementation, so teams agree on the interface, then build clients and servers in parallel.
Idempotency Keys
A pattern where clients send a unique key with unsafe requests so the server can safely retry without applying the same operation twice, preventing duplicate charges or records.
API Rate Limiting
Controlling how many requests a client can make in a time window to protect API capacity, ensure fair use, and defend against abuse, using algorithms like token bucket.
API Pagination Best Practices
Techniques for returning large result sets in pages without breaking under concurrent writes: offset, cursor (keyset), and page-token pagination, with stable ordering.
Webhook Best Practices
Guidance for sending and receiving reliable webhooks: signature verification, idempotent handlers, retries with backoff, and fast acknowledgement of events.
AsyncAPI Specification
A standard, machine-readable format for describing event-driven and message-based APIs across protocols like Kafka, MQTT, and AMQP, analogous to OpenAPI for REST.
Problem Details for HTTP APIs (RFC 9457)
An IETF standard JSON format for machine-readable HTTP error responses, defining fields like type, title, status, detail, and instance for consistent error handling.
API Backward Compatibility
Evolving an API without breaking existing clients by making only additive changes, versioning breaking changes, and deprecating fields gracefully over time.
JSON:API Specification
A convention for building JSON APIs that standardizes resource structure, relationships, pagination, filtering, and sparse fieldsets to reduce bikeshedding and over-fetching.
Patterns24
Anti-Corruption Layer
Create a translation layer between new and legacy systems to prevent legacy concepts from leaking into new code
Backend for Frontend (BFF)
Create separate backend services tailored to each frontend's needs
Front Controller
Channels all incoming requests through a single handler that centralizes cross-cutting concerns like routing, authentication, and logging before dispatching to handlers.
API Gateway
A single entry point that routes, aggregates, and secures client requests across many backend microservices.
API Composition
Implements a query that spans multiple services by invoking each owner service and joining the results in memory.
Aggregator
A component that invokes multiple services and combines their responses into a single consolidated result for the caller.
Gateway Aggregation
Uses a gateway to combine multiple backend requests into one, so clients make a single call instead of many.
Gateway Offloading
Moves shared cross-cutting functionality such as TLS, auth, and rate limiting out of services and into a gateway.
Gateway Routing
Routes client requests to the correct backend service through a single endpoint using request attributes such as path or host.
Throttling
Control the consumption of resources by an instance, tenant, or service so a system stays within capacity under load.
Rate Limiting
Constrain the rate of operations against a service or resource to stay within quotas and avoid throttling or overload.
Message Router
Consumes a message and redirects it to a different channel based on conditions, decoupling producers from the decision of where messages should go.
Content-Based Router
Routes each message to a destination channel chosen by inspecting the message's content, so the payload itself determines where it is delivered.
Message Translator
Converts a message from one data format or schema to another so systems with incompatible representations can communicate.
Normalizer
Translates messages arriving in many different formats into a single common format so downstream components handle one canonical representation.
Request-Reply
Lets a requestor send a message and receive a corresponding response over messaging, combining two one-way channels into a logical two-way exchange.
Rate Limiter
Caps how many requests a client or system may make in a time window, protecting services from overload, abuse, and runaway cost.
Idempotency Key
Attaches a unique key to a request so the server can detect and de-duplicate retries, making non-idempotent operations safe to repeat.
Pagination
Splits a large result set into smaller pages so APIs and UIs can return and traverse data incrementally instead of loading everything at once.
HATEOAS
Hypermedia as the Engine of Application State: REST responses include links describing available actions, letting clients navigate the API by following links.
Idempotency Key
A client-supplied unique key lets a server detect and dedupe retried requests, so repeated submissions produce the same result exactly once.
API Versioning
Strategies for evolving an API without breaking existing clients, by exposing multiple versions through URLs, headers, or media types.
Webhook
A server pushes event notifications to a client-registered HTTP endpoint as events occur, replacing inefficient polling with real-time callbacks.
Token Bucket (Rate Limiting)
A rate-limiting algorithm where requests consume tokens refilled at a steady rate, allowing controlled bursts while capping the long-run request rate.
Anti-Patterns19
Shared Database Integration
Multiple services directly sharing the same database tables
Stovepipe System
Independently built, siloed systems that duplicate capabilities and cannot interoperate because each was designed in isolation without shared standards.
Swiss Army Knife
An interface or component with so many options and overloads that it tries to cover every use case, becoming hard to learn, misuse-prone, and impossible to evolve.
Boolean Trap
Function parameters that take a bare boolean force readers to decode opaque true/false call sites, hiding intent and inviting wrong arguments.
Long Parameter List
A function signature with too many parameters, making calls error-prone, hard to read, and a sign of poorly grouped or missing abstractions.
Temporal Coupling
Methods that must be called in a specific hidden order, where calling them out of sequence silently breaks state with no compiler protection.
Sequential Coupling
A class designed so its methods must be invoked in a rigid sequence, with the ordering enforced only by convention rather than by the API itself.
Chatty I/O
Making many small, fine-grained remote or storage calls where a few coarse-grained calls would do, multiplying latency and overhead per operation.
N+1 Network Calls
Fetching a list, then making one additional remote call per item to enrich it, so a single logical operation fans out into N+1 dependency calls.
Overly Permissive CORS
Configuring Cross-Origin Resource Sharing to allow any origin (or reflecting any origin with credentials), exposing authenticated APIs to malicious sites.
Missing Input Validation
Accepting and processing external input without checking its type, range, format, or size, opening the door to injection, corruption, and crashes.
Mass Assignment
Binding incoming request data directly onto domain objects, letting attackers set fields like isAdmin or accountBalance that were never meant to be writable.
Chatty API
An API design that forces clients to make many small round trips to complete one task, harming latency, scalability, and battery life.
Breaking Changes Without Versioning
Changing an API's contract in place without versioning or deprecation, silently breaking existing clients and eroding trust.
Inconsistent API Naming and Conventions
An API where naming, casing, pluralization, error formats, and conventions vary across endpoints, raising the learning curve and integration errors.
Overfetching and Underfetching
Endpoints that return too much data or too little, forcing clients to waste bandwidth or make extra calls to assemble what they need.
Ignoring Idempotency
Designing write operations that cause duplicate effects when retried, so network blips and client retries create double charges or duplicate records.
Missing Pagination (Unbounded Result Sets)
Collection endpoints that return all records at once with no pagination, causing huge payloads, slow queries, and out-of-memory failures as data grows.
Leaky API Abstraction
An API that exposes internal database schemas, implementation details, or storage structures, coupling clients to internals and blocking safe evolution.
Tutorials16
Building a GraphQL API from REST Endpoints
Transform your REST API into a GraphQL server with Apollo
How to deploy a serverless REST API on AWS Lambda
Build and deploy a production REST API using AWS Lambda and API Gateway with infrastructure as code.
How to build an HTTP API with Azure Functions
Create and deploy a serverless HTTP-triggered API on Azure Functions using the Azure CLI and a consumption plan.
How to build a REST API with Amazon API Gateway
Configure Amazon API Gateway routes, stages, and authorizers to expose backend services as a managed REST API.
How to deploy a Python function on Google Cloud Functions
Write and deploy an HTTP-triggered Python function on Google Cloud Functions (2nd gen) with the gcloud CLI.
How to Secure an API with JWT Authentication
Issue signed JWT access tokens, validate them on every request, and refresh them safely without leaking long-lived credentials.
How to Add Rate Limiting to an API
Protect an API with token-bucket rate limiting, return standard rate-limit headers, and share limits across instances with Redis.
How to Build a REST API with Best Practices
Design resource-oriented routes, use correct status codes, validate input, handle errors consistently, and version your REST API.
How to Document an API with OpenAPI
Write an OpenAPI specification, serve interactive docs, validate requests against the schema, and generate client code.
How to Build a GraphQL Server
Define a schema, write resolvers, solve the N+1 problem with batching, and add error handling and depth limits to a GraphQL API.
How to Build a gRPC Service
Define a service in Protocol Buffers, generate code, implement unary and streaming methods, and call the service from a client.
How to Implement Secure Webhooks
Send and receive webhooks with HMAC signatures, idempotency keys, retries with backoff, and replay protection.
How to Version an API Without Breaking Clients
Choose a versioning scheme, evolve schemas with additive changes, deprecate old versions gracefully, and communicate changes to clients.
How to Add Cursor-Based Pagination to a REST API
Replace offset pagination with stable cursor pagination, return navigation links, and keep results consistent under concurrent writes.
How to build an LLM app with function calling (tools)
Give an LLM the ability to call your functions, so it can fetch data and take actions instead of only producing text.
How to build a Model Context Protocol (MCP) server
Build an MCP server that exposes tools and resources to AI assistants over a standard protocol.
Blueprints10
REST to GraphQL Migration Blueprint
Guide for transitioning REST APIs to GraphQL architecture
EJB to REST Services Blueprint
Replace remote EJB interfaces with HTTP REST services to decouple clients from RMI and enable language-agnostic integration.
SOAP to REST API Modernization Blueprint
Modernize WSDL-based SOAP web services to REST APIs with OpenAPI contracts, JSON payloads, and OAuth 2.0 security.
REST API to GraphQL Federation Blueprint
Migrate a sprawling set of REST endpoints to a federated GraphQL graph so clients fetch exactly what they need from one typed endpoint.
REST to gRPC for Internal Services Blueprint
Replace JSON-over-HTTP calls between internal microservices with gRPC and Protocol Buffers for lower latency and strongly typed contracts.
Monolithic API to API Gateway Blueprint
Front a monolithic API with an API gateway to centralize auth, rate limiting, routing, and observability before decomposing services.
Ad-Hoc REST Versioning to API-First Contracts Blueprint
Move from unmanaged REST API changes to an API-first workflow with OpenAPI contracts, contract testing, and a backward-compatibility policy.
REST Polling to GraphQL Subscriptions Blueprint
Replace client REST polling for fresh data with real-time GraphQL subscriptions over WebSockets for push updates and lower load.
Oracle Forms to Web Application Blueprint
Modernize Oracle Forms and Reports applications into a modern web app with a REST API over the existing Oracle Database.
Visual Basic / WinForms to Web Application Blueprint
Modernize legacy VB6 or .NET WinForms desktop apps into a browser-based web application with a modern API backend.
Reference Architectures16
API Gateway Pattern
Centralized API management with authentication, rate limiting, and request routing
Serverless API on Azure Functions
An event-driven serverless API built on Azure Functions with Cosmos DB and API Management for pay-per-use, low-operations workloads.
Serverless API on GCP Cloud Run
A container-based serverless API on Google Cloud Run with Cloud SQL and Pub/Sub, scaling to zero while keeping standard container portability.
LLM Gateway and Proxy on Kubernetes
A reference design for a self-hosted LLM gateway on Kubernetes that centralizes routing, rate limiting, cost tracking, and guardrails across multiple model providers.
Customer Identity and Access Management Platform
Scalable CIAM design on AWS for user sign-up, social login, and token-based authorization for consumer applications.
API Gateway with Backends-for-Frontends
An edge API gateway fronting channel-specific BFF services that aggregate microservices for web, mobile, and partner clients.
Federated GraphQL Supergraph
A federated GraphQL architecture where independently owned subgraphs compose into one supergraph behind a managed gateway.
gRPC Service Mesh for Internal APIs
A high-performance internal API platform using gRPC over a service mesh for typed, low-latency service-to-service calls.
CQRS with Event Sourcing
A command-query separated system where state is derived from an append-only event log and read models are projected for queries.
Reliable Webhook Delivery Platform
A platform that delivers outbound webhooks to customer endpoints with retries, signing, idempotency, and per-tenant rate control.
Enterprise API Management Platform
A full API management platform providing a developer portal, gateway, monetization, and lifecycle governance for internal and partner APIs.
Cloud-Native REST API Platform
A versioned, API-first REST platform with contract-driven development, gateway policies, and managed data services on GCP.
GraphQL BFF Gateway for Mobile
A GraphQL backend-for-frontend that aggregates microservices and optimizes payloads for bandwidth-constrained mobile clients.
Headless CMS Content Architecture
A content repository exposing structured content over APIs to multiple front ends, decoupling authoring from presentation.
Backend-for-Frontend API Aggregation Platform
Per-client backend-for-frontend services and a GraphQL gateway that aggregate microservices into tailored, efficient API responses.
Single-Page Application with API Backend
A client-rendered SPA served from a CDN that talks to a stateless REST API, with token-based auth and a managed database.
Playbooks9
API Modernization Playbook
Transform legacy APIs to modern REST or GraphQL
API-First Transformation Program Playbook
An organization-wide program to adopt API-first design with contract governance, an API gateway, and a developer portal.
Master Data Management Program Playbook
Establish a master data management program to create golden records, resolve duplicates, and govern shared reference data across systems.
GraphQL Adoption Program Playbook
A program to adopt GraphQL alongside existing REST APIs, covering schema design, a federated gateway, performance, and governance.
gRPC Migration Program Playbook
A program to migrate internal service-to-service communication from REST/JSON to gRPC for lower latency and strong contracts.
API Gateway Rollout Playbook
A program to roll out a centralized API gateway for authentication, rate limiting, routing, and observability across services.
API-First Design Program Playbook
A program to establish API-first practices across teams using OpenAPI contracts, mock-driven development, and contract testing.
Webhook Platform Rollout Playbook
A program to build a reliable webhook delivery platform with signing, retries, idempotency, and subscriber management.
REST API Versioning and Deprecation Playbook
A program to establish disciplined REST API versioning, backward compatibility, and graceful deprecation across a portfolio.
Checklists11
API-First Design Review Checklist
Review an API design before implementation to ensure contract, versioning, and consistency standards are met up front.
Backward-Compatibility Review Checklist
Review a change to a service, API, or schema to confirm existing consumers and data continue to work without breaking.
API Design Review Checklist
Review items for evaluating a new or changed HTTP API against design, consistency, and developer-experience standards.
API Versioning and Deprecation Checklist
Verification items for introducing a new API version and retiring an old one without breaking existing consumers.
GraphQL Migration Readiness Checklist
Readiness items for migrating a REST API or adding a GraphQL layer without losing performance, security, or observability.
gRPC Rollout Checklist
Pre-flight items for rolling out gRPC services across a system, covering contracts, compatibility, security, and observability.
API Security (OAuth/OIDC) Review Checklist
Security review items for an API protected by OAuth 2.0 and OpenID Connect, covering tokens, flows, scopes, and validation.
Webhook Reliability Checklist
Verification items for delivering and consuming webhooks reliably, covering signing, retries, idempotency, and ordering.
Third-Party Integration Cutover Checklist
Cutover items for switching to or replacing a third-party API or vendor integration with minimal disruption.
API Rate Limiting and Throttling Readiness Checklist
Verification items for designing fair, abuse-resistant rate limiting and throttling for a public or internal API.
Microservices API Contract Testing Checklist
Verification items for establishing consumer-driven contract testing across microservices to prevent integration breakage.
Stacks5
FastAPI + SQLAlchemy Stack
Async Python backend stack using FastAPI, SQLAlchemy, and PostgreSQL for high-performance, type-hinted REST and ML-serving APIs.
Node + Express + Mongo Stack
JavaScript backend stack using Node.js, Express, and MongoDB for flexible, schema-light REST APIs and rapid prototyping.
Rails API Stack
Ruby on Rails backend in API mode with PostgreSQL and Redis for convention-driven, fast-to-build REST services and SaaS backends.
Vapor Swift Server
A server-side Swift web framework using async/await and a typed ORM, letting iOS-focused teams build backends in the same language as their apps.
Symfony + API Platform
A robust PHP stack using the Symfony framework and API Platform to generate REST and GraphQL APIs from data models with documentation and standards built in.
Comparisons13
Go vs Node.js for APIs
For building HTTP and gRPC APIs, Go offers compiled performance and easy concurrency, while Node.js offers rapid development and full-stack JavaScript.
REST in Go vs REST in Java
Building REST APIs in Go with its lean standard library versus in Java with mature frameworks like Spring Boot. Different trade-offs in speed, structure, and tooling.
Django vs FastAPI
Django is a batteries-included framework for full web apps; FastAPI is a modern, async, type-driven framework focused on high-performance APIs.
FastAPI vs Flask
FastAPI is async-first with type-driven validation and auto docs; Flask is a mature, synchronous microframework with a vast extension ecosystem.
Express vs Fastify
Express is the ubiquitous, minimal Node.js framework; Fastify is a modern alternative built for higher throughput and schema-based validation.
Gin vs Echo
Gin and Echo are two of the most popular Go web frameworks, both fast and minimal, differing mainly in API design and built-in features.
Actix vs Axum
Actix Web and Axum are leading Rust web frameworks; Actix is feature-rich and battle-tested, Axum is built on Tower with strong type-driven ergonomics.
REST vs GraphQL
REST exposes many resource-oriented endpoints; GraphQL exposes one typed endpoint where clients request exactly the fields they need.
gRPC vs REST
gRPC is a contract-first, binary, HTTP/2 RPC framework; REST is a resource-oriented, text-based HTTP style. Both build service APIs.
GraphQL vs gRPC
GraphQL is a client-driven query language for flexible APIs; gRPC is a high-performance binary RPC framework. Each targets different API problems.
REST vs SOAP
SOAP is a rigid XML-based messaging protocol with built-in standards; REST is a lightweight resource-oriented HTTP style. Both expose web services.
WebSockets vs Server-Sent Events
WebSockets give full-duplex bidirectional channels; Server-Sent Events provide simple one-way server-to-client streaming over HTTP.
OpenAPI vs AsyncAPI
OpenAPI describes synchronous request/response HTTP APIs; AsyncAPI describes event-driven, message-based APIs over brokers and streams.
FAQs8
What is the difference between REST and GraphQL?
REST exposes data through multiple fixed endpoints, each returning a predefined resource representation, and relies on HTTP verbs and status codes. Gr...
What is gRPC and when should I use it?
gRPC is a high-performance remote procedure call framework that uses Protocol Buffers for compact binary serialization and HTTP/2 for transport, inclu...
What is an API gateway?
An API gateway is a server that sits in front of one or more backend services and acts as a single entry point for clients. It handles cross-cutting c...
What is rate limiting and how does it work?
Rate limiting caps how many requests a client may make in a given window to protect a service from overload, abuse, and runaway costs. Common algorith...
What does idempotency mean in APIs?
An operation is idempotent if performing it multiple times has the same effect as performing it once. In HTTP, GET, PUT, and DELETE are defined as ide...
What is an idempotency key?
An idempotency key is a unique client-generated identifier, often a UUID, sent with a request so the server can recognize and safely deduplicate retri...
What is a webhook?
A webhook is a way for one system to push real-time notifications to another by sending an HTTP POST to a URL the receiver registered in advance. Inst...
What are common API versioning strategies?
API versioning lets you evolve an interface without breaking existing clients. Common approaches are URI versioning (`/v1/orders`), which is explicit ...
Glossaries15
API Versioning
The practice of managing changes to an API over time while maintaining backward compatibility for existing consumers
Ingress
Ingress is a Kubernetes resource that defines rules for routing external HTTP and HTTPS traffic to internal services, typically based on hostnames and URL paths.
Model Context Protocol (MCP)
The Model Context Protocol is an open standard that defines how AI applications connect to external tools, data sources, and prompts through a uniform interface.
OAuth 2.0
OAuth 2.0 is an authorization framework that lets an application obtain limited access to a user's resources on another service without exposing the user's credentials, by using access tokens.
JSON Web Token (JWT)
A JSON Web Token is a compact, URL-safe, digitally signed token that encodes claims as JSON, commonly used to transmit identity and authorization data between parties.
GraphQL
GraphQL is a query language and runtime for APIs that lets clients request exactly the fields they need from a single endpoint, returning a precisely shaped response.
gRPC
gRPC is a high-performance remote procedure call framework that uses HTTP/2 for transport and Protocol Buffers for compact, strongly typed message serialization.
Webhook
A webhook is an HTTP callback that one system sends to a user-supplied URL when an event occurs, pushing data to subscribers instead of requiring them to poll for changes.
Rate Limiting
Rate limiting is a technique that caps how many requests a client may make to a service within a time window, protecting capacity and enforcing fair usage.
Idempotency
Idempotency is the property that performing an operation multiple times produces the same result as performing it once, making safe retries possible in distributed systems.
Pagination
Pagination is the practice of dividing a large result set into smaller, ordered pages so that an API returns data in manageable chunks rather than all at once.
OpenAPI
OpenAPI is a language-agnostic specification for describing HTTP APIs in a machine-readable document, enabling shared contracts, documentation, and code generation.
JSON
JSON (JavaScript Object Notation) is a lightweight, text-based data interchange format that represents structured data as key-value objects and arrays.
CORS
CORS (Cross-Origin Resource Sharing) is a browser security mechanism that uses HTTP headers to let a server permit web pages from other origins to access its resources.
Idempotent Operation
An idempotent operation produces the same result whether it is performed once or many times, so repeating it has no additional effect beyond the first successful application.