Connecting Hasura to a Prisma Postgres Database
Introduction
This guide explains how to connect a new or existing Prisma Postgres database to a Hasura instance.
Step 1: Sign up or log in to Prisma Postgres
Navigate to the Prisma Postgres console and sign up or log in.
Step 2: Create a new Prisma Postgres Project
Click the New Project
button.

Input the proper credentials you'd like to use for your project.

Click Create Project
.
You should now see your new project in the Prisma Postgres console.
Step 3: Generate Credentials
From the project sidebar, click the Dashboard
button, then press Connect
.

Switch to the Any Client (Preview)
tab.
Click the Generate Credentials
button to get the database connection string.

Congratulations! You've now created a Postgres instance on Prisma Postgres which you can use with Hasura GraphQL Engine.
Step 4: Sign up or log in to Hasura Cloud
Navigate to Hasura Cloud and sign up or log in.
Step 5: Store the database connection string in Hasura Cloud
On the Hasura Cloud dashboard, create a new project:

After the project is initialized successfully, click on Env Vars
, then New Env Var
to import the database connection string you generated in the previous section.

From there, give your env var a name like DATABASE_URL
, paste in the database connection string, and press Save
.
Step 6: Launch the Hasura Console
Click on Launch Console
to open the Hasura Console in your browser.

Step 7: Connect the database to Hasura Cloud
On the Hasura Console, navigate to the Data
tab and press Connect Database
at the top.

From there, select Postgres
and press Connect Existing Database
.

Enter the name of your Env Var you created earlier, then press Connect Database
.

That's it! You're now connected to your Prisma Postgres database and can start building.
Next steps
You can check out our 30-Minute Hasura Basics Course and other GraphQL & Hasura Courses for a more detailed introduction to Hasura.
If using Hasura Cloud, you can also click the gear icon to manage your Hasura Cloud project. (e.g. add collaborators, env vars or custom domains).

For more information on which Postgres features we support, check out this page.