Description
A centralized webhook router I built to provision users automatically across several Supabase instances after a Stripe payment. It connects payment events to user onboarding when more than one database is involved.
Features
- Central Stripe webhook router that dispatches by event type
- Automatic user provisioning across multiple Supabase projects
- Webhook signature verification and replay protection
- Audit logging for every provisioning event, with recovery on failure
Challenges
- Sending each webhook event to the right Supabase instance based on product metadata
- Creating users atomically across several databases, with rollback when one fails
- Handling Stripe's webhook retries without creating duplicate users
Learnings
- How to coordinate writes across multiple databases in a distributed SaaS setup
- Practical ways to process Stripe webhook events at scale
- Using idempotency keys so webhook-driven provisioning runs once