Guide

Get DB Connection String

Overview

Supabase provides multiple connection methods for your Postgres database depending on your use case—frontend, backend, or serverless functions. The Direct Connection String is the most straightforward approach for backend applications, server-side scripts, and ORM configurations (such as Prisma, SQLAlchemy, or Node-postgres). This workflow guides you to locate and copy your connection string from the Supabase dashboard, which you'll use to authenticate your application to the database. Having your connection string readily available ensures you can quickly integrate your database into your development and production environments.

Before you begin

  • An active Supabase account at supabase.com
  • At least one Supabase project created and initialized
  • Owner or admin permissions on the project (to access connection credentials)

Step by step

1
ClickConnect

Navigate to the Connect section of your Supabase project by clicking the Connect button in the dashboard. This section centralizes all available methods for connecting to your Postgres database.

Tip. The Connect button is usually located in the main project navigation. If you're unsure of its location, look in the left sidebar or top navigation bar of the Supabase dashboard.
Step 1
2
ClickDirect Connection string

Click on the Direct Connection String option to retrieve the full connection string for your database. This string contains all the credentials and connection parameters needed to connect backend applications and database clients directly to your Postgres instance.

Tip. Once displayed, the connection string is typically presented in a copyable text field. Use the copy button (if available) to avoid manual transcription errors. Store this securely and never commit it to version control—use environment variables instead.
Warning. The connection string contains your database password. Treat it as a sensitive credential. Never share it publicly, log it, or commit it to version control. Always use environment variables or secret management tools in production.
Step 2

Confirm it worked

  1. 1The Supabase dashboard displays the Connect section with connection method options
  2. 2The Direct Connection String option is visible and clickable in the Connect menu
  3. 3A connection string in the format `postgresql://user:password@host:port/database` is displayed and ready to copy
  4. 4The connection string includes your project's unique host, port, database name, and authentication credentials

Common issues

Keep reading