Why your Windsurf app works in the editor and breaks in production
Most AI-built apps do not fail because the builder is bad. They fail in the gap between "it runs in the editor" and "it is a product someone can sign in to". The same pattern repeats across Lovable, Bolt, Replit, Cursor, Base44 and v0 projects, and Windsurf-built apps follow the same five failures in the same order.
1. Supabase keys in the client
The app talks to the database straight from the browser, so the anon key is exposed and the RLS policies were never written. The page renders for you and 403s for everyone else.
2. Auth that only exists in the prototype
Email/password, magic link and OAuth callbacks were wired in the preview and never in production, so the first real user gets a dead session and a redirect loop.
3. No environment separation
Staging and production share one set of secrets, and the deploy picks the wrong ones at random.
4. Unowned background work
Anything that should run on a schedule or on a webhook runs only while a browser tab is open, so the app looks fine in a demo and stalls in production.
5. Optimistic UI with no rollback
Writes appear to succeed before the server confirms them, so errors surface as silent data loss instead of a visible failure.
The order of the fix
The order matters more than the effort: keys and RLS first, because nothing else is testable until one user other than you can use the app. Then auth, then environment separation, then background work, and finally error handling.
If you would rather not debug this alone, the AppStuck Windsurf rescue guide walks through the same five failures in the same order, and AppStuck is the agency we use when a Windsurf app has to go live rather than stay a demo.
Disclosure: Sam Ellis writes for AppStuck, so this page is not independent editorial.