Database Integration
Connect external databases to sync products, orders, and more.
Ziyarn can connect to your existing databases to sync products, orders, and other data. Your agent uses this data to answer questions and process transactions in real-time.
Supported Databases
| Database | Status | Notes |
|---|---|---|
| PostgreSQL | ✅ Full support | Neon, Supabase, Railway, self-hosted |
| MySQL | ✅ Full support | PlanetScale, Railway, self-hosted |
| MongoDB | ✅ Full support | Atlas, self-hosted |
| Convex | ✅ Full support | Convex platform |
| Firebase | 🔜 Coming soon | Firestore |
| Turso | 🔜 Coming soon | LibSQL |
Neon and Supabase have dedicated options that accept the provider's connection string directly.
Connecting a Database
Step 1: Go to Databases
- Open Domains → Select domain → Databases
- Click Add database connection
You can connect more than one database to the same agent; use Add database connection again after the first one is connected.
Step 2: Configure Connection
Select your database type and enter connection details:
PostgreSQL
{
"host": "ep-cool-mountain.us-east-2.aws.neon.tech",
"port": 5432,
"database": "mydb",
"user": "neondb_owner",
"password": "your-password",
"ssl": true
}Neon
Neon hands you a connection string instead of separate fields:
- In Neon, open your project → Connection Details.
- Copy the connection string (pooled or direct).
- In Ziyarn, choose Neon, paste the string, and click Test & connect.
Neon requires SSL; Ziyarn enables it automatically. Both pooled (-pooler)
and direct hosts work.
Supabase
- In Supabase, open Project Settings → Database → Connection string.
- Copy the Transaction pooler URI (port
6543). - In Ziyarn, choose Supabase, paste the string, and click Test & connect.
Supabase direct connections are IPv6-only on most projects. Use the pooler URI unless your project has the IPv4 add-on.
MySQL
{
"host": "aws.connect.psdb.cloud",
"port": 3306,
"database": "mydb",
"user": "your-username",
"password": "your-password",
"ssl": true
}MongoDB
{
"connectionString": "mongodb+srv://user:pass@cluster.mongodb.net/mydb"
}Step 3: Select Tables
After connecting, Ziyarn discovers your tables. For each table:
- Enable the table — toggle it on
- Map fields — select which columns contain:
- Product name, description, price, image
- Order ID, customer email, status, amount
- Set options:
includeProducts— sync as product catalogincludeOrders— display in orders dashboard
Step 4: Test Connection
Click Test & connect to verify:
- Database is reachable
- Tables are accessible
- Field mappings are correct
Table Configuration
You choose which tables to sync. Ziyarn then works out the columns itself —
there is no mapping screen to fill in. Only tables in the public schema are
discovered.
Products Table
A table is treated as a product catalog when it has a name column and a price column. The names it recognises:
| Field | Recognised by | Example |
|---|---|---|
| Name | a column ending in name, title or label | name, product_name, title |
| Price | a column containing price, amount, cost, rate or fare | price, amount |
| Description | a column containing description or body | description |
| Stock | a column containing stock, available or availability | in_stock |
| Key | the table's primary key, or a column containing id or sku | id, sku |
A price stored in cents (an integer) is used as-is; a price stored in major
units (a decimal) is converted. Email and username columns are ignored when
looking for the product name, so a table with both name and email still
syncs correctly.
Orders Table
Orders are detected the same way:
| Field | Recognised by | Example |
|---|---|---|
| Customer email | a column containing email | email, customer_email |
| Amount | a column containing total, amount or price | total, amount |
| Status | a column containing status or state | status |
| Description | a column containing description or notes | notes |
| Created at | a date column | created_at |
| ID | a column containing id or order | id, order_id |
How It Works
Product Lookups
When a visitor asks about products, your agent:
- Receives the question
- Queries your database for matching products
- Returns formatted results with images and prices
- Can process payments for selected products
Example conversation:
Visitor: "What laptops do you have?"
Agent: "I found 3 laptops in our catalog:
- MacBook Pro 14" — $1,999
- Dell XPS 15 — $1,499
- ThinkPad X1 Carbon — $1,299
Would you like details on any of these?"
Order Tracking
When includeOrders is enabled:
- Orders appear in Dashboard → Orders
- Filter by source (chat vs database)
- View customer details and status
- Track revenue from chat sales
Real-Time Data
The agent queries your database in real-time:
- No caching delays
- Always shows current stock/availability
- Updates reflected immediately
Connection Security
SSL/TLS
Always use SSL connections in production:
- Neon: SSL required (enabled automatically)
- Supabase: SSL required (enabled automatically)
- PlanetScale:
ssl: true(required) - MongoDB Atlas:
ssl: true(default)
Credentials
- Credentials are encrypted at rest
- Connections use your database's native auth
- No data is stored by Ziyarn — queries run live
IP Whitelisting
If your database uses IP whitelisting, add Ziyarn's IP addresses:
- Contact support for current IP list
- Or use a connection pooler with a static IP
Troubleshooting
Connection Timeout
Error: Connection timed outSolutions:
- Check host and port are correct
- Verify database is running
- Check firewall rules
- Ensure SSL is enabled if required
Authentication Failed
Error: Authentication failed for userSolutions:
- Verify username and password
- Check user has necessary permissions
- Ensure user can connect from external IPs
Table Not Found
Error: relation "products" does not existSolutions:
- Verify table name is correct (case-sensitive)
- Check table is in the selected schema
- Ensure user has SELECT permission
Slow Queries
If product lookups are slow:
- Add indexes on searched columns (name, description)
- Limit result set size in table configuration
- Use specific column mappings instead of
SELECT *
Network Issues
If connection is intermittent:
- Check database provider status page
- Verify no network restrictions on your machine
- Try connecting from a different network