Skip to content

Vercel Configuration

Alberto edited this page Dec 14, 2023 · 10 revisions

1. Requirements

Head over to https://vercel.com and create an account. Then install the Vercel CLI:

bun i -g vercel 

2. Upload to Vercel

Run vercel login and then vercel . from the root of the project to deploy your app using the preconfigured commands.

Alternatively, you can use the Vercel GitHub integration to deploy your app straight from your uploaded repo everytime you push to the main branch. (You can always add it later even if you use the CLI to deploy the first time)

To set it up just create a new project on Vercel using the Import Git repository option and follow the instructions.

3. Add Environment variables

In both cases you have to upload your environment variables under Project Settings > Environment Variables, you can find that in the dashboard linked here. You can drag and drop your .env.local file. You should also change the DATABASE_URL variable with the connection string to your production database and all the other keys to production keys, not the test ones.

For the final deployment if you use Supabase you can find the URL under Project Settings > Database > Connection string > URI, linked here. Make sure you insert the correct database password into the string, you can reset it on the same page.

If you need to change the prisma schema on your production database, you can run bun db:migrate to generate a new migration file while preserving the data, then Vercel will automatically run bun db:deploy on the server to apply the changes for every commit.

4. Change Node version

Head over in your Project Settings > General > Node.js Version and select 20.x from the dropdown.

5. Rebuild

Finally, run another vercel build to apply the changes or just push to the repo if you used the Github integration:

vercel .
Clone this wiki locally