Node.js Middleware — never again!
summary
Examines problems caused by using Node.js middleware—memory leaks, crashes, hard-to-debug errors, race conditions, mixin pollution and fat controllers—and argues how to remove or limit middleware. Covers layered architecture, patterns and principles, what middleware (if anything) to keep, alternatives in frameworks like Nest (interceptors), TypeScript, decorators, ORMs (Prisma), testing strategies and practical steps to refactor legacy Node.js projects away from middleware antipatterns.
AI-written summary · about
chapters (22)
- 0:00Start
- 2:40What is middleware?
- 5:26Middleware issues
- 22:36Race condition
- 24:26Mixin pollution
- 29:50Fat controller
- 41:40Middleware provokes antipatterns
- 49:28Layered architecture
- 56:20Patterns and principles
- 1:04:05Key points and useful links
- 1:11:36What can be left in middleware?
- 1:12:40Why did middleware become popular?
- 1:18:20Middleware interceptor in Nest
- 1:20:08Is Typescript always necessary?
- 1:21:02Decorators
- 1:23:07When do you need ORM?
- 1:25:27Why choose Node.js?
- 1:29:50One middleware for refresh token or functions in every controller?
- 1:32:20Prisma
- 1:36:16Tests for abstraction words, unit tests
- 1:38:54Framework
- 1:40:40How to fix legacy code in a project?








