Connecting
Grab DATABASE_URL from the Connect tab. TLS is required.
psql "$DATABASE_URL"// Node — postgres.jsimport postgres from 'postgres';const sql = postgres(process.env.DATABASE_URL, { ssl: 'require' });# Python — psycopgimport os, psycopgconn = psycopg.connect(os.environ["DATABASE_URL"], sslmode="require")Pooled vs direct
Section titled “Pooled vs direct”Use the pooled connection string (Connect tab toggle) for serverless platforms and app servers with many short-lived connections; use the direct string for migrations and long-lived sessions.