OhBirdie!
SaaS for running American Mahjong events in the US and Canada, with public event pages, organizer and player areas, registration and waitlists, QR check-in, live tournaments, Stripe payments and messaging. The hard parts were two roles on one account, payments and live tournament rounds.
- Year
- 2026
- Built for a client
- My part
- Lead developer
- Website
- ohbirdie.com
My role
Led 1 other developer and built about half of the application: the whole back end, the DevOps, the event lifecycle, player and public UI, most of the tests and documentation. Set the architecture, planned the tasks and reviewed the code. The API has 220+ type-safe oRPC procedures on 30+ Prisma models, covered by 450+ test files and 3,000+ test cases, and serves more than 24,000 API calls a month in production.
Capabilities
Events
- Four-step wizard with autosaved drafts, duplicate, cancel and restore, for public, private and recurring events
- A publish check that holds paid events until Stripe Connect is set up
- Drag-and-drop seating plan with skill balancing, table and East-seat locks and three-player tables
Registration and check-in
- Single tickets, several tickets or a whole table, a waitlist with 24-hour offers and invitations with free seats
- QR check-in with a short code fallback, and a live view of each player's table and seat
Tournaments
- Rounds with per-table scores, configurable tiebreaks, live standings and results
- Open play and lessons
Payments
- Stripe plans, subscriptions and Connect onboarding and payouts for organizers
- Refunds that return the ticket price and keep the service fee
Messaging
Accounts and admin
- Organizer and player roles on one account
- Player database with CSV import and export, PDF rosters, plus an admin area with KPIs, moderation and an audit log
Patterns and decisions
- A user holds a list of roles and one active role, so a player becomes an organizer without a second account. A short step-by-step flow walks the player through the change, and a guard enforces the step order.
- Permissions live in two layers. oRPC middleware checks roles for the app. PostgreSQL row-level security covers direct Supabase access, such as Storage and Realtime.
- The Stripe webhook checks the signature against two secrets, one for the platform and one for Connect accounts. Each event id is claimed once, the route answers 200 at once and does the work after the response. Cron sweepers redrive stuck events.
- Five Cron jobs on Vercel run in offset groups, because one handler doing everything starved the connection pool. Vercel Cron sends GET and the procedures accept POST only, so each cron route calls the procedure directly.
- The round timer does not broadcast every second. The server announces only state changes, such as start, pause and end, together with its own clock. Each phone ticks locally and corrects its drift against that clock.
- Canada needed a country field on the organization, since Stripe fixes an account's country at creation. The sign-up wizard validates the state or province against it, address search covers both countries, and the privacy page has a Canada section.
- The integration suite runs against a real PostgreSQL database with the row-level security policies applied, so a policy mistake fails a test and not a customer.
Cases
The last seat. Two buyers can go for the last seat at the same moment, and a waitlist claim can race a fresh purchase. Registration and waitlist claims both take an advisory lock per event inside the transaction that checks capacity and writes, so the seat count cannot be oversold. A waitlist offer lasts 24 hours at the price the person signed up for, and a cron job expires the ones that are not taken.
A refund that fires once. Tickets are charged directly on the organizer's Stripe account, and a refund returns the ticket price but keeps the service fee. A double click or a retry must not refund twice. The refund is claimed as requested in the database before Stripe is called, and the claim is rolled back if Stripe rejects it. The webhook is the only writer of the final state, and it also cancels the registration and offers the seat to the waitlist. The organizer's refund button and the sweeper that cancels a whole event share one function.
Live updates after a rollback. A live screen must not hear about a write that was rolled back, and a dropped connection must not strand a phone in the middle of a tournament. Broadcasts go out through database wrappers that take the transaction, so a failed write sends nothing. They use a private channel gated by row-level security. The client reconnects with backoff, and a safety poll every 15 seconds runs only while the event is live. Standings are recomputed on the server and refetched when a broadcast arrives.
RLS without recursion. The row-level security policies for events and registrations referenced each other and recursed. The checks moved into security-definer helpers in a separate schema, which break the cycle. On the organization table, table-wide read access is revoked and replaced by an allowlist of columns, so billing and plan data never reach a logged-in client.