Blog

Posts tagged “Fastify”

Node.js large file upload, no OOM. Cover graphic for a guide to streaming large uploads in Node.js without running out of memory.
Coding

Node.js large file upload handling without running out of memory

One 2 GB upload should not take your API down with it. Here is how to stream uploads in Express and Fastify, when to use presigned URLs, and which parsers to patch.

Jason Fill October 5, 2026 6 min read
Cursor vs offset pagination at page 4000. Cover graphic for a guide to keyset pagination in Node.js and Postgres APIs.
Coding

Cursor vs offset pagination: an API design that survives big tables and scrapers

Offset pagination was fast at launch; now deep pages hammer the database and one API key is walking every page. Here is when to switch to cursors and how.

Jason Fill August 21, 2026 6 min read
Zod validation, before the 500. Cover graphic for a guide to validating request bodies and query strings with Zod in Express and Fastify.
Coding

Zod validation in Express and Fastify: request bodies, query strings and useful errors

A null where your handler expected an array becomes a 500 and a support ticket. Validate bodies, query strings and params with Zod 4 in Express 5 and Fastify 5, return 400s clients can act on, and stop extra fields at the door.

Jason Fill July 17, 2026 6 min read
Spot a CORS misconfiguration in one curl. Cover graphic for a guide to finding, fixing and testing CORS misconfiguration in Express and Fastify.
Security

CORS misconfiguration in Express and Fastify: how to find it and test for it

One line added to silence a frontend error, cors({ origin: true, credentials: true }), lets any website read your users' data. Find CORS misconfiguration in Express and Fastify APIs, fix it, and test it in CI.

Jason Fill June 12, 2026 5 min read
Fastify hooks: which one does what. Cover graphic for a guide to using Fastify onRequest, preHandler and onResponse hooks for auth and logging.
Coding

Fastify hooks for logging and auth: onRequest, preHandler and onResponse explained

Auth checks that run before the body exists, log lines missing the status code, handlers that run after a 401: most come from using the wrong Fastify hook. Here is which hook does which job in Fastify v5, with working code.

Jason Fill April 20, 2026 6 min read
BOLA vulnerability: one digit away. Cover graphic for a guide to fixing BOLA and IDOR in Node APIs and spotting probing in request logs.
Security

BOLA vulnerability in Node APIs: how to fix IDOR and catch it in your logs

Change one digit in a URL and get another customer's invoice. Here is how to fix BOLA and IDOR structurally and spot someone probing for it before they find a gap.

Jason Fill April 13, 2026 6 min read
Node.js fetch timeout, set properly. Cover graphic for a guide to setting Node.js fetch timeouts with AbortSignal and undici.
Coding

Node.js fetch timeout: deadlines with AbortSignal and undici

One slow vendor and every handler hangs, because Node fetch waits up to five minutes by default. Here is how to set deadlines with AbortSignal and undici in Express and Fastify.

Jason Fill February 9, 2026 6 min read
Node.js health checks that tell the truth. Cover graphic for a guide to liveness and readiness health checks in Node.js.
Monitoring

Node.js health checks that tell the truth: liveness vs readiness

A database blip should not restart every replica of your API. Split /health into liveness and readiness, with Express and Fastify code you can ship today.

Jason Fill January 13, 2026 6 min read
Node.js graceful shutdown, done right. Cover graphic for a guide to draining requests on SIGTERM in Express and Fastify.
Coding

Node.js graceful shutdown: stop dropping requests on every deploy

A burst of 502s on every deploy is usually the old process dying with requests in flight. Here is the shutdown order and Express and Fastify code that fixes it in an afternoon.

Jason Fill December 29, 2025 6 min read
AsyncLocalStorage request IDs on every line. Cover graphic for a guide to adding request IDs to Node.js logs with AsyncLocalStorage.
Coding

AsyncLocalStorage request IDs: follow one request through a Node.js API

A customer says checkout failed at 2pm and your logs are fifty requests interleaved. Add request IDs with AsyncLocalStorage in Express or Fastify in an afternoon, and every log line, response and downstream call carries the same ID.

Jason Fill November 24, 2025 6 min read
Pino logging you can actually query. Cover graphic for a guide to structured Pino logging in Express and Fastify.
Logging

Pino logging in Node.js: a practical structured logging setup for Express and Fastify

A customer says invoices failed yesterday and your logs are a wall of console.log. Set up Pino logging for Express or Fastify in an afternoon: JSON lines, request IDs, levels by status, redaction and a team checklist.

Jason Fill November 4, 2025 6 min read