Ziyarn Docs

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

DatabaseStatusNotes
PostgreSQL✅ Full supportNeon, Supabase, Railway, self-hosted
MySQL✅ Full supportPlanetScale, Railway, self-hosted
MongoDB✅ Full supportAtlas, self-hosted
Convex✅ Full supportConvex platform
Firebase🔜 Coming soonFirestore
Turso🔜 Coming soonLibSQL

Neon and Supabase have dedicated options that accept the provider's connection string directly.

Connecting a Database

Step 1: Go to Databases

  1. Open Domains → Select domain → Databases
  2. 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:

  1. In Neon, open your project → Connection Details.
  2. Copy the connection string (pooled or direct).
  3. 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

  1. In Supabase, open Project Settings → Database → Connection string.
  2. Copy the Transaction pooler URI (port 6543).
  3. 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:

  1. Enable the table — toggle it on
  2. Map fields — select which columns contain:
    • Product name, description, price, image
    • Order ID, customer email, status, amount
  3. Set options:
    • includeProducts — sync as product catalog
    • includeOrders — 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:

FieldRecognised byExample
Namea column ending in name, title or labelname, product_name, title
Pricea column containing price, amount, cost, rate or fareprice, amount
Descriptiona column containing description or bodydescription
Stocka column containing stock, available or availabilityin_stock
Keythe table's primary key, or a column containing id or skuid, 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:

FieldRecognised byExample
Customer emaila column containing emailemail, customer_email
Amounta column containing total, amount or pricetotal, amount
Statusa column containing status or statestatus
Descriptiona column containing description or notesnotes
Created ata date columncreated_at
IDa column containing id or orderid, order_id

How It Works

Product Lookups

When a visitor asks about products, your agent:

  1. Receives the question
  2. Queries your database for matching products
  3. Returns formatted results with images and prices
  4. Can process payments for selected products

Example conversation:

Visitor: "What laptops do you have?"

Agent: "I found 3 laptops in our catalog:

  1. MacBook Pro 14" — $1,999
  2. Dell XPS 15 — $1,499
  3. ThinkPad X1 Carbon — $1,299

Would you like details on any of these?"

Order Tracking

When includeOrders is enabled:

  1. Orders appear in Dashboard → Orders
  2. Filter by source (chat vs database)
  3. View customer details and status
  4. 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 out

Solutions:

  1. Check host and port are correct
  2. Verify database is running
  3. Check firewall rules
  4. Ensure SSL is enabled if required

Authentication Failed

Error: Authentication failed for user

Solutions:

  1. Verify username and password
  2. Check user has necessary permissions
  3. Ensure user can connect from external IPs

Table Not Found

Error: relation "products" does not exist

Solutions:

  1. Verify table name is correct (case-sensitive)
  2. Check table is in the selected schema
  3. Ensure user has SELECT permission

Slow Queries

If product lookups are slow:

  1. Add indexes on searched columns (name, description)
  2. Limit result set size in table configuration
  3. Use specific column mappings instead of SELECT *

Network Issues

If connection is intermittent:

  1. Check database provider status page
  2. Verify no network restrictions on your machine
  3. Try connecting from a different network