Skip to content

Deploy to Vercel

Learn how to connect your PlanetScale database to deploy on Vercel


This guide will walk you through setting up and deploying your PlanetScale database on Vercel.

It will cover two options:


Manually connect to Vercel

Get your connection string from PlanetScale

  1. In your PlanetScale dashboard, click on the database you want to connect to.

  2. Click "Connect".

  3. Create a new password. Make sure to copy the password, as you'll only be shown it once.

  4. Select the framework you're using from the "Select your language or framework" section. This will give you the exact environment variable names you need for your selected framework. If your framework is not listed, choose "Other".

  5. Keep this page open, as you'll need to copy these to Vercel momentarily.

  6. If you navigate away from the page, and can no longer access the password, create a new password by repeating steps 1-5.

Copy environment variables to Vercel

  1. Go to your Vercel dashboard.
  2. Click on your Vercel project.
  3. Click "Settings".
  4. Click "Environment variables".
  5. Copy each value from your PlanetScale dashboard into a new environment variable in Vercel. Once you're done with one, click "Add" and continue to the next, if applicable.

For example, if you're using Prisma, your connection string will look similar to this:


In Vercel, you'll set it as follows:

  • VALUE = mysql://xxxxxxxxx:************

The credentials are blurred for the example, but when you paste them in, use the actual values.

Deploy with the PlanetScale Vercel integration

If you don't want to copy and paste the environment variables over to Vercel, you can use the PlanetScale integration from the Vercel marketplace. You can choose which database you want to connect to, and we'll automatically pull the necessary environment variables into your Vercel project.

  1. You must have an existing PlanetScale database to use the integration. You can create a database in the PlanetScale dashboard.
  2. Click "Add integration" on the Vercel integrations page.
  3. Select the Vercel account you want to connect with.
  4. On the left, you'll see the Vercel options, and on the right, the PlanetScale options.
  5. Select the Vercel project you want to connect to, and beneath that, select the framework you're using. If the framework isn't listed, select "General". This selection is what determines the names of the environment variables.
  6. On the right side, choose the PlanetScale Organization that the database is in. The integration will remain tied to this Organization and cannot be changed.
  7. Beneath that, select the database you want to connect to.
  8. Click "Connect database".
  9. Back in your Vercel dashboard, confirm the environment variables were added by going to your Vercel project > "Settings" > "Environment variables"

Configure your connection

After you set up the initial connection, you also have the option to configure the PlanetScale connection, add more databases to the project, or remove databases from the project.

To access the configuration page:

  1. In your Vercel project dashboard, click "Integrations".
  2. Click the "PlanetScale" integration.
  3. Click the "Configure" button.

If you're modifying an existing connection on a Vercel project, these environment variable values will be regenerated and overwritten.

When removing the Vercel integration
  • Environment variables are removed from all projects tied to the integration.
  • Your application will no longer be able to connect to your PlanetScale database.

What's next?

Learn more about how PlanetScale allows you to make non-blocking schema changes to your database tables without locking or causing downtime for production databases.

Need help?

Get help from the PlanetScale support team, or join our GitHub discussion board to see how others are using PlanetScale.

Was this page useful?
Last updated on Help us improve this page