You have the option to directly link an application or client to your database. The necessary connection details can be retrieved from the database settings page within the project section. By choosing a specific user (role), a connection string will be automatically generated for you.

database-direct-connect

A connection string includes the user (role), password, hostname, and database name.

postgres://alex:AbC123dEf@ep-cool-darkness-123456.fastgen.com/dbname
           ^    ^         ^                                   ^
     role -|    |         |- hostname                         |- database 
                |
                |- password

You can use the details from the connection string or the connection string itself to configure a connection. For example, you might place the connection details in an .env file, assign the connection string to a variable, or pass the connection string on the command-line.

.env file:

PGUSER=alex
PGHOST=ep-cool-darkness-123456.fastgen.com
PGDATABASE=dbname
PGPASSWORD=AbC123dEf
PGPORT=5432

Variable:

DATABASE_URL="postgres://alex:AbC123dEf@ep-cool-darkness-123456.fastgen.com/dbname"

Command-line:

psql postgres://alex:AbC123dEf@ep-cool-darkness-123456.fastgen.com/dbname

Postgres Port

We use the default Postgres port, 5432.

Network protocol support

We support both IPv4 and IPv6 addresses.