How to Deploy Supabase and Next.js on Vercel

Deploying Supabase and Next.js on Vercel is a common combination — and simpler than it sounds. Supabase hosts your Postgres database (and optionally auth and storage). Vercel hosts your Next.js front end. The two connect entirely through environment variables. Here's the full setup.
Quick Answer
To deploy Supabase and Next.js on Vercel, create a Supabase project, copy its URL and keys into your Vercel project's environment variables, connect the Supabase client in your Next.js app, and deploy. Vercel hosts the Next.js front end; Supabase hosts your PostgreSQL database and, optionally, auth. The two connect entirely through environment variables.
Create the Supabase project
In Supabase, create a project and note the project URL, the anon (public) key, and the service role key. Supabase provisions a managed PostgreSQL database you connect to.
Wire environment variables in Vercel
In your Vercel project settings, add the Supabase URL and keys as environment variables. Keep the service role key server-only — never expose it to the browser.
# (untested-here) Vercel env vars
NEXT_PUBLIC_SUPABASE_URL=...
NEXT_PUBLIC_SUPABASE_ANON_KEY=...
SUPABASE_SERVICE_ROLE_KEY=... # server-onlyConnect the client
Initialize the Supabase client in your Next.js app using those variables, then query the database or use Supabase Auth as needed.
Deploy
Push to your connected Git branch and Vercel builds and deploys. Your front end talks to Supabase over the network using the env vars you set.
Where FastStaq differs
FastStaq is not built on Supabase. It uses PostgreSQL via Prisma and ships its own auth. You can still point FastStaq's DATABASE_URL at Supabase's managed Postgres if you want Supabase to host the database — but FastStaq does not depend on Supabase Auth or the Supabase client. So this tutorial is for Supabase-first apps; FastStaq is the own-your-stack alternative. See the Supabase + Next.js guide and deploying to Vercel.
Frequently asked questions
Does Vercel host the database? No — Supabase hosts the Postgres database; Vercel hosts the front end.
Where does the service role key go? Server-side only, as a non-public environment variable.
Can I use Supabase only for the database? Yes — you can use Supabase's Postgres and keep your own auth, which is how FastStaq would connect.


