Hacker Noon
Implementing Transactional API Idempotency With Node.js and PostgreSQL | HackerNoon
With idempotency keys in Redis, a crash can still charge twice. Keep the key in the same Postgres transaction as the write (Node.js) so a crash rolls back both.