
Your registration endpoint shouldn’t leave orphaned users in the database when the welcome email fails to send. The problem: user creation lives in PostgreSQL. Email sending lives in an external service. You can’t wrap both in a single database transaction. The fix: if the email fails, delete the user and their invitation. This is the SAGA pattern. When a multi-system operation fails partway through, you compensate by undoing the completed steps. Built this today in Go with Resend for email delivery and PostgreSQL transactions for the rollback.





















