Browse docs
Cloud docs
Connecting to PostgreSQL on Layerbase Cloud
PostgreSQL databases on Layerbase Cloud use the standard PostgreSQL wire protocol, so existing app code, migration tools, and admin clients keep working.
Best for: Primary application databases, SaaS backends, transactional workloads, and frameworks that expect a normal Postgres URL.
Open your database in the dashboard
Go to /cloud, click the database you just created, and the connection panel shows the host, port, username, password, and a ready-to-paste connection string for the engine.
Use the generated username, password, host, port, and database name from the Quick Connect panel.
If a password leaks, the database owner can replace it with Rotate password under Connection parameters in the Connect dialog, on PostgreSQL, MySQL, MariaDB, Redis, and Valkey. The old password stops working at once, the connection string and any HTTP API token change with it, and connections that are already open stay connected. Update every app and environment variable that holds the old value. Branches keep their own passwords.
You can also download the whole set instead of copying values one at a time: the Connect dialog offers a Download .env file, ready to drop into a project under the environment variable your engine's clients expect, and a Download .txt with the labeled parameters. Both files contain the password in plain text, so keep them out of version control.
TLS is required, on by default
Append ?sslmode=require to the connection string.
PostgreSQL wire protocol on port 5432
Use any standard client
PostgreSQL works with the normal client family for that engine. Start with the dashboard snippet, then move the same URL and credentials into your app environment.
If your client has separate direct, pooled, TLS, or HTTP options, prefer the exact variant shown in Quick Connect.
psql "postgresql://layerbase:password@your-host.cloud.layerbase.dev:5432/app?sslmode=require"PostgreSQL notes
- Use the pooled URL for serverless apps and connection-heavy web workloads.
- Use the direct URL for migrations, logical replication, or tools that dislike poolers.
- Roles you create in SQL (CREATE ROLE ... LOGIN) work on the direct URL right away. To use them on the pooled URL, click Sync users in the Connect dialog (or run lbase cloud pooler sync-users, or call POST /v1/databases/<id>/pooler/sync-users) after creating them or changing a password; no password is sent, and synced roles survive restarts and wakes. See /docs/api.
- A session left idle inside an open transaction is ended after 1 hour (idle_in_transaction_session_timeout = '1h'), so an abandoned transaction cannot hold its locks indefinitely. It is a default, not a limit: SET idle_in_transaction_session_timeout in a session changes it for that session right away; ALTER ROLE or ALTER DATABASE changes it for new sessions only, and ALTER SYSTEM after a configuration reload.