← things I ship
OPEN SOURCECreator · open sourceLIVE · OPEN SOURCE

Paywright.

A standalone microservice that owns the Stripe integration: customers, plans, payments, subscriptions, invoices and webhooks. Scaffolded with one command.

TECH USED
NestJSTypeScriptPostgreSQLBullMQStripeOpenAPI
Paywright quick start page with the npx scaffold command and the configure-environment step
01Quick startScaffold with one command, then configure the environment
Paywright one-time payments guide with curl requests for customers and payment intents
02Payments guideCreate a customer and a payment intent with curl
Paywright architecture page with the CQRS overview and the timeout, circuit breaker and retry table
03ArchitectureTimeout, breaker and retry policy behind a single StripeService
Paywright webhooks guide with the handled events table and the five-step delivery process
04WebhooksHandled events and how delivery is processed
Paywright API reference listing REST operations for health and customers
05API referenceOperations generated from the same OpenAPI spec as the SDK
01 / 05scroll →swipe →
demo
Space or K play and pause, M mute, F fullscreen, arrow keys seek 5 seconds
0:00 / 0:00
the full path

From problem to what's next.

In the order it actually happened. Use the route to jump around.

01THE PROBLEM

Every app that takes payments rebuilds the same Stripe plumbing, and idempotency, webhooks and retries are where it breaks.

02THE SOLUTION

Paywright is a standalone payment microservice that owns everything Stripe-related. Apps in any language call it over REST and store only the IDs it returns. One command scaffolds the service; you own the code and deploy it.

WHAT I BUILT
  1. 01Designed NestJS REST APIs for customers, plans, payments, subscriptions and invoices, with API-key auth, rate limiting and idempotency keys.
  2. 02Built the webhook pipeline: signature check, race-free dedupe, a BullMQ queue and background workers with exponential retries.
  3. 03Wrapped every Stripe call in one timeout, retry and circuit breaker policy that reacts only to transient errors.
  4. 04Published two npm packages: the create-paywright-app scaffolder and an OpenAPI-generated TypeScript SDK, plus a docs site.
03HOW IT'S BUILT

The system, end to end.

REQUEST PATH
  1. STEP 01Your appany language · stores IDs only
  2. STEP 02@paywright/sdktyped client from OpenAPI
  3. STEP 03Paywright serviceCQRS modules · API-key guard · rate limit
  4. STEP 04Stripe APItimeout · retry · circuit breaker
EVENT PATH
  1. STEP 01Stripe webhookssigned events in
  2. STEP 02Intakeverify · ON CONFLICT dedupe · return 200
  3. STEP 03BullMQ queueevent ID as job ID · Redis
  4. STEP 04Worker5 attempts · exponential backoff
  5. STEP 05PostgreSQLpayment status synced
01One-command scaffoldnpx create-paywright-app generates a NestJS service you own and deploy. The CLI copies .env.example and installs dependencies.
02Webhook safetySignature checked on the raw body, then INSERT ... ON CONFLICT DO NOTHING dedupes concurrent deliveries. The event ID is also the queue job ID.
03Resilient Stripe callsOne StripeService wraps every call: 10 s timeout, up to 3 attempts with backoff, and a breaker that opens after 5 consecutive transient failures.
04Typed SDK@paywright/sdk is generated from the service's OpenAPI spec, which exports without Postgres or Redis, so the client cannot drift from the API.
04WHAT BROKE,
AND THE FIX

FIX →An atomic INSERT ... ON CONFLICT DO NOTHING lets one delivery win, and the event ID doubles as the BullMQ job ID.

FIX →State changes run as awaited CQRS commands. A failure fails the job and BullMQ retries it.

FIX →Every protected operation now declares x-api-key in the OpenAPI spec, and the SDK was re-released with the fix.

FIX →Payment and subscription creation pass idempotency keys to Stripe, so a retry returns the original record.
05WHERE IT IS NOW
  1. IDEA
  2. BUILDING
  3. LIVE

Docs are live and the source is public on GitHub. create-paywright-app and @paywright/sdk are both on npm. The test suite has 18 tests across 5 suites.

06NEXT STOPS

The road keeps going.

  1. STOP +1Official Python and Go SDKs
  2. STOP +2A one-click webhook replay endpoint for events parked in Redis