StoicBuilder

HandbookIII the CastraStaging and production

IIIthe Castra, Stay in control

Staging and production

1 min readUpdated 28 November

In plain words

Production is the live app real users touch; staging is a copy with its own database where you try changes first, so mistakes land somewhere harmless.

Where you see it

Vercel gives every branch a preview link, which is a quick kind of staging. The catch is that previews often use the same Supabase project as production, so testing "delete account" on a preview deletes a real account.

Vercel environment variablesconfig
NEXT_PUBLIC_SUPABASE_URL Production https://abcd.supabase.coNEXT_PUBLIC_SUPABASE_URL Preview https://wxyz.supabase.coSTRIPE_SECRET_KEY Production sk_live_...STRIPE_SECRET_KEY Preview sk_test_...
Same names, different values per environment. Previews can't touch live data or real cards.

What goes wrong

  1. Staging and production sharing a database

    Test orders, fake users and deleted rows all land in real data. Give staging its own Supabase project.

  2. Live payment keys outside production

    With sk_live_ on staging, your next test checkout charges a real card. Use Stripe's test keys everywhere else.

  3. Staging that drifts from production

    When staging is missing last month's migrations, a change can pass there and still fail live. Run the same migrations, in the same order, on both.

What to tell your agent

Copy this into Lovable, Bolt, Cursor or any agent
Set up a staging environment with its own Supabase project and Stripe test keys, and make sure preview deploys never point at the production database. Show me which environment variables differ between staging and production, without printing any secret values.

Quick check

Sign in to earn +10 XP for it

You test "delete my account" on a Vercel preview link, and a real customer's account disappears. Why?

Got a prompt that touches staging and production?

Paste it. You get a better prompt first, then the cards that explain it.

Check your own prompt

Free, no sign-up.