This service provides durable, idempotent Stripe webhook processing for production environments. It is designed to prevent dropped events, block duplicate downstream execution, and recover cleanly from transient failures.
- Stripe signature verification on every webhook request.
- Persistent event storage before downstream processing.
- Idempotency enforcement by unique Stripe
event.id. - Replay-safe processing with atomic event claiming.
- Exponential-backoff retries for transient failures.
- Operational visibility through structured logs and
/health.
- Node.js 20+
- Express
- Stripe SDK
- SQLite (
better-sqlite3) - Pino structured logging
- Vitest + Supertest
- GitHub Actions CI
- Docker + Docker Compose
- Install dependencies:
npm install- Create environment file:
cp .env.example .env- Start the service:
npm run dev- Verify health:
curl http://localhost:3000/health- Full test suite:
npm test - Unit tests:
npm run test:unit - Integration tests:
npm run test:integration - Lint:
npm run lint - Build:
npm run build
- Build and run:
docker compose up --build- Validate health endpoint:
curl http://localhost:3000/health- Start Stripe CLI forwarding:
stripe listen --forward-to localhost:3000/webhooks/stripe- Set
.envSTRIPE_WEBHOOK_SECRETfrom Stripe CLI output. - Trigger a test event:
stripe trigger payment_intent.succeededFailed events can be requeued and replayed:
npm run replay -- evt_123456789- Live demo and fallback walkthrough
- High-level architecture
- Mid-level implementation map
- Low-level behavior and state transitions
- Operations runbook
- Testing strategy
- Delivery notes and lessons learned
- Changelog
- GitHub project:
https://github.com/users/MSulSal/projects/4 - Milestone issues:
https://github.com/MSulSal/stripe-webhook-reliability-service/issues