
Cancellation Patterns in TypeScript: Taming AbortController
Why most async TypeScript code ignores cancellation entirely, and how to build composable, leak-free cancellation with AbortController.
Tags
33 articles

Why most async TypeScript code ignores cancellation entirely, and how to build composable, leak-free cancellation with AbortController.

When a cache entry expires under high traffic, dozens of requests race to rebuild it simultaneously — here's how inflight request deduplication collapses that stampede into a single upstream call.

Stop loading entire result sets into memory: how Node.js streams and async generators let you process millions of records without blowing the heap.

Stop racing conditions in distributed systems: a practical guide to implementing distributed locks with Redis and PostgreSQL advisory locks in Node.js.

Replace Node's stringly-typed EventEmitter with a generic typed alternative that catches event name typos and payload mismatches at compile time.

Unbounded Promise.all is a silent OOM killer — here's how to build semaphores, throttled queues, and stream backpressure into your Node.js applications.

Use AsyncLocalStorage to propagate request-scoped context — trace IDs, user sessions, tenant data — through async call stacks without threading values through every function signature.

Most Node.js services silently drop in-flight requests on every deploy. Here's how to handle SIGTERM correctly, drain connections, and exit cleanly in Kubernetes.

Stop bolting middleware onto frameworks and start building type-safe, composable pipeline primitives you can test in isolation and reason about at a glance.

Learn how to use Node.js worker threads to handle CPU-intensive tasks without blocking the event loop, with thread pooling and type-safe messaging patterns.

Implement structured logging in Node.js services that produces machine-parsable, searchable log entries with correlation IDs, consistent severity levels, and context propagation that makes debugging production incidents fast and reliable.

A step-by-step tutorial for building a scalable real-time notification system using WebSockets, Redis pub/sub for multi-server broadcasting, and persistent notification storage with read tracking.

A step-by-step tutorial for implementing full-text search with Elasticsearch covering index design, analyzers, fuzzy matching, faceted search, and performance optimization patterns.

A guide to identifying repetitive development tasks and building custom CLI tools to automate them, covering task analysis, script design patterns, and the compound returns of workflow automation.

A practical guide to implementing GraphQL subscriptions for real-time features, covering WebSocket setup with Apollo Server, subscription resolvers, client integration, and production scaling patterns.

A step-by-step tutorial for building a live-updating dashboard using Server-Sent Events, covering the SSE protocol, server implementation in Node.js, and React client integration with reconnection handling.

A deep dive into database connection pooling for Node.js services, covering pool sizing, health checks, failover patterns, and the common misconfigurations that cause production outages.

Build a production-quality CLI tool with Node.js covering argument parsing, interactive prompts, progress indicators, error handling, and distribution through npm, with patterns that make command-line tools feel polished and professional.

Configure and optimize database connection pools for high-throughput Node.js applications with practical examples covering pool sizing, health checks, connection lifecycle management, and common pitfalls that cause pool exhaustion.

Build practical automation scripts that eliminate daily development friction including project scaffolding, database seeding, log analysis, and deployment verification using Node.js and shell commands.

Step-by-step tutorial for building a professional CLI tool in Node.js with argument parsing, interactive prompts, colored output, progress indicators, configuration files, and cross-platform publishing to npm.

Implement runtime security monitoring patterns that detect and block attacks from inside your Node.js application, covering SQL injection detection, path traversal prevention, and anomalous behavior alerting.

Build a production-ready task queue step by step using Node.js and Redis, covering reliable delivery, retries, dead letter queues, and concurrency control.

A step-by-step tutorial for building a GraphQL server with TypeScript — covering schema design, resolvers, dataloaders for N+1 prevention, authentication, error handling, and deployment patterns.

A hands-on guide to instrumenting Node.js applications with OpenTelemetry — covering traces, metrics, and logs with auto-instrumentation, custom spans, context propagation, and exporter configuration.

A step-by-step tutorial for building an event-driven microservice using Node.js, RabbitMQ, and TypeScript — covering event publishing, consumption, dead letter queues, and idempotent processing.

A step-by-step tutorial for building a URL shortener service with short code generation, redirect handling, click analytics, and rate limiting — covering the full system design from database schema to API.

A step-by-step tutorial for building a live-updating dashboard using WebSockets — covering server setup, client connection management, data streaming, reconnection logic, and scaling considerations.

How to implement structured logging that makes production debugging fast — covering JSON log formats, context propagation, log levels, sensitive data masking, and integration with log aggregation tools.

A hands-on guide to implementing GraphQL subscriptions for real-time updates — covering WebSocket transport, subscription resolvers, filtering, and scaling considerations.

A complete guide to building, testing, and distributing a Node.js CLI tool — covering argument parsing, interactive prompts, output formatting, and npm publishing.

Techniques for diagnosing memory leaks, excessive allocation, and OOM kills in production — covering heap snapshots, profiling tools, and common leak patterns.

Patterns for integration tests that are reliable, fast, and catch real bugs — covering database setup, API testing, and avoiding flaky test syndrome.