PHP API Performance: N+1 Queries, cURL, and Connection Pools
A PHP API case study: fixing an N+1 query, twenty serial cURL calls, missing connection pooling, and stats recalculated on every request with Redis caching.
Designing and building APIs: REST, Express, TypeScript, performance and what an API actually is.
A PHP API case study: fixing an N+1 query, twenty serial cURL calls, missing connection pooling, and stats recalculated on every request with Redis caching.
Tutorials that show you how to build an API in 50 lines of code are lying to you. This is what a production TypeScript API actually looks like — authentication, validation, error handling, rate limiting, database connection pooling, structured logging, and a test suite. All of it, from scratch.
An API is a contract between two pieces of software. One side defines what requests it accepts and what responses it sends. The other side follows that contract to get work done. Every app on your phone, every website pulling live data, and every service talking to another service uses APIs.
Build a REST API in Node.js and Express the way production systems need: input validation, JWT auth, refresh token rotation, status codes, rate limiting, idempotency keys, and centralized error handling.