Articles

Blog

Articles on NestJS, React, TypeScript and DevOps: patterns, tools and things learned building real applications.

Optimistic vs Pessimistic Locking in NestJS with Drizzle ORM and Postgres

Stop lost updates in NestJS. Learn optimistic locking with a version column, pessimistic locking with SELECT FOR UPDATE, NOWAIT, SKIP LOCKED, and atomic updates using Drizzle ORM and Postgres, with a race test that proves each one.

September 12, 2026 / 13 min read

Clean Architecture, DDD, and the Dependency Inversion Principle: How They Fit Together

If you’ve ever inherited a codebase where business rules live inside route handlers, validation is copy-pasted across three controllers, and switching databases would mean a six-month rewrite — this article is for you. Clean Architecture, Domain-Driven Design (DDD), and the Dependency Inversion Principle (DIP) are usually taught as three separate topics. In practice, they’re one …

July 26, 2026 / 6 min read

End-to-End Type Safety with TanStack Router, NestJS, oRPC, and Better Auth

TypeScript on both the frontend and backend doesn’t guarantee type safety if your API contract can drift. In this post, I walk through the stack I’ve been using to solve that problem: TanStack Router, NestJS, oRPC, Better Auth, and Drizzle.

June 13, 2026 / 7 min read

Enabling Gzip Compression with Istio

Enabling gzip compression at the Istio ingress layer can dramatically reduce response sizes and improve API performance without touching your NestJS code. In this post, I walk through the exact EnvoyFilter setup, real k6 performance gains, and when you might still choose to enable compression directly in your NestJS app instead.

April 13, 2026 / 6 min read

Type-Safe Full-Stack Development: Shared Types Between TanStack Router and NestJS with Zod

In this guide, we’ll explore how to create a shared types package in a Turborepo monorepo, leveraging Zod schemas for both validation and type generation, integrated seamlessly with NestJS and TanStack Router.

December 27, 2025 / 13 min read

Implementing the Strategy Pattern in NestJS

Learn how the Strategy Pattern helps you write cleaner, more modular NestJS code by applying the Dependency Inversion Principle. Instead of hardcoding logic with endless conditionals, you’ll see how to design flexible, testable strategies that keep your core business logic decoupled from implementation details.

October 29, 2025 / 4 min read

Implementing Idempotency in NestJS with an Interceptor

When building APIs, especially for payments or operations that modify state, you want to avoid executing the same request multiple times if the client retries. In this post, we’ll walk through how to bring that Stripe-style idempotency pattern into a NestJS application using an Interceptor.

September 3, 2025 / 4 min read

How to Integrate Better-Auth with NestJS + tRPC

Integrating authentication into a NestJS + tRPC project doesn’t have to be painful. In this guide, we’ll walk through wiring up Better-Auth with nestjs-trpc so every API call can automatically resolve the current user from secure cookies.

August 25, 2025 / 5 min read

Add SSL to Drizzle + NestJS for AWS RDS (Postgres)

Connecting to AWS RDS without SSL leaves your database traffic exposed. This guide shows how to secure Drizzle ORM + NestJS with TLS covering Drizzle Kit setup, a production-ready DatabaseModule, and deployment tips for Docker and Kubernetes.

August 9, 2025 / 4 min read

Building a NestJS App with SWC: A Step-by-Step Guide

Supercharge your NestJS development by replacing tsc with SWC — a Rust-based TypeScript compiler that’s up to 20× faster and more memory-efficient. This hands-on guide for experienced developers walks you through setting up a standalone NestJS app with SWC, complete with configuration tips, performance benchmarks, and Docker deployment strategies.

June 18, 2025 / 12 min read

Express vs Fastify: A Performance Benchmark Comparison

In this detailed performance benchmark, we put Express and Fastify head-to-head in a real-world test using Autocannon. Our results showed Fastify handling over twice the number of requests per second and delivering significantly lower latency compared to Express. Dive into the analysis to discover why Fastify consistently outperforms Express and understand when each framework might be the right choice for your Node.js applications.

April 28, 2025 / 9 min read

Optimizing NestJS Performance with HTTP Keep-Alive

HTTP Keep-Alive is one of the easiest ways to boost performance in your NestJS apps. By reusing TCP connections for multiple requests, you can reduce latency, avoid port exhaustion, and handle higher throughput with less overhead. In this post, we’ll explore how to enable and tune Keep-Alive in both NestJS servers and clients, including real-world best practices for high-performance APIs.

April 10, 2025 / 15 min read

When to use Microservices in Node.js

Microservices offer scalability and flexibility, but they also introduce significant complexity, making them a poor fit for many Node.js applications. The key is not to default to microservices but to adopt them when the trade-offs justify the benefits.

March 18, 2025 / 10 min read

Speed Up Jest Test Suites with Sharding

Large test suites in Node.js and React projects can significantly slow down your continuous integration (CI) pipeline. Jest already runs tests in parallel on a single machine using worker processes, but for very large suites you may need to parallelize across multiple machines. Jest 28 introduced a new –shard option that makes it easy to split your test suite into chunks and run them concurrently on separate CI runners.

March 6, 2025 / 14 min read

Building a Standalone NestJS Application for Web Scraping

NestJS is a versatile framework that can go beyond server-based applications. In this guide, we’ll focus on building a NestJS standalone application, showcasing how to utilize its modular structure and dependency injection to create a CLI-based tool for web scraping

December 28, 2024 / 5 min read

Why Apache Pulsar is Better for Scaling Node.js Applications Than Kafka

When building Node.js applications that rely on message brokers for asynchronous communication, developers often face the challenge of choosing between Apache Kafka and Apache Pulsar. While both are excellent distributed messaging systems, Pulsar has distinct advantages when it comes to scaling Node.js applications. This blog post explains why Pulsar’s architecture and features make it a better fit for the Node.js ecosystem compared to Kafka, especially for dynamic, horizontally scaled systems.

November 23, 2024 / 7 min read

NestJS Custom Decorators

Learn to utilize custom decorators in NestJS to make your code cleaner & adhere to the single responsibility principle.

September 5, 2024 / 6 min read

NestJS Domain Driven Design With Class Transformer

Learn how to implement domain driven design in NestJS with class-transformer & start writing cleaner, less complex code while also reducing bugs.

August 13, 2024 / 6 min read

NestJS Factory Method Pattern

Learn how to implement the powerful factory method pattern in a NestJS application to keep your code clean & less complex.

July 25, 2024 / 4 min read