87 87. Step 13: Deploy to Production
As of Oct 22, 2026 · Official docs: Vercel · Vercel environment variables · Supabase: Redirect URLs
Once everything works on your computer, save your work to GitHub, then put the front end online with Vercel. In Classes 10–12, these are steps (J) and (K) Put the app online with Vercel.
87.1 Save Your Work to GitHub
Vercel builds the app from your fork on GitHub, so first push your changes there. Ask Claude to commit your changes and push them to your fork, or do it yourself: type each of these commands in VS Code’s terminal, in the task-app folder, pressing Enter after each one. First:
git statusgit status lists the files you changed or added since your last commit, and changes nothing. Make sure .env.local is not in the list: it holds your keys, and the project’s .gitignore file tells Git to ignore it (see .gitignore and Keeping Secrets Out of Git). Then:
git add -Agit commit -m "Set up the task app"git pushgit add -Achooses which changes go into your next commit:addstages changes, and-A(all) includes every changed, new and deleted file.git commit -m "Set up the task app"saves those changes as a commit, a snapshot in your project’s history.-mgives the commit its message, in quotes; write one that says what you did.git pushuploads your new commits to your fork on GitHub.
87.2 Deploying the Frontend
Recommended: Vercel
Vercel is tightly integrated with Next.js and offers smooth deployments. Its free Hobby plan is enough for this project.
- At vercel.com, sign up with Continue with GitHub.
- Click Add New > Project, and import your
task-apprepository. - During setup:
- Select the correct framework: Next.js.
- Before you deploy, open Environment Variables and add, with the values from your worksheet (the same ones as in
.env.local):NEXT_PUBLIC_SUPABASE_URLNEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY(your Supabase publishable key,sb_publishable_...)
NEXT_PUBLIC_name.
- Click Deploy. When it finishes, copy your app’s address (
https://....vercel.app) into the worksheet. - In the Supabase dashboard, Authentication > URL Configuration: change Site URL to your Vercel address, and add the redirect URL
https://YOUR-APP.vercel.app/**. Keep thehttp://localhost:3000/**one, so that signing in still works on your computer. - In Google Cloud, add your Vercel address to the OAuth client’s Authorized JavaScript origins. The Authorized redirect URI stays the Supabase callback URL (
https://YOUR-PROJECT-REF.supabase.co/auth/v1/callback), and Stripe needs no changes.
If you add or change an environment variable later, redeploy: changes apply only to new deployments.
After deployment:
- Visit the production URL to confirm it loads.
- Test login, task creation, and subscription flows in production.
From now on, every git push to your fork makes Vercel deploy the new version automatically. More background in Hosting and Deployment.
Alternative Options
If you prefer other providers:
- Netlify – good Next.js support (with appropriate adapters).
- AWS Amplify, Render, or any provider that supports Node/Next.js.
Configuration will be similar: point to your repo and set env vars.
87.3 Update Environment Variables for Production
For a real product (beyond this course), you would also:
- Use a separate production Supabase project (with its own URL and publishable key in Vercel), so that testing never touches real users’ data.
- Switch Stripe from test mode (the sandbox) to live mode. Everything Stripe-related has a separate live version, and each one goes where its test version went:
- the live secret key (
sk_live_...): in Supabase secrets (npx supabase secrets set STRIPE_SECRET_KEY=sk_live_...), not in Vercel, and in Supabase Vault under the namestripe(the Vault page is in Project Settings, under Integrations), because the database creates Stripe customers itself; - a live product and price: their new price ID goes in the
STRIPE_PRICE_IDsecret; - a live webhook destination, set up again in live mode, and its new signing secret in
STRIPE_WEBHOOK_SECRET.
pk_live_..., isn’t used by this app.) - the live secret key (
- Use your production domain (e.g.,
https://yourapp.com) wherever the steps above use the Vercel address: Supabase’s Site URL and redirect URLs, and Google’s Authorized JavaScript origins. Google’s authorized redirect URI doesn’t change: it stays your Supabase callback URL.
There is no CORS setting to change in Supabase: the Edge Functions already send the header Access-Control-Allow-Origin: *, which lets any web address call them. (CORS is a browser rule about which sites may call a server from a web page.)
Practice Questions
Easy
Question 1 · Short answer
What does it mean to deploy to production? Why can’t other people use your app at http://localhost:3000?
Question 2 · Multiple choice
Why does the page recommend Vercel for deploying this app?
- Vercel is the only host that can run a Next.js app
- Vercel is tightly integrated with Next.js, so deployments are smooth
- Vercel also hosts the app’s database and edge functions
- Vercel replaces Stripe for handling payments
Question 3 · True or false
With the method on this page, your code must be in a Git repository (for example on GitHub) before Vercel can deploy it.
Question 4 · Short answer
Stripe test keys start with pk_test_ and sk_test_. What do the matching live keys start with, and what do pk and sk stand for?
Question 5 · Short answer
Before you commit and push, you run git status. Which file must not appear in its list, and why?
Medium
Question 6 · Short answer
Your .env.local file works perfectly on your laptop. Why doesn’t Vercel get the values in it automatically, and what do you need to do instead?
Question 7 · Multiple choice
Variables whose names start with NEXT_PUBLIC_ are built into the JavaScript that is sent to every visitor’s browser. Which of these values must never go into a NEXT_PUBLIC_ variable?
- The Supabase project URL
- The Supabase publishable key (
sb_publishable_...) - The Stripe publishable key (
pk_...) - The Stripe secret key (
sk_...)
Question 8 · Matching
When you go live, different settings live in different places. Match each item with where you set it.
| Item | Where | |
|---|---|---|
1. NEXT_PUBLIC_SUPABASE_URL and NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY for the live site |
A. Supabase secrets, used by the edge functions | |
2. The live Stripe secret key (sk_live_...) |
B. Supabase’s Auth settings (Site URL and allowed redirect URLs) | |
| 3. Your production web address, so that sign-in can return users to it | C. The live-mode webhook settings in the Stripe Dashboard | |
4. The endpoint that sends Stripe’s events to your stripe-webhook function |
D. The environment variables of your Vercel project |
Question 9 · Short answer
Vercel reports that the deployment succeeded and your home page loads. According to the page, what should you test next, and why isn’t “the page loads” enough?
Question 10 · Ordering
Put these commands in the order you use them to save your work to GitHub, and say what each one does.
- A.
git push - B.
git commit -m "Set up the task app" - C.
git status - D.
git add -A
Question 11 · Multiple choice
Your app is now at https://maria-task-app.vercel.app. What do you change in Google Cloud for “Login with Google” to work there?
- Replace the Authorized redirect URI with
https://maria-task-app.vercel.app - Add
https://maria-task-app.vercel.appto the client’s Authorized JavaScript origins - Create a new Google Cloud project for the live site
- Nothing in Google Cloud, but change the Stripe webhook URL
Hard
Question 12 · Scenario
On your live Vercel site you click “Sign in with Google” and choose your account - and then you land on http://localhost:3000 instead of your live site. What’s wrong, and how do you fix it?
Question 13 · Long answer
In this tutorial you created only one Supabase project, and you use it both for developing on your laptop and for the live site. The page talks about using “your production Supabase project URL” and keys. What does that suggest bigger teams do, and what is one risk of using a single project for everything?
Question 14 · Scenario
You switch Stripe to live mode and replace the test keys with live keys, but you skip “update webhook endpoints/secrets”. Real customers pay successfully, yet their accounts never become premium. Explain why, and what you should do.
Question 15 · Scenario
Sam imports his task-app repository into Vercel and clicks Deploy right away, without adding any environment variables. The build fails. He then adds NEXT_PUBLIC_SUPABASE_URL and NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY in the project’s settings. Is he done? What should he do, and what else must he set up after the first successful deploy?
Question 16 · Scenario
Sam switches his app to Stripe live mode. He adds STRIPE_SECRET_KEY=sk_live_... to his Vercel project’s environment variables and redeploys, but upgrades still go to the test checkout page. What did he do wrong, and what three live values does he need, and where?
Question 17 · True or false
Before the live site can call the Edge Functions, you must add your Vercel address to a CORS setting in Supabase.