CTO & Co-Founder, Atoa. Building open banking payments for the UK. Half the cost of cards. Instant settlement. FCA-authorised. I hire for intent, not resumes. I write about payments, AI, and the messy
Running both Zod and class-validator in production across our NestJS services. Here's the honest split: class-validator wins at the HTTP request layer — the decorator pattern integrates naturally with NestJS pipes, and the error messages map cleanly to API responses. Zod wins everywhere else — env config validation, inter-service contracts, shared domain types.
The error messages alone justify Zod for config: "DB_HOST: Expected string, received undefined" at startup beats discovering a missing env var in production at 2am. We tried going all-Zod but the NestJS integration at the controller level still has friction.
The pragmatic answer in 2026: use both, draw a clear line between where each owns validation, and don't pretend one library solves every layer. Great comparison — the "validate at the boundary" principle is spot on. We just found that in a multi-service architecture, you have more boundaries than you'd expect.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Running both Zod and class-validator in production across our NestJS services. Here's the honest split: class-validator wins at the HTTP request layer — the decorator pattern integrates naturally with NestJS pipes, and the error messages map cleanly to API responses. Zod wins everywhere else — env config validation, inter-service contracts, shared domain types.
The error messages alone justify Zod for config: "DB_HOST: Expected string, received undefined" at startup beats discovering a missing env var in production at 2am. We tried going all-Zod but the NestJS integration at the controller level still has friction.
The pragmatic answer in 2026: use both, draw a clear line between where each owns validation, and don't pretend one library solves every layer. Great comparison — the "validate at the boundary" principle is spot on. We just found that in a multi-service architecture, you have more boundaries than you'd expect.