DEV Community

Arppith Andrews
Arppith Andrews

Posted on

I built a live SMM panel on Cloudflare's free tier — Workers, D1, and a wallet that can't double-spend

I built a live SMM panel on Cloudflare's free tier

I'm a 2nd-year BTech CSE student, and I wanted to learn the parts of web development that tutorials skip: real money, real orders, and what happens when a provider API says one thing and your database says another.

So I built Ampliva — a live social media services storefront — and shipped it. Not a demo, not a localhost screenshot. Real users, real wallet balances, real orders going to a real upstream provider.

This post is about the engineering, because that's the part worth sharing. The interesting problems had nothing to do with the catalogue and everything to do with payments, state, and auth.

Live links, if you want to poke at it first:

  • Storefront: https://ampliva-store.pages.dev
  • There's a free Instagram Profile Lookup tool on the site (no login) if you just want to try something quickly

The stack was chosen by a budget of zero

Every choice below exists because the free tier forced it, and most of them turned out better than the paid default I would have picked.

Layer Choice Why
Frontend React 19 + Vite on Cloudflare Pages Fast builds, free hosting, deploys on push
API Cloudflare Worker + Hono No server to keep alive, runs at the edge
Database Cloudflare D1 SQLite at the edge, generous free tier, no separate DB bill
Auth (new) Firebase Auth (Spark, $0) Email verification and Google sign-in without building either
Approvals Discord, with real buttons My admin panel is where I already live
Payments Manual UPI for now See the Razorpay section — this is deliberate, not lazy

The catalogue syncs from the upstream provider (CID Growth Media) into D1 — 316 services at last sync — and orders are placed provider-first, so I never take a user's money for an order the provider has already rejected.

Money is a ledger, not a number

This is the lesson I'd tattoo on every side-project that touches payments:

Never store a balance as a single number you increment and decrement.

Ampliva's wallet is an append-only ledger. Every credit, every debit, every refund is a new row that explains itself — what it was for, which order it belongs to, when it happened. The balance is derived from that history.

That one decision killed an entire class of bugs before they could happen:

  • A cancelled order refunds automatically, and the refund is a ledger entry you can point to, not a mysterious balance change.
  • If an order flow crashes halfway, the ledger shows exactly where it stopped. No guessing, no "the balance looks wrong."
  • When a friend who was testing the store asked where ₹3.40 had gone, I didn't debug anything. I just read the ledger back to him. (It was a cancelled order, refunded correctly.)

If you're building anything with a wallet, credits, or in-app currency: build the ledger first. The balance column is a cache, not the truth.

Ordering follows the same paranoia: provider first, then charge. The order goes to the upstream provider, and only a confirmed provider order touches the wallet. A provider rejection costs the user nothing.

No payment gateway? Discord buttons are the admin panel

I don't have Razorpay live yet — it needs a PAN reprint, then video KYC, then live keys. That's parked, on purpose, until the paperwork clears.

So top-ups are manual UPI:

  1. The user pays by UPI and submits their UTR (the transaction reference).
  2. I get a ping in a Discord channel — with Approve / Reject buttons, not just a notification.
  3. One tap credits the wallet, as a ledger entry, obviously.

The buttons were the fun part. A plain Discord webhook can't do buttons that actually work — a webhook has no application behind it, so Discord has nowhere to send the click. Working buttons need a bot/app-owned message and an interactions endpoint that verifies Discord's Ed25519 signature on every click. Once that was in place, approvals became: phone buzzes, tap Approve, wallet credited. Owner-only, signature-verified, no dashboard login needed.

Is manual UPI scalable? No. Is it the right call at zero revenue with a gateway blocked on paperwork? Absolutely. Ship the human-in-the-loop version, automate later.

A 15-minute sweep keeps order statuses honest

Provider order statuses drift. An order that's "processing" in my database might have completed, partially delivered, or been cancelled upstream an hour ago.

Instead of webhooks I may or may not get, Ampliva runs a sweep every 15 minutes:

  • Poll open orders, capped at 50 per run so a backlog can't turn into an API hammering incident.
  • Terminal states are explicit: Completed, Canceled, Partial, Refunded. Once an order reaches one, it never moves again.
  • A daily watch also flags two things I actually care about: provider balance dropping below ₹500, and any order stuck open for more than 24 hours.

It's boring infrastructure. It's also the difference between users trusting your statuses and users screenshotting them to argue with you.

Auth: the token you get at signup is lying to you

This is the bug I most want to save someone else from.

I added Firebase Auth alongside the existing local accounts — hybrid, no forced migration. New users sign up with email/password in Firebase, click a verification link, then hit an "I've verified — continue" button on my site. My Worker verifies the Firebase token server-side (signature, project, and the email_verified flag) before creating a session.

First live test: the user verified, clicked continue, and got rejected. Verified flag: false.

The problem wasn't Firebase. It was token freshness. The ID token issued at signup is minted before verification happens, and it keeps saying email_verified: false even after the user clicks the link. The fix is to force a fresh token after verification — only the refreshed token carries the updated claim. My server was doing everything right; it was faithfully reading a stale token.

Once that clicked, the whole flow passed end-to-end on the first try.

Then I closed the old door properly

With verified signup working, I tightened registration:

  • Direct local signup now returns 403 with a message pointing to the real routes. It creates nothing.
  • Google sign-in counts as verified — Google has already done that work.
  • Existing users are grandfathered. The login route didn't change by a single line. Wallets, orders, and sessions are untouched. Nobody wakes up locked out because I improved signup security.

That last point matters. "Tighten auth" is easy to say and easy to do cruelly. If your change punishes the users who trusted you early, you did it wrong.

Two smaller auth lessons, free of charge:

  • Verification mail from a new sender lands in spam. It just does. Put "check spam" on the pending screen, next to the waiting message, not in a FAQ nobody reads.
  • Old cached clients will hit your new endpoints. A user on a stale page bundle submitting to the now-closed signup route gets a clear 403 message explaining where to go — not a crash, not a silent failure. Design your rejections like you design your errors: for a confused human.

What I deliberately haven't built yet

Build-in-public should include the "not done" list, so here's mine, honestly:

  • Razorpay — parked until PAN → video KYC → live keys. Manual UPI until then.
  • Referral payouts — when they arrive, bonuses will only pay to verified accounts. Grandfathered users can link Google or verified email to qualify; nobody gets locked out of the store itself over it.
  • Catalogue curation — a synced catalogue of 316 services includes some junk I wouldn't sell to anyone. Hiding those before driving real traffic is on me, and it's next.
  • One auth combination is still untested end-to-end — an existing local user signing in via the new verified-email mode. Both halves are proven separately on the same endpoint (token acquisition, and link-by-email), but I haven't watched the full path, because doing so would mean triggering password resets on real accounts that aren't mine to poke. I'd rather disclose that than quietly claim 100% coverage.

What I'd tell myself before starting

  1. The ledger is the product. Everything else is UI over an honest record of money.
  2. Free tiers are an architecture. Cloudflare + Firebase Spark didn't just save money, they removed servers, SMTP, and a verification system from my maintenance list.
  3. Verify claims on fresh tokens, verify statuses with a sweep, verify deploys on the live bundle. The theme of this whole build is that cached, stale, and assumed states are where bugs live.
  4. Grandfather your early users. Security changes should close doors behind new signups, not in the faces of existing accounts.

Ampliva is live at ampliva-store.pages.dev — the free Profile Lookup tool needs no account if you want to try the least payment-shaped part of it.

I'm genuinely curious how others have handled two things: wallet/ledger design in small projects, and verification flows where the mail reliably lands in spam. What worked for you?

I'll keep building in public as the catalogue cleanup and referral work land. If you spot something broken on the site, that's useful too — early users breaking things politely has been half my QA.

— Arppith (Shadow), 2nd-year BTech CSE

Top comments (0)