hp24-idemkit-fastify
v0.1.0
Published
Fastify plugin adding Idempotency-Key support to your routes, powered by hp24-idemkit-core.
Maintainers
Readme
hp24-idemkit-fastify
Fastify plugin adding Idempotency-Key support to your routes. Part of idemkit.
npm install hp24-idemkit-fastify hp24-idemkit-coreUsage
import Fastify from 'fastify';
import { MemoryStore } from 'hp24-idemkit-core';
import idempotency from 'hp24-idemkit-fastify';
const app = Fastify();
await app.register(idempotency, { store: new MemoryStore() });
app.post('/charges', async () => ({ id: 'ch_123' }));Implemented with a preHandler hook (short-circuits replays, conflicts, and mismatches) and an onSend hook (captures and persists the first successful response). Same semantics and options as the Express adapter: replay, 422 mismatch, 409/wait on duplicates, 5xx not cached.
For multi-instance deployments use RedisStore from hp24-idemkit-redis.
