Rescuing a half-built app with AI-generated code that moves real money: 10,000 users and $40K staked
An agency had left this social challenge app half-built, with code generated by AI tools. It had security, login, and payment problems, it was buggy and slow, and it couldn't scale. The product moves real money: users stake on a challenge to an X account, others add to the pot, and the target gets paid out. I reviewed the code, kept what was solid, rewrote the rest, and launched it in eight weeks. It's live with 10,000 users, 3,000+ challenges, and $40K staked.
An agency had left the app half-built, with AI-generated code that had security, login, and payment problems, bugs, and slowness, and couldn't scale. And the product moves real money.
What I built
Reviewed the agency's code, kept the solid parts, rewrote the rest, and finished the product: public feed, challenge composer, X account lookup, PayPal-funded wallets, crowd funding, accept and respond flows, payouts, and realtime updates on Convex.
The result
Launched 8 weeks after takeover. Live with 10,000 users, 3,000+ challenges created, and $40K staked.
Timeline
8 weeks
Budget
$16,000
What I found in the half-built, AI-generated code
An agency had started the product with code generated by AI tools, and left it half-built. Some parts worked, but security, login, and payments all had problems, it was buggy and slow, and the foundation wasn't built to scale.
A product that moves money can't be patched together, so I reviewed everything, kept the parts that were solid, and rewrote the rest.
The idea: online callouts with real money behind them
People challenge each other on X all the time, and nothing happens. This startup's idea was to add real stakes: put money behind a challenge, let others add to it, and pay the target if they take it on.
The hard part isn't the post. It's everything after it: money moving between wallets, several people contributing, a response, and a payout, all without a balance ever going wrong.
Making wallets and payouts safe before launch
Users fund a wallet through PayPal, then stake or contribute from that balance. The backend is the single source of truth for every balance, and every money movement goes through it, so stakes, crowd contributions, and payouts stay consistent even when several people act on the same challenge at once.
Payments were one of the first version's problems, so the money layer was one of the parts I rewrote.
Explicit challenge states so money can't be paid twice
Every challenge moves through clear states, from published to funded, accepted, responded, and paid out. Each state decides what the app shows and which actions are allowed, and the flow is designed so a challenge can't be paid out early, paid twice, or left stuck halfway.
01
Pick an X account
Search it inside the composer; profile details load automatically.
02
Write it and stake
Money comes from the user's wallet, funded through PayPal.
03
Publish
The challenge goes live on the public feed.
04
The crowd adds to the pot
Others contribute money and messages.
05
The target responds
They accept or decline, then submit a response.
06
Payout
The pot moves to the target's wallet.
Built on real X identities
Users search for an X account right inside the composer. The app pulls in the username, avatar, verification status, and follower count through the X API, so every challenge is tied to a real, recognisable account.
Realtime updates and a composer that guides you step by step
Convex keeps the app in sync without polling: when someone adds to a pot or a target responds, everyone watching sees it instantly.
The composer walks users through signing in, writing the challenge, picking the target, setting the stake, and topping up their wallet if needed. The main button always shows the next step, so a complex flow still feels simple.
Auth webhooks that keep accounts and wallets in sync
Sign-ups and profile changes come from Clerk through Svix-delivered webhooks, so user accounts and wallets never drift apart.
Results
10,000
users
3,000+
challenges created
$40K
staked through challenges
8 weeks
to build and launch
Key decisions
01
Review first, then keep or rewrite
Half-built code is a mix of parts that work and parts that won't hold up. Reviewing everything before changing anything showed what was safe to keep.
02
One source of truth for balances
With stakes, contributions, and payouts happening at once, balances must come from one place on the server, never from the screen.
03
Explicit states for every challenge
Money depends on where a challenge is. Clear states make it impossible to pay out early or twice.
Trade-off: Every transition has to be designed and tested.
04
Webhooks to keep accounts in sync
Svix-delivered webhooks from Clerk keep user accounts and wallets consistent with sign-ups and profile changes.
What the client said
“Our agency left the app half-built. Milan picked it up, fixed what was there, and finished it: the feed, the X integration, wallets, PayPal, and payouts.”
Can you take over an app an agency left half-built?
Yes. I start with a review of the code, keep the parts that are solid, and rewrite the parts that won't hold up. Then I finish the product. This app was half-built by an agency, with AI-generated code, and went live eight weeks after I took it over.
How do you make wallet balances safe in a web app?
Keep every balance on the server as the single source of truth, record every deposit, stake, and payout as its own entry, and never trust a balance sent from the browser. Use a payment provider like PayPal or Stripe for deposits, and confirm each payment before crediting the wallet.
How long does it take to finish a half-built app?
It depends on how much of the existing code can stay. This one took eight weeks from takeover to launch, including the review, the rewrite, and finishing the product.