#Node.js
21 posts tagged with this topic. ← All tags
-
HTTP streaming: chunked transfer and what it enables.
Chunked transfer encoding lets servers send response data before they know the total size. Here's how it works and what patterns it unlocks.
-
Circuit breakers: stopping a cascade failure before it takes everything down.
How the circuit breaker pattern prevents cascade failures in distributed systems, with a Node.js implementation.
-
Serverless functions on Vercel: the Node model and what it can't do.
How Vercel serverless functions work under the Node.js runtime, including execution model, limits, and what patterns don't fit.
-
Rate limits and retry logic for AI APIs.
How OpenAI and other AI API rate limits work, and how to build retry logic that handles them without hammering the provider.
-
ws vs Socket.io: when the abstraction is worth the overhead.
ws is a minimal WebSocket library. Socket.io adds rooms, auto-reconnection, fallbacks, and events on top. What you get from each and when the tradeoffs make sense.
-
Express app structure: the folders that keep a growing codebase navigable.
A flat Express project works until it doesn't. Here's a folder structure that separates concerns, scales with the project, and stays readable for new contributors.
-
Rate limiting without a third-party service: the pattern that holds up.
You don't need Redis or an external service to rate limit a Node.js API. Here's the in-process pattern that works for single-instance apps and the point where you need to upgrade.
-
The middleware chain is everything in Express. Here's how requests move.
Understanding how a request flows through Express middleware is the foundation of every feature you'll build. Here's how the chain actually works.
-
Express routing patterns that don't turn into spaghetti at scale.
A flat routes file works for 5 endpoints. Here are the patterns that keep an Express app navigable at 50 or 500 endpoints.
-
Memory leaks in Node look like slowdowns. Here's how to find them.
Memory leaks in Node.js cause gradual performance degradation. Here's how to identify common patterns and use heap snapshots to find them.
-
Debugging Node: the --inspect flag and when console.log is the last resort.
Node.js has a full debugger accessible from Chrome DevTools. --inspect gives you breakpoints, call stacks, and memory inspection.
-
Graceful shutdown: the signal handler every production Node app needs.
Without a shutdown handler, your Node process drops active connections when it stops. Here's how to finish in-flight requests before exiting.
-
Worker threads: CPU-bound work that doesn't block your server.
Node.js is single-threaded, but worker threads let you run CPU-intensive code in parallel without blocking the event loop.
-
Never hardcode a secret. Here's how Node env variables actually work.
Environment variables are the standard way to configure Node.js applications without hardcoding secrets. Here's how they work end to end.
-
path.join vs path.resolve: not interchangeable. The difference matters.
path.join concatenates path segments. path.resolve builds an absolute path. Using the wrong one produces different results depending on environment.
-
child_process: running shell commands from Node without shooting yourself.
Node's child_process module lets you run shell commands, but the API choices matter. Here's how to use it safely and correctly.
-
Streams in Node: the only way to handle files bigger than RAM.
Node.js streams process data incrementally. They are the right tool for large files, network data, and any situation where you can't load everything into memory.
-
Node event emitters: the pattern under half of the ecosystem.
EventEmitter is the backbone of Node.js streams, HTTP servers, and many popular packages. Understanding it makes the rest of Node.js click.
-
require() vs import: they look the same and work completely differently.
CommonJS require() and ES module import are not interchangeable. Understanding the difference explains module compatibility issues and bundler behavior.
-
Typed Express: req, res, next with types that don't lie.
Express's default TypeScript types are loose. Here's how to get accurate types on req.body, req.params, res.json, and custom middleware.
-
DTOs: the pattern that keeps API input from contaminating business logic.
Data Transfer Objects create a boundary between what comes in over the wire and what your application actually works with.