Postgres connect URL

Serhii Shramko

Serhii Shramko /

2 min read--- views

Very often, cloud database services such as allow you to connect via URL. That is, without credentials such as user, password, etc.

Connection details

Connection URL

It's official PostgreSQL format for connection URLs

S.Shramko personal site screenshot

Base URL and path

Here's an example of a base URL and path structure using uppercase placeholder values:

S.Shramko personal site screenshot

How this site connects to the database

Store your credentials in .env

Store your credentials in your .env file.



  • endpoint_hostname the hostname of the branch endpoint. The endpoint hostname has an ep- prefix and appears similar to this:
  • dbname is the name of the database. The default Neon database is neondb
  • user is the database user
  • password is the database user's password, which is provided to you when you create a project
  • endpoint_id is the ID of the branch endpoint that you are connecting to. The endpoint_id has an ep- prefix and appears similar to this: ep-tight-salad-272396

Use to connect Postgres

// You can create DATABASE_URL in your code
# Or better to use .env file
datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
  referentialIntegrity = "prisma"

Use Datagrip to connect Postgres

You can use same credentials like HOST, PORT, USER, PASSWORD, DATABSE for connection to Database with DataGrip.

S.Shramko personal site screenshot

Share it: