Side storyCreator-fan platform, freelance
Bloopop
The backend of a live creator platform where fans pay per message and creators cash out through Stripe Connect. I led it for 14 months, and I still keep it running.
Freelance for Dalbit LLC, as backend lead next to a frontend developer. Database, payments, realtime, notifications, moderation, CI and production releases were mine.
起 (Opening)01 / The problem
Fans pay real money per message. Every retry is a money question.
Bloopop is a live creator-fan platform. Fans buy credits, spend them to message and tip creators, and creators withdraw real earnings. When the product is paid conversation, a duplicated request isn't a glitch. It's a double charge.

承 (Development)02 / What I built
The backend of a live, paid messaging platform.
My first commit was the database schema and its security policies. From there I owned the money functions, Stripe, realtime, notifications, moderation, CI and every production release. AI coding agents wrote much of the code under my direction. The decisions and the verification were mine.
転 (Turn)03 / The hard part
2 charges
on a saved card, for one message
A money bug in code I owned, caught and refunded.
A second auto top-up check ran after the send with an out-of-date balance, so some saved cards were charged twice. I made it run once per request by design and keyed the charge on stored state. The fans it hit were refunded.
結 (Outcome)04 / The result
82
migrations, shipped to production in one ordered release. I ran every production step myself.
- Messaging read
- 6 trips to 1 RPC
- Unkeyed Stripe money calls
- 0
- Status
- Live, retainer
By the numbers
- 6 → 1database round trips for a messaging read, now one RPC with keyset pagination
- < 7 msp95 for those RPCs in a local benchmark (4 vCPU, about 80k messages), database time only
- 82migrations in one ordered production release, with a written deploy plan
- 1transaction per paid message: debit, credit, platform share and the message itself
- 14 moof active build, Aug 2025 to Oct 2026, then a maintenance retainer
No user, creator, revenue or pricing numbers here. Those are the client's.
From the client
Public review, OnlineJobs.phKevin has been great to work with. He's reliable, easy to communicate with, and always willing to help troubleshoot when something comes up. …
One thing I really appreciate is that he doesn't just complete whatever task is given to him! He also comes up with his own ideas, strategies, and suggestions for how we can improve the project. He's proactive, thinks ahead, and has been a really important part of our development team. …
I can trust him to get things done and keep me updated along the way.
How it works
Postgres is the application. The browser and the API talk to the database through the user's own session or a server route that checks permissions first, row-level security decides what each row shows, and anything that moves money is one database function that either finishes completely or not at all.
- Built by me
- Platform, team or vendor
01THE DATABASE
Postgres is the application.
Bloopop started from an empty repo in August 2025. My first commit, the same day as the frontend scaffold, was the whole database schema with its row-level security policies. So the data model was the design from day one, and there was nothing to inherit.
Two rules held the whole way. Row-level security is the authorization boundary, and money only moves through database functions that run in one transaction. Creator identity is its own record, not a role flag, because a flag drifts.
Messaging reads used to take up to six round trips, with cursor filtering done in memory. I collapsed them into single RPCs with keyset pagination on (created_at, id), covering indexes, and ETags, so a poll that finds nothing new gets a 304. In a local benchmark (4 vCPU, about 1,200 conversations and 80,000 messages) the conversation list and message page stayed under 7 ms at p95. That is the database function alone, not the full request.
難所 (Hard part)The hard part
Postgres checks privileges on every table and column a policy mentions, even on a branch of the policy that never runs for you. Tightening access in one place could quietly break a read somewhere else. So every access change gets tested as a real signed-in fan over the API, asserting both what should work and what should be denied, never as an admin.
02THE MONEY
Paid messages, one transaction.
Fans buy credits through Stripe Checkout or with one tap on a saved card, spend them per message and on tips, and creators withdraw earnings to their bank through Stripe Connect. Subscriptions charge from the same wallet.
Sending a paid message is one database function and one transaction: check the conversation, debit the fan, credit the creator, record the platform's share, insert the message. An append-only ledger is the source of truth, so every balance change has a row that explains it. A purchase can only be credited once, and a webhook that arrives twice lands on functions that refuse the duplicate.
CAUGHT AND FIXED
- Double card charge on auto top-up. A second top-up check ran after the send with an out-of-date balance. I deleted it, so there is one check per request by construction, keyed the Stripe charge on the last settled purchase instead of the clock, and sent charge and credit through the same atomic purchase path. The fans it hit were refunded.
- Unkeyed Stripe payouts. Transfers and payouts went out with no idempotency key, so a double click or a retried request could pay a creator twice. Each one is now keyed on its withdrawal request, with the same key on every path that can trigger it.
- A guard test walks the codebase for every Stripe call that moves money and fails if one has no key. Its first run found one I had missed.
難所 (Hard part)The hard part
Why not a timestamp in the key? Time buckets split at the boundary and drift between servers, and the existing idempotency column couldn't be trusted. A key built from stored state replays exactly on a retry and moves forward on success or a definite failure, so a fan who fixes a declined card isn't stuck on the old answer.
03REALTIME
Messages that arrive, pushes that don't nag.
Chat runs on Supabase Realtime: typing and presence over private channels, and message delivery over a private broadcast topic per conversation. A database trigger builds each payload, so it carries only what the reader is allowed to see instead of streaming raw row changes.
That switch went out behind a flag with three states (off, shadow, on). In shadow mode both paths ran side by side on staging and I compared them before cutting over.
Notifications go through a queue with push and email workers. Preferences are checked again at send time, and a push is skipped when you already have that conversation open (a presence heartbeat in the last 45 seconds). Installed iPhone web apps got their own small service worker after the generic one got stuck installing.
難所 (Hard part)The hard part
Scheduled jobs fail quietly. A database scheduler can log success while every HTTP call it makes is being rejected. So the push pipeline has a watchdog that runs outside it, on a different credential path, and alerts when jobs sit pending too long.
04MODERATION
AI moderation that fails closed.
Every uploaded image and every message goes through AI moderation with three outcomes: approve, send to a human, or block. Text in the gray zone goes to a small language model classifier with a short timeout, and results are cached so the same message isn't scored twice.
New moderation logic ran in shadow mode first, logging only where it disagreed with the live version, and a replay script ran past decisions through the new rules before anything switched.
iPhone photos get converted before scanning, animated GIFs are checked frame by frame, and an image is only approved when every frame was actually scanned.
難所 (Hard part)The hard part
Fail closed has a price. If the scanner can't reach its provider, photos wait for a human instead of slipping through, so an outside outage turns into a queue. That's the right trade for this product, and it's why there is an admin alert when scanning fails across the board.
05TEAM ACCOUNTS
Acting for a creator, without their keys.
The largest single feature: creators invite team members who sign in with their own accounts and act on the creator's behalf, with only the permissions they were given. Some things stay owner-only no matter what, like payout settings and account control. Revoking, pausing or expiring a team member takes effect immediately.
Every action records two people: who did it and who it was done for. Fan-facing views show the creator. HTTP routes resolve the creator on the server through one chokepoint, and a deny-by-default registry lists every API route as owner-only or behind a named permission. A test fails if a new route isn't in it.
難所 (Hard part)The hard part
Row-level security can't restrict single columns, so simply widening the policies would have let a team member write fields like payout details. Routing team actions through the server-side chokepoint kept the database policies narrow.
06SHIPPING
Staging first. Production by hand.
Two environments, two databases. The staging branch deploys to staging, and a pull request into main ships to production. I applied every production migration myself. AI agents were allowed read-only checks on production and nothing else.
Team accounts lived on staging until they shipped in October 2026 as one release of 82 migrations. Several of them revoked access the old code still used, so the deploy plan was ordered: set the build flags first, build without promoting, apply the migrations, promote right away, deploy the functions, smoke test. Code rolls back by promoting the previous build. The database only rolls forward, with fix migrations.
CI started running tests in February 2026. When it drifted red, I repaired it: a build job, because type errors were being hidden, previously ungated test files pulled into the run, and backoff for auth rate limits. Security tests sign in as a real fan, assert that exploits are denied, and refuse to run against production.
難所 (Hard part)The hard part
A schema change that removes access while old code is still serving has no clean rollback. The answer was a short overlap (about a minute between the new schema and the new code) and a forward-only plan, written down in the pull request before the deploy started.
07LOOKING BACK
What I'd do from day one.
Bloopop is where I learned to own production. It's also where I learned to be plain about how it was built: AI coding agents wrote much of the implementation. I made the decisions, set the constraints, reviewed the diffs and verified the result myself, on staging and then on production.
NEXT TIME
- Idempotency keys required on every payment call from the first commit. The top-up key was optional, which is how a charge shipped without one.
- Lock down default database privileges on day one, and test every grant as a real user.
- Watch the things that fail silently: scheduled HTTP calls, background queues, anything whose only symptom is nothing happening.
- Smaller releases behind flags, even if that means carrying half-applied schema for a while.
Since October 2026 I'm on a maintenance retainer: small production fixes, still released by hand.
How I work
I orchestrate AI coding agents.
On Bloopop I was the gatekeeper. A planning session held the spec and wrote the handoff for each phase. Implementation sessions went spec, test-first plan, build, then review per task. Agents never pushed, never wrote to production and never applied migrations to a shared database.
Same four steps every time: spec first, agents in lanes, verify independently, I make the calls. Read them in full in chapter one.
実例 (Real examples)On this project
- Every guard was broken on purpose first, to confirm a named test fails, and only then shipped.
- Security fixes were proven by signing in as a real fan over the API and asserting the exploit is denied, before and after.
- For the top-up fix, agent-proposed designs were reviewed and turned down. I shipped the minimal one.
- Client rulings (refund policy, what team members may do) go into the code with a note, so nobody "fixes" them later.
What it's built on
01 / APP
画面 (Screen)- Next.js
- React
- TypeScript
- Vercel
02 / DATABASE
土台 (Foundation)- PostgreSQL
- Supabase
- Row-level security
- Supabase Realtime
- Edge Functions (Deno)
03 / MONEY
勘定 (Accounts)- Stripe Checkout
- Stripe Connect
- Idempotency keys
04 / SERVICES
接続 (Connection)- Resend
- Redis
- Web Push (PWA)
- AI moderation (images and text)
05 / QUALITY
検証 (Verification)- Vitest
- GitHub Actions
- Sentry