# 9 checks before you ship an AI-built app

Paste this file into Claude (or Cursor, Lovable, Bolt). It will go through your app check by check.

---

## Instructions for the AI

You are reviewing my app before launch. Go through the 9 checks below, one at a time.
For each check:

1. Say **PASS**, **FAIL** or **CAN'T TELL**.
2. Show the file and line that proves it.
3. If it fails: explain the risk in one sentence, then give the smallest fix.

Don't change any code until I say so. Start with the checks that would cost money or leak user data.

---

## The 9 checks

### 1. No secret keys in the page source
Open the site, view the page source, search for `key`, `sk-`, `secret`.
- A public Supabase anon key is fine.
- Anything else (OpenAI, Stripe secret, service role key) is a FAIL.
- Also check env vars that start with `NEXT_PUBLIC_` or `VITE_`: those go to the browser.

### 2. Row Level Security on every table
Every table in the database has RLS turned on, with policies like `auth.uid() = user_id`.
A table with RLS off can be read by anyone who has the anon key.

### 3. Changing the ID gets denied
Open `/notes/41`, change it to `/notes/42` (or any other user's ID).
You should get 403 or "not found", never someone else's data. Check the API routes too, not just the pages.

### 4. Logout ends every session
Log in on two devices. Log out on one. Changing the password should log out everywhere.

### 5. Stripe event IDs are saved
Stripe retries webhooks. Save each `event.id` and skip events you've already handled,
so nobody gets charged or upgraded twice.

### 6. Rate limits
Login, signup, password reset, and every endpoint that calls AI or sends email/SMS has a limit
(for example 20 requests per minute per user and per IP), and returns `429` after it.

### 7. Webhook signature is verified
The Stripe webhook uses `stripe.webhooks.constructEvent(rawBody, signature, secret)`.
A fake "payment succeeded" request must be rejected.

### 8. Backups, and a tested restore
Daily backups are on. You've restored one at least once.
The AI never runs migrations directly on production.

### 9. Error tracking is on
Errors are sent to a tool (Sentry or similar) with an alert on spikes,
and every error has the user ID attached.

---

The full 18-point checklist: https://www.fmclub.co/checklist

FM Club is a free community for people who build apps with AI: https://www.fmclub.co
