Deploying Your App Using Vercel
Prerequisites
Install Vercel CLI
pnpm i -g vercel
Checklist
☑ Have the Git repo of your project ready.
☑️ Have the environment variables from your .env.local
file ready.
🔔 If you don't have the variables ready, check out the Configuration section first to learn more about how to get them.
Deploy to Vercel
-
Run
vercel
from the root of this project. You can choose which app you would like to deploy in a later step. Check out how the CLI prompts look like. -
In the Vercel project Settings (https://vercel.com/YOUR_TEAM_URL/YOUR_NEW_PROJECT/settings/environment-variables), add the Environmental Variables copied from your
.env.local
file. -
Once deployed, set the
NEXT_PUBLIC_URL
environment variable to the URL of your Vercel production deployment.
Pull environment variables from Vercel
From now on, Vercel will be your source of truth regarding environment variables. If you need to update them, do it in Vercel's dashboard and not in your .env.local
file.
These are the steps to sync your local environment with Vercel's environment variables:
# Install Vercel CLI globally if you haven't already
npm i -g vercel
# Login to Vercel
vercel login
# Link your app to its corresponding Vercel project, for example:
cd apps/demo-site && vercel link
# Pull environment variables
pnpm pull:env-vars