idempotency-key

Community

Ensure a single execution per client in NestJS.

Authormthang1801
Version1.0.0
Installs0

System Documentation

What problem does it solve?

The Idempotency Key pattern ensures that multiple identical requests from a client (e.g., due to network retries, double-clicks) result in only a single execution of the operation on the server. This prevents duplicate mutations and preserves data integrity.

Core Features & Use Cases

  • Header-driven deduplication: Clients must provide an Idempotency-Key header for mutating requests (POST, PUT, PATCH, DELETE).
  • Middleware/Interceptor support: Implement an IdempotencyInterceptor or equivalent to capture keys and payloads.
  • State management with Redis: Use a lightweight state machine (PENDING, COMPLETED, FAILED) and a TTL (e.g., 24 hours) to guard against repeated processing.
  • Use cases: Guard for order creation, payments, and other operations where retries should not produce duplicates.

Quick Start

Add an IdempotencyInterceptor to your NestJS app and apply it to endpoints that mutate data using the Idempotency-Key header.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: idempotency-key
Download link: https://github.com/mthang1801/go-domain-driven-design/archive/main.zip#idempotency-key

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.