Vibe-coded apps problems
What reports say about the security of AI-built apps, and what to check on the backend: secrets, RLS, spend limits, connection pooling, indexes, queues, rollbacks.
"I didn't write a single line of code for @moltbook." That is how its founder described building the app. On January 31, 2026, Wiz researchers opened its database from a browser: 1.5 million API tokens, around 35,000 email addresses and 4,060 private conversations, readable and writable by anyone. No exploit was involved. The key they used was in the page source, where it is supposed to be. The table behind it had no access rules.
Andrej Karpathy coined vibe coding on February 2, 2025: "you fully give in to the vibes, embrace exponentials, and forget that the code even exists". The same post scoped it to throwaway weekend projects.
Since then, people who had never programmed have started shipping real products, with real sign-ups and real Stripe accounts.
Frontend forgives, backend does not
A vibe-coded frontend fails in public. The button is misaligned, the modal does not close, the layout breaks on a phone. You see it, your users see it, somebody complains, you paste the screenshot back into the chat and it gets fixed.
A backend fails in private. Nothing looks wrong while a stranger pages through your users table. The app feels fast with 12 rows in the database and one visitor, who is you. A missing access rule, a leaked key or an unbounded query has no visual symptom until it has a financial or a legal one.

A model will add row level security, a rate limiter or an index when asked. Someone who has never run a backend does not know those terms, so the request is never made.
What the data says
Model output. Veracode's 2025 GenAI Code Security Report tested over 100 LLMs and found that "45% of code samples failed security tests and introduced OWASP Top 10 security vulnerabilities". Java failed 72% of the time, and 86% of samples failed to defend against cross-site scripting. Caveat: these were completion tasks designed so that a vulnerable answer was possible. It does not mean 45% of all AI-written code is exploitable.
Deployed apps. Matt Palmer scanned 1,645 Lovable-built apps and found 170 of them (10.3%) exposing data through 303 endpoints with missing or broken access rules. It became CVE-2025-48757. Caveats: Palmer worked at Replit, a competitor, and only homepages were scanned, so the real count is likely higher.
A wider sample. Escape analyzed over 5,600 publicly available vibe-coded apps and reported more than 2,000 vulnerabilities, 400+ exposed secrets and 175 instances of exposed personal data. Caveats: Escape sells security scanning, and the dataset is heavily skewed toward Lovable.
Secrets. GitGuardian counted 28.65 million new hardcoded secrets in public GitHub commits in 2025, up 34% year over year. Commits co-authored by Claude Code leaked secrets at 3.2%, against a 1.5% baseline. Caveat: this is a correlation, and the report itself notes that a human still decides what gets pushed.
None of these show that AI writes worse code than a developer would. I have not found a controlled comparison. What the reports have in common is where the problems are: access rules, secrets and other server-side code.
Are your API keys and secrets actually secure?
There are two separate cases here.
A secret that reached the browser
Anything in your frontend bundle is public. Frameworks mark the boundary with a prefix or a config key, and a model asked to "make the error go away" can move a variable to the wrong side of it:
export default defineNuxtConfig({
runtimeConfig: {
stripeSecretKey: '', // NUXT_STRIPE_SECRET_KEY - stays on the server
public: {
supabaseKey: '', // NUXT_PUBLIC_SUPABASE_KEY - shipped to every visitor
},
},
})
NEXT_PUBLIC_ and VITE_ work the same way: a variable with that prefix is readable by every visitor. You can check what your app ships by searching the deployed JavaScript in DevTools for sk_, secret and service_role.
A public key with nothing behind it
This is what happened at Moltbook. Supabase gives you two kinds of keys: a publishable one (sb_publishable_..., formerly anon) that is designed to live in the browser, and a secret one (sb_secret_..., formerly service_role) that bypasses every access rule. The publishable key is safe only if row level security is on. Without RLS, that key gives read and write access to the table.
alter table public.messages enable row level security;
create policy "Users read their own messages"
on public.messages for select
to authenticated
using ((select auth.uid()) = user_id);
The request below is what an outsider can send, without logging in:
curl "https://<project>.supabase.co/rest/v1/messages?select=*" \
-H "apikey: <your publishable key>"
If it returns rows, the table is public.
service_role or sb_secret_ key, RLS does nothing.In March 2025 a founder posted that his SaaS was under attack, two days after writing that it was built with zero hand-written code: maxed-out API keys, people bypassing the subscription, junk written to the database. A subscription check that runs only in the browser can be skipped by anyone. It has to run on the server.
Billing and limits
On serverless platforms you pay per request, so a scraper, a bot or a random viral post shows up on the invoice.
In February 2024 a developer with a static site on Netlify's free tier received a $104,500 bill for about 190 TB of traffic over four days. It was waived after the story went viral. In June 2024 the artist platform Cara grew from 40,000 to 650,000 users in a week and got a $96,280 bill for function invocations. The first case was unwanted traffic, the second was real growth. Both were billed the same way.
A spend limit that pauses
Most billing limits work like a smoke detector: they notify you and stop nothing. A fuse is the other kind, it cuts the power.
| Platform | What the default does | Hard stop available? |
|---|---|---|
| Vercel (Pro) | notification at $200 | yes, opt-in: pause projects at a set amount |
| Supabase (Pro) | spend cap on, over-quota usage restricted | yes, but compute and add-ons are not covered |
| Google Cloud | budgets send alerts | no |
| Firebase | budgets send alerts | partly, in preview, not for Firestore, Storage or Auth |
From Vercel's docs: "Setting a budget does not stop usage on its own." Pausing has to be enabled separately. From Google Cloud's: "Setting an alerts-only budget doesn't automatically cap Google Cloud or Google Maps Platform usage or spending."
An app that calls an LLM API is billed by that provider as well. A monthly budget in its console and a per-user rate limit on the endpoint cover the "maxed-out API keys" case from the story above.
Attack protection at your host
Vercel includes DDoS mitigation on every plan and has a free Attack Mode that challenges visitors during an incident. Cloudflare in front of your origin does a similar job.
Neither covers one person calling your most expensive endpoint in a loop. That case is handled by a rate limit, keyed by user or IP, on endpoints that send email, call a paid API or write to the database.
Every free plan's limits vs launch day
Free tiers are sized for development. Some of the limits that show up once real users arrive:
| Limit | Value | What it looks like on launch day |
|---|---|---|
| Supabase built-in email | 2 messages per hour, team addresses only | the third sign-up never gets a confirmation link |
| Supabase direct connections (Nano/Micro) | 60 | "too many connections" once more than 60 function instances hold one |
| Supabase Free egress | 5 GB per month | 2,500 views of a page that loads 2 MB of images from storage |
| Supabase Free database | 500 MB | fills quickly if images are stored as base64 in text columns |
| Supabase Free inactivity | "paused after 1 week" | a project nobody opened for a week stops responding |
| Vercel Hobby | features pause at the limit, non-commercial use only | the site goes down at peak, and selling on it breaks the terms |
The built-in email sender is meant for testing auth flows. Real users need your own email provider connected through custom SMTP, plus SPF and DKIM on the domain so the confirmation does not land in spam.
Is your app talking to the database efficiently?
None of the problems in this section show up with test data and a single user.
A connection pooler, in transaction mode
Postgres connections are expensive and limited. A long-running server opens a handful and reuses them. Serverless functions do the opposite: each instance opens its own, and a traffic spike creates hundreds of instances. The smallest Supabase compute sizes allow 60 direct connections.
Think of a restaurant with 60 tables where every guest reserves one for the whole evening, including the time they spend outside on the phone. A pooler in transaction mode is the host who seats you only while you are eating. On Supabase the shared pooler listens on port 6543 for transaction mode, and it does not support prepared statements, so the client has to be told:
import postgres from 'postgres'
// DATABASE_URL points at the pooler: ...pooler.supabase.com:6543/postgres
export const sql = postgres(process.env.DATABASE_URL, {
prepare: false,
})
supabase-js, your requests go over HTTP and pooling is handled for you. This applies the moment you add Prisma, Drizzle or any direct Postgres driver.Functions in the database's region
Vercel deploys functions to iad1 (Washington, D.C.) by default. If the database is in Frankfurt, every query crosses the Atlantic and back, on the order of 90 ms per round trip. A page that makes ten sequential queries spends close to a second on travel alone.
{
"regions": ["fra1"]
}
An index on every column you filter by
Without an index, where user_id = ... reads the entire table. At 100 rows that takes microseconds. At a million rows it takes seconds, on every request. explain analyze shows which case you are in:
explain analyze
select * from orders where user_id = '6f1c...';
-- Seq Scan on orders (rows removed by filter: 999,987)
create index concurrently orders_user_id_idx on orders (user_id);
Two things that are easy to miss. Postgres does not create indexes on foreign key columns automatically. And every column used inside an RLS policy is a column you filter by, on every query against that table.
Paginate every list, no N+1 queries
An endpoint that returns "all posts" works in the demo and returns the whole table in production. Supabase's API caps responses at 1,000 rows by default, which limits the damage but still sends 1,000 rows. With a page size and a cursor:
const { data: posts } = await supabase
.from('posts')
.select('id, title, created_at')
.order('created_at', { ascending: false })
.lt('created_at', cursor)
.limit(20)
An N+1 query is a related problem: you fetch a list, then loop over it and fetch one related row per item. It is like going to the shop 50 times for 50 items instead of taking a list.
const { data: posts } = await supabase.from('posts').select('*').limit(50)
for (const post of posts) {
const { data: author } = await supabase
.from('profiles')
.select('name')
.eq('id', post.author_id)
.single()
post.author = author
}
const { data: posts } = await supabase
.from('posts')
.select('id, title, author:profiles(name)')
.limit(50)
With functions in the wrong region this adds up: 51 round trips at 90 ms is 4.6 seconds for one page.
Keep heavy work out of the request
Three kinds of work are better kept out of a serverless function.
Pages that do not change per visitor. A landing page, a pricing page or a blog post rendered on every request means a function invocation and usually a database query for content that changes monthly. It can be prerendered or cached at the CDN:
export default defineNuxtConfig({
routeRules: {
'/': { prerender: true },
'/pricing': { prerender: true },
'/blog/**': { swr: 3600 },
},
})
Cached pages also help with unwanted traffic, because a request served from the CDN does not invoke a function.
File uploads. A file routed through your function is transferred twice and runs into the platform's body limit, which on Vercel is 4.5 MB by default. With a signed URL the server only issues permission, and the browser uploads straight to storage:
import { serverSupabaseServiceRole, serverSupabaseUser } from '#supabase/server'
export default defineEventHandler(async (event) => {
const user = await serverSupabaseUser(event)
if (!user) throw createError({ statusCode: 401 })
// the path is chosen by the server, so a user cannot overwrite someone else's file
const path = `${user.id}/${crypto.randomUUID()}`
const { data, error } = await serverSupabaseServiceRole(event)
.storage.from('uploads')
.createSignedUploadUrl(path)
if (error) throw createError({ statusCode: 500 })
return data
})
const { path, token } = await $fetch('/api/upload-url', { method: 'POST' })
await supabase.storage.from('uploads').uploadToSignedUrl(path, token, file)
Supabase's signed upload URLs are valid for two hours. S3 calls the same idea presigned URLs.
Slow work. Generating a PDF, calling an LLM, resizing a video, sending 500 emails. If it runs inside the request, the user waits on a spinner, the function may time out mid-job, and the user clicks the button again, which starts a second copy. The alternative is a queue: the endpoint adds a job and answers with 202 Accepted, and a worker does the job later. Supabase Queues, Inngest, QStash and Trigger.dev all do this.
What happens when something fails?
Do you know it is down, and can you undo it?
Uptime alerts to your phone. The monitor should request an endpoint that queries the database, because a static homepage keeps returning 200 while every login fails.
One-click rollback to the last good deploy. Vercel has Instant Rollback. On Hobby it only goes back to the immediately previous deployment, and environment variables are not rolled back with the code. The database is not rolled back either: if a deploy dropped a column, the old code runs against a schema it no longer matches. Adding columns in one release and removing them in a later one avoids this.
Is staging separated from production?
In July 2025 Jason Lemkin was nine days into building an app with Replit's agent when it deleted his production database during an explicit code freeze, wiping records for 1,206 executives and more than 1,196 companies. The agent then claimed a rollback was impossible. It was possible, and it worked.
The agent had production credentials. An instruction in a prompt can be ignored, while a credential the agent does not have cannot be used. A separate database project for development, separate keys per environment and staging-only keys for AI tools prevent this scenario.
Do you have any test coverage on your payment flow?
A bug in the payment flow costs money in both directions: customers charged without getting access, or getting access without being charged.
As an example, three tests cover the cases described earlier in this post, and Stripe's CLI can run them against a local server:
stripe listen --forward-to localhost:3000/api/stripe/webhook
stripe trigger checkout.session.completed
- A forged webhook is rejected. A request without a valid
stripe-signaturegets a 400. Otherwise anyone cancurlthemselves a paid plan. - A repeated webhook changes nothing. Stripe retries deliveries, so the same event can arrive twice. Storing the event ID under a unique constraint and exiting early on a duplicate handles it. I covered the pattern in the ticket booking post.
- The price comes from the server. If the amount or the plan is read from the request body, the user picks their own price.
Failures handled on purpose
For every call to an external service there is a question: what happens if it never responds? One answer is a timeout, a limited number of retries and a defined message for the user:
const invoice = await $fetch('https://api.example.com/invoices', {
method: 'POST',
body: order,
timeout: 5000,
retry: 2,
})
Without the timeout, one slow third party holds your functions open until the platform kills them, and you pay for the wait.
From vibe coding to vibe engineering
Simon Willison proposed vibe engineering as the name for the other way to work with these tools: the model writes the code, and a person who understands the system stays accountable for it.
Every item above can be turned into a question for the model about your own codebase. For example:
What is public?
"List every environment variable and API key that ends up in the client bundle, and every table reachable with the publishable key without logging in."
What is unbounded?
"List every query without a limit, every loop that queries inside it, and every filtered column without an index."
What costs money?
"List every endpoint that calls a paid API, sends email or writes a file, and show me where each one is rate-limited."
What happens on failure?
"For every external call, show me the timeout and what the user sees when it fails. Then show me the test for the payment webhook."
All of this is the technical side only. Vibe-coded apps also have problems of a legal nature: personal data and GDPR, licenses of the generated code, liability after a breach. But that is a different story...
Continue Reading
Building a ticket booking system in Nuxt that doesn't double-book under load
The classic interview question with real code. SELECT FOR UPDATE vs atomic UPDATE, reservation TTL with Nitro tasks, idempotency keys
Frontend internals: 90 concepts
Hydration, fiber, QUIC, CRDTs, compositing, INP - from Vue perspective