A community app for Korean seniors and Korean senior models (verified adults, 19+). Members share stories about health, hobbies and daily life, follow senior models, see their profiles, photos and videos, and watch their live broadcasts.
A friend and I built it as a team of two for a client, a Korean business owner in Apgujeong, Gangnam. My teammate built the React Native app; I built the backend that every screen talks to: 49 tables with row-level security on every one, 118 SQL functions, 32 triggers and 8 edge functions. The project is now growing into a startup.
Two people, dozens of screens: access rules had to live in one place. 112 policies on 49 tables decide what each user can read and write, so a bug in the app can't open someone else's data.
Rules as database triggers
Chat checks (membership, blocks, suspension, rate limits) run in triggers before a message is saved. The app can't skip them, and every client gets the same rules.
Edge Functions for anything secret
Identity-check keys, Agora token signing and the payment webhook run in 8 server-side Deno functions. The phone never holds a key it could leak.
Deep dive
An identity check that never trusts the phone
The app is for adults only, so every member passes a real carrier identity check. It had to prove the member is 19+, work inside the phone's browser, and keep as little personal data as possible.
Identity check, start to finish
01Birthdatetyped in the app
02Startrate-limited, key kept on the server
03Carrier checkon NHN KCP's page
04Callbackresult fetched and decrypted server-to-server
05Completesingle use: sign up or sign in
Paid access
01Store purchase
02RevenueCat
03Webhookshared secret, constant-time check
04Ledgerrenewals, refunds, yearly plans
05Server checkon every paid action
Guard rails
The browser never learns the result: the callback sends the same redirect whether the check passed or failed.
Single use: a session goes pending → verified → consumed in one atomic update, so a replayed request is refused.
Age is checked on the server: the carrier's birthdate must match what the member typed, and anyone under 19 is refused.
Minimal data: the unique person ID is stored only as an HMAC; name, phone number and gender are thrown away.
Screens
01 / 02
Home
Models
Certified models
Live
Community & associations
Member posts
Troubleshooting
01
Signing in on one phone logged out the other
Problem
A member who signed in on a second phone was suddenly logged out on the first one.
Cause
Sign-in reset the account's password behind the scenes, and a password change ends every open session.
Fix
Sign in with a one-time link and code (generateLink + verifyOtp) instead. It opens a new session and leaves the others alone.
Result
Members stay signed in on every device they use.
02
Crash when leaving Home
Problem
Navigating from Home to another realtime screen crashed the app.
Cause
supabase.channel() returns the same instance per topic, so a second subscribe on an already-joined channel threw.
Fix
A shared realtime layer with reference counting: one channel per topic, reused by every screen and removed when the last subscriber unmounts.
Result
No realtime crashes; screens mount and unmount in any order.
What worked and what I learned
Choices that paid off
Payments are a ledger: renewals, refunds and yearly plans are all recorded, and model payouts follow each member's monthly pick.
A push outbox: each notice is claimed once, so a push can't be sent twice or faked.
Private by default: other users can read only listed profile columns, and photo links must point to the owner's own storage folder.
Admins can switch on a free mode for everyone without a new app release.
What I learned
Rules the app must not skip belong in the database, not in the screens.
Never let the client decide: age, payments and access are all checked on the server.
When something odd happens, read how the library works inside: both hardest bugs came from how Supabase reuses channels and sessions.