The situation
YellowBall is a live product: players find clubs and coaches, book courts, join challenges, chat, and pay through dLocal. The web app and the React Native app share one Supabase/Postgres backend, and every row belongs to a club, a player, or both.
It worked. That was the problem. The app looked correct in every role we tested by hand — until users started reporting things that made no sense: the feed loaded for some players and came back empty for others; player search returned zero results for accounts that existed; a booking occasionally lost a slot to another user at the same moment.
None of these looked like security bugs. They looked like UI bugs, or flaky queries, or caching.
What was actually happening
RLS denials were being swallowed
The rows were protected by Postgres row-level security. When a policy denied a read, Supabase returned an error (42501), the client treated it as “no data”, and the UI rendered an empty state. No error boundary, no toast, no log the user could see.
So the app was simultaneously leaking nothing in the cases we noticed, and silently failing in the cases we didn’t. The fix was not “add a policy”. It was to trace which query hit which policy, decide whether the policy or the query was wrong, and make the failure visible in development and test.
Booking was a race, not a transaction
Court booking checked availability, then inserted the booking. Two users tapping at the same time both passed the check and both inserted. The database had no constraint that made a double booking impossible.
The fix moved the decision into the database and the server function: slot acceptance becomes an atomic operation that returns 409 when the slot is taken, the client reverts its optimistic UI, and the same rule covers challenge acceptance.
That is the difference between “we check” and “it cannot happen”: the invariant lives where the data lives.
What else was hardened
- Push delivery moved to a versioned cron worker that reads its URL and secret from Vault, so rotating credentials does not require a redeploy.
- Secrets kept out of the client bundle; service-role keys never shipped to the app.
- Release path: Expo/EAS build, Play internal track, version codes verified through the Play Developer API before promotion.
- Regression coverage on the paths that had broken: feed, search, booking, challenge acceptance.
The result
- The feed and player search return correct data for every role, and a denied read is a visible, testable failure instead of an empty screen.
- Double booking is structurally impossible rather than unlikely.
- Push credentials rotate without a release.
- The team has a release checklist and a test path for the exact bugs that used to reach production.
What this means for your product
If your app was built quickly — by an agency, by an AI tool, or by a founder under launch pressure — the symptoms are usually the same:
- Silent failures. A denied query looks like an empty state, so nobody notices until a customer does.
- Client-side authorization. The button is hidden, but the API route only checks that you are logged in.
- Invariants that live in code. “We check before we insert” is not a constraint; it is a hope.
- No rollback or release discipline. Every deploy is a small adventure.
An audit finds these in days, not months. The fix is usually smaller than the fear: a handful of policies, a server-side check, a constraint, and a test that proves it stays fixed.
Stack: Next.js, TypeScript, React Native (Expo), Supabase/Postgres, RLS, dLocal Go, Vercel, EAS, Play Console. Role: founder and full-stack engineer, 2024–present.
Send me the shape of it.
Stack, team size, what hurts. I'll tell you honestly whether I'm the right fit and what I'd do first.