Skip to main content
You can connect your existing databases to Vybe and use their data across your apps. This lets you build internal tools on top of production data without moving or duplicating it.

Supported databases

DatabaseAuthenticationSSH TunnelRead-only Mode
PostgreSQLConnection string or individual credentialsYesYes
MySQLConnection string or individual credentialsYesYes
Amazon RedshiftAWS IAM role assumptionNoNo

Connecting a database

1

Open the Integrations page

Navigate to Integrations in the left sidebar and scroll to the Databases section.
2

Select your database type

Click Connect Database and choose PostgreSQL, MySQL, or Amazon Redshift.
3

Enter connection details

For PostgreSQL and MySQL, provide either a connection string or individual credentials (host, port, database name, username, password). For Amazon Redshift, provide your cluster details and IAM role ARN. Redshift uses AWS IAM role assumption for secure, credential-free access.
4

Configure connection options

Optionally enable read-only mode to prevent accidental writes, or SSH tunnel to route the connection through an SSH tunnel for databases behind a firewall.
5

Test and save

Vybe validates the connection before saving. If the connection fails, check your credentials, firewall rules, and SSH configuration.
Enable read-only mode for production databases to prevent accidental data modification. All workspace members can query connected databases, so read-only mode provides an important safety net.

Read-only mode

When read-only mode is enabled, Vybe enforces read-only transactions on every query to the database. This means:
  • SELECT queries work normally
  • INSERT, UPDATE, DELETE, and DDL statements are blocked
  • The AI cannot modify your data, even if you ask it to
This is the recommended setting for production databases. You get full read access for dashboards, reports, and data exploration without any risk of accidental writes.

SSH tunnel connections

For databases behind a firewall or in a private network, Vybe supports SSH tunnel connections.
1

Create an SSH key

On the Integrations page, scroll to the SSH Keys section and click Create SSH Key. Vybe generates a public/private key pair.
2

Add the public key to your server

Copy the public key and add it to the ~/.ssh/authorized_keys file on your SSH bastion host or jump server.
3

Connect the database with SSH

When connecting a database, enable the SSH tunnel option and provide the SSH host, port, username, and the SSH key you created.
4

Save and verify

Vybe connects to your SSH server first, then tunnels the database connection through it. The test step verifies both the SSH connection and the database connection.
SSH keys can be reused across multiple database connections. Create one key for your bastion host and use it for all databases accessible from that server.

Organization-wide access

Connected databases are available to all members of your organization. Once you connect a database, any team member can:
  • Query it from the AI chat in any app
  • Use it as a data source when building apps
  • Reference it in saved data queries
There is no per-app database configuration — connected databases are shared at the organization level.

Using external databases

Once connected, you can interact with external databases in two ways:

Through the AI chat

Ask the AI to query your external database directly during a conversation:
Show me the top 10 customers by revenue from our analytics database.
How many orders were placed last month in the production database?
The AI identifies which connected database to query, writes the SQL, executes it, and displays the results inline.

From app code

The AI generates server-side code that queries your external databases using Vybe’s helper functions. Each database type has its own helper with parameterized query support.
import { queryExternalDatabasePostgres } from '@/server-lib/external-db-postgres';

const customers = await queryExternalDatabasePostgres(
  'My Analytics DB',
  'SELECT name, revenue FROM customers ORDER BY revenue DESC LIMIT 10',
  []
);

Redshift specifics

Amazon Redshift connections work differently from PostgreSQL and MySQL:
  • Authentication: Uses AWS IAM role assumption instead of username/password credentials. You provide the IAM role ARN that Vybe assumes to access your cluster.
  • No SSH tunnel: Redshift connections do not support SSH tunneling. Ensure your Redshift cluster is accessible from Vybe’s IP range.
  • Asynchronous queries: Redshift queries are executed asynchronously. The helper function returns a result object with a status field that you should check before accessing the data.
const result = await queryExternalDatabaseRedshift(
  'My Redshift Cluster',
  'SELECT * FROM sales WHERE region = :region',
  { region: 'us-east' }
);

if (result.status === 'FINISHED') {
  // Access result.records
}

Troubleshooting

Check that your database is accessible from external networks. If it is behind a firewall, use an SSH tunnel connection. Verify that the host, port, and credentials are correct.
Confirm that the public key is added to your server’s authorized_keys file. Verify the SSH host, port, and username. Ensure the SSH server allows tunneling (check AllowTcpForwarding in your SSH config).
Your database user may not have access to the tables you are querying. Check the user’s permissions and grant SELECT access to the relevant schemas and tables.