<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/day-18-30-make-it-idempotent-ifvtwniu1" -->

---
title: Day 18/30 — Make It Idempotent | daily.dev
description: Systems that handle retries, webhooks, and queue redelivery must treat duplicate operations as normal rather than exceptional. Key protections discussed...
canonical: https://daily.dev/posts/day-18-30-make-it-idempotent-ifvtwniu1
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Day 18/30 — Make It Idempotent | daily.dev
og:description: Systems that handle retries, webhooks, and queue redelivery must treat duplicate operations as normal rather than exceptional. Key protections discussed...
og:url: https://daily.dev/posts/day-18-30-make-it-idempotent-ifvtwniu1
og:image: https://api.daily.dev/og/posts/ifvtwniu1.png
og:image:alt: Day 18/30 — Make It Idempotent
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Day 18/30 — Make It Idempotent

**[Nestjs Developers](https://daily.dev/sources/nestjsdevs)** · [@ezilemdodana](https://daily.dev/ezilemdodana) · 1 min read · 7 upvotes · 1 comments

## Summary

Systems that handle retries, webhooks, and queue redelivery must treat duplicate operations as normal rather than exceptional. Key protections discussed include idempotency keys, unique database constraints, atomic state transitions, stored provider references, and idempotent job processors. A simple check-then-insert pattern is insufficient under race conditions, since 'exactly once' delivery is a promise, while true idempotent processing is what engineers must actually build.

## Content

Clients retry. Payment gateways resend webhooks. Queues redeliver jobs.

Your system must assume that the same operation can arrive more than once.

Useful protections include:

- Idempotency keys
- Unique database constraints
- Atomic state transitions
- Stored provider references
- Idempotent job processors

Checking whether a record exists and then inserting it is not enough when two requests race.

“Exactly once” is usually a promise.

Idempotent processing is the engineering.

Which endpoint in your application most needs an idempotency key?

#NestJS #DistributedSystems #Payments

## Community discussion

Top comments from developers on daily.dev.

**@navyaak** · 1 upvotes

> Payment-related endpoints most need idempotency keys.Duplicate requests should be prevented from causing multiple charges or transactions. But system should capable of identifying duplicate or requests with same details. So cannot  use the request details alone to detect duplicates.

## Similar posts on daily.dev

- [How to Stop Charging Customers Twice: A Practical Idempotency Guide](https://daily.dev/posts/how-to-stop-charging-customers-twice-a-practical-idempotency-guide-m6qetcboi) · The T-Shaped Dev · 0 upvotes · 1 comments
- [Idempotency Is Easy Until the Second Request Is Different](https://daily.dev/posts/idempotency-is-easy-until-the-second-request-is-different-skbwedvu3) · Hacker News · 0 upvotes · 0 comments
- [From HTTP Retries to Kafka Redelivery: Building End-to-End Idempotency with FastAPI](https://daily.dev/posts/from-http-retries-to-kafka-redelivery-building-end-to-end-idempotency-with-fastapi-m2qkobimp) · Medium · 0 upvotes · 0 comments
- [How to Check Idempotency and Duplicates of Requests in Web Applications](https://daily.dev/posts/how-to-check-idempotency-and-duplicates-of-requests-in-web-applications-ozp46xvld) · Software Testing Magazine · 0 upvotes · 1 comments
- [The Idempotent Consumer Pattern in .NET \(And Why You Need It\)](https://daily.dev/posts/the-idempotent-consumer-pattern-in-net-and-why-you-need-it--7cs6q6lwd) · Milan Jovanović · 6 upvotes · 1 comments

---

Tags: [#distributed-systems](https://daily.dev/tags/distributed-systems), [#nestjs](https://daily.dev/tags/nestjs)

[View this post on daily.dev](https://daily.dev/posts/day-18-30-make-it-idempotent-ifvtwniu1)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"DiscussionForumPosting","mainEntityOfPage":"https://daily.dev/posts/day-18-30-make-it-idempotent-ifvtwniu1","headline":"Day 18/30 — Make It Idempotent","text":"Systems that handle retries, webhooks, and queue redelivery must treat duplicate operations as normal rather than exceptional. Key protections discussed include idempotency keys, unique database constraints, atomic state transitions, stored provider references, and idempotent job processors. A simple check-then-insert pattern is insufficient under race conditions, since 'exactly once' delivery is a promise, while true idempotent processing is what engineers must actually build.","url":"https://daily.dev/posts/day-18-30-make-it-idempotent-ifvtwniu1","datePublished":"2026-08-18T08:57:14.100Z","dateModified":"2026-09-13T21:07:05.492Z","author":{"@type":"Person","name":"Ezile Mdodana","url":"https://daily.dev/ezilemdodana","image":"https://media.daily.dev/image/upload/s--1OI8gwnO--/f_auto/v1771923757/avatars/avatar_7vB9SeLRKhOHGnzEpmFvQ?_a=BAMAMiiu0","description":"Software Project Lead sharing practical insights on NestJS, Angular, AWS and scalable systems.","interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":8430}},"image":"https://media.daily.dev/image/upload/s--2Kkd17iv--/f_auto/v1787043436/posts/ifvtwniu1?_a=BAMAMicg0","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":7},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":1}],"comment":[{"@type":"Comment","text":"Payment-related endpoints most need idempotency keys.Duplicate requests should be prevented from causing multiple charges or transactions. But system should capable of identifying duplicate or requests with same details. So cannot  use the request details alone to detect duplicates.","datePublished":"2026-08-23T15:56:25.732Z","url":"https://daily.dev/posts/ifvtwniu1#c-tUrdWbjpr","author":{"@type":"Person","name":"navya","url":"https://daily.dev/navyaak","image":"https://media.daily.dev/image/upload/s--vM6dTj_h--/f_auto/v1788852968/avatars/avatar_DLRmpRw88MjNBUKqs8T0W?_a=BAMAMicg0"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1}}],"isPartOf":{"@type":"WebPage","url":"https://daily.dev/squads/nestjsdevs","name":"Nestjs Developers"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Nestjs Developers","item":"https://daily.dev/squads/nestjsdevs"},{"@type":"ListItem","position":3,"name":"Day 18/30 — Make It Idempotent"}]}
```

