The "Remote Validation" Struggle

Hey everyone! 👋

If you work with NestJS, you probably love class-validator. Putting an @IsEmail() decorator on a property and sleeping soundly knowing bad data won’t reach your Service is a great feeling.

But that peace of mind usually vanishes when we need Remote Validation.

You know the scenario:

  1. The frontend sends a userId, couponCode, or transactionId.
  2. You need to hit an external Microservice or API to check if it’s valid.
  3. If it’s valid, you often need to fetch extra data (like the user’s name) to save it locally.

The "Dirty" Way (We’ve all done this):

// ❌ The common anti-pattern
@Post()
async create(@Body() dto: CreateOrderDto) {
// Validation logic leaking into the Controller/Service
const res...

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help