DatabaseFundamentalsConnecting to your database
Connect to your database
Supabase provides multiple methods to connect to your Postgres database, whether you're working on the frontend, backend, or using serverless functions.
Find your connection stringStep 1 of 3
Where does your code run?
How to connect to your Postgres databases
How you connect to your database depends on where you're connecting from:
- For frontend applications, use the Data API
- For Postgres clients, use a connection string — direct connection for single sessions or native commands, session mode for persistent clients on IPv4-only networks, transaction mode for temporary clients like serverless functions
| Mode | Host:Port | IP version | Best for |
|---|---|---|---|
| Direct connection | db.[project-id].supabase.co:5432 | IPv6 (IPv4 with add-on) | Migrations, pg_dump, long-lived backend |
| Shared pooler — session | aws-[region].pooler.supabase.com:5432 | IPv4 | Persistent backend on IPv4-only networks |
| Shared pooler — transaction | aws-[region].pooler.supabase.com:6543 | IPv4 | Serverless and edge functions |
| Dedicated pooler | db.[project-id].supabase.co:6543 | IPv6 (IPv4 with add-on), paid | High-performance app traffic |
Quickstarts
Prisma
Drizzle
Postgres.js
pgAdmin
PSQL
DBeaver
Direct connection
The direct connection string connects directly to your Postgres instance. It is ideal for persistent servers, such as virtual machines and long-lasting containers.
postgresql://postgres:[YOUR-PASSWORD]@db.abcdefghijklmnopqrst.supabase.co:5432/postgresPoolers
Supabase offers two poolers. The Shared Pooler (Supavisor) is multi-tenant, available on every project, and IPv4-only.
Pooler session mode
postgres://postgres.apbkobhfnmcqqzqeeqss:[YOUR-PASSWORD]@aws-[REGION].pooler.supabase.com:5432/postgresPooler transaction mode
postgres://postgres.apbkobhfnmcqqzqeeqss:[YOUR-PASSWORD]@aws-[REGION].pooler.supabase.com:6543/postgresThis page is a Design Engineer application prototype, not the real Supabase docs. Static content is condensed from the public Connect to your database guide for layout fidelity.