PostgreSQL
Our boilerplate templates comes with PostgreSQL integration. In this part of the documentation, we are going to show you how to integrate Vercel Postgres with your boilerplate template.
Note: If you want to use other providers you can do so. For demonstration purpose we are using Vercel PostgreSQL (opens in a new tab)
Getting the Database URL
Before we integrate the database in the template first you have to deploy (opens in a new tab) it to Vercel.
Once you deploy it follow the instruction to create the database.
- Go to the Storage tab.
- Now Scroll down and click on the Create New Database button.
After that select Postgres and then the Continue button.
Now do the following to create a new database:
- Enter the database name. The name can only contain alphanumeric letters, "_" and "-" and can't exceed 32 characters.
- Select a region.
- Click Create.
The Database is created successfully.
Because we created the database in a project, we won’t have to add the environment variables manually to Vercel. It’ll be added automatically.
Now we have to pull the environment variables to the local project.
To do that, first of all, you have to install Vercel CLI
npm i -g vercel@latest
After that run this command to pull the .env variables.
vercel env pull .env
Note: You have to connect the local project with Vercel for this command to work. Follow this instruction (opens in a new tab) to link the project.