Setting Up a Project Database
For this project, we will use the Postgres database. Let's see how to set it up on Vercel.
Instructions
- Click "Continue to Dashboard";
- Choose "Storage" from the header tabs;
- Create "Postgres (Serverless SQL)";
- Accept the terms and conditions;
- Name the database and click "Create and Continue";
- Click the "Connect" button.
After creating and connecting the database, we must set it up and populate it with data to work with.
Instructions
- Visit the ".env.local" tab;
- Ensure you have all the necessary data:
POSTGRES_URL;POSTGRES_PRISMA_URL;POSTGRES_URL_NON_POOLING;POSTGRES_USER;POSTGRES_HOST;POSTGRES_PASSWORD;POSTGRES_DATABASE.
- Copy all the data and navigate to the project;
- Find the
.env.examplefile in the project root. Rename it to.env; - Paste the copied data from Vercel;
- Finally, open the terminal and run
npm i @vercel/postgresto install Vercel Postgres.
The last step left is to populate the database with data. Let's focus on it in the following chapter.
In Practice
Thanks for your feedback!
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Can you explain how to access the database credentials in Vercel?
What should I do if I can't find the .env.example file in my project?
Why is it important to add .env to .gitignore?
Awesome!
Completion rate improved to 2.08
Setting Up a Project Database
Swipe to show menu
For this project, we will use the Postgres database. Let's see how to set it up on Vercel.
Instructions
- Click "Continue to Dashboard";
- Choose "Storage" from the header tabs;
- Create "Postgres (Serverless SQL)";
- Accept the terms and conditions;
- Name the database and click "Create and Continue";
- Click the "Connect" button.
After creating and connecting the database, we must set it up and populate it with data to work with.
Instructions
- Visit the ".env.local" tab;
- Ensure you have all the necessary data:
POSTGRES_URL;POSTGRES_PRISMA_URL;POSTGRES_URL_NON_POOLING;POSTGRES_USER;POSTGRES_HOST;POSTGRES_PASSWORD;POSTGRES_DATABASE.
- Copy all the data and navigate to the project;
- Find the
.env.examplefile in the project root. Rename it to.env; - Paste the copied data from Vercel;
- Finally, open the terminal and run
npm i @vercel/postgresto install Vercel Postgres.
The last step left is to populate the database with data. Let's focus on it in the following chapter.
In Practice
Thanks for your feedback!