Docs/Guides/Adding a Database

Adding a Database

Updated Mar 29, 2026Guides

Set up PostgreSQL for your Web App.

Prerequisites

Database support requires a Web App project (not Website). You can convert a Website to Web App in Project Settings.

Enable PostgreSQL

1. Open your project

2. Go to the Integrations tab

3. Click PostgreSQL

4. XAIO provisions a managed database automatically

Dev and Prod Environments

Your project gets two separate databases:

  • Dev — For development and testing
  • Prod — For your published site

Switch between them in the Database Browser.

Database Browser

Browse your data directly in the workspace:

  • View tables and columns
  • Inspect row data
  • Run queries
  • Check schema structure

Let the AI Handle It

Just tell the AI what data you need:

  • "Create a users table with name, email, and role"
  • "Add a products table with price, description, and image URL"
  • "Create an API endpoint that returns all products sorted by price"

The AI generates:

  • Database migration files
  • SQLAlchemy models
  • API endpoints with proper error handling

Connection Details

The database connection string is automatically injected as DATABASE_URL environment variable. Your backend code connects without any manual configuration.

Migrations

Schema changes are handled through migration files. The AI creates proper versioned migrations — never modifies existing ones. Migrations run automatically when you publish.