> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fastgen.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Direct connect

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.

<img src="https://mintcdn.com/organa/x4VcIWGQE6pfuZkY/images/database-connect.webp?fit=max&auto=format&n=x4VcIWGQE6pfuZkY&q=85&s=34d1fb614500a4e9f386acf98bbbd1a3" alt="database-direct-connect" width="644" height="236" data-path="images/database-connect.webp" />

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

```Javascript theme={null}
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:

```EditorConfig theme={null}
PGUSER=alex
PGHOST=ep-cool-darkness-123456.fastgen.com
PGDATABASE=dbname
PGPASSWORD=AbC123dEf
PGPORT=5432
```

### Variable:

```EditorConfig theme={null}
DATABASE_URL="postgres://alex:AbC123dEf@ep-cool-darkness-123456.fastgen.com/dbname"
```

### Command-line:

```Javascript theme={null}
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.
