Managed Databases let you provision real database instances and attach them to preview environments with a single CLI flag. No credentials to copy, no manual setup — prev handles provisioning, internal access, connection injection, and cleanup.

Overview

Each managed database runs on the Prev database host with PostgreSQL, MariaDB, and MongoDB pre-installed. When you create a database through the Dashboard, prev provisions it locally and keeps the underlying credentials internal. Attached previews receive a ready-to-use DATABASE_URL environment variable.

FeatureDetails
Supported EnginesPostgreSQL, MariaDB, MongoDB
LocationSame Prev node as preview environments
AccessInternal preview access only
Storage Limit1 GB soft limit per database
BackupsDaily at 3 AM UTC, 7-day retention
Pricing$5 per database/month (add-on)
AvailabilityIndividual and Teams plans

Creating a Database

  1. Go to Dashboard → Databases
  2. Click Create Database
  3. Enter a name (lowercase, alphanumeric, hyphens allowed)
  4. Select the database engine: PostgreSQL, MariaDB, or MongoDB
  5. Click Create

Provisioning takes approximately 30 seconds. The database status changes from "creating" to "active" once ready. The Dashboard lists the database so you can attach it to previews by name.

Attaching Databases to Previews

Use the --db flag when deploying a preview to attach one managed database:

prev create . --db mypostgres

prev resolves the database credentials internally at deploy time and injects a DATABASE_URL environment variable into your preview container. Managed databases are not exposed for direct public access, and raw host, username, and password details are not shown in the Dashboard.

Because DATABASE_URL has a single value, attach the database your app should use for that preview. If your app needs several data stores at once, create separate previews or choose one primary managed database per preview.

Environment Variables

For an attached managed database, prev injects one customer-facing environment variable:

VariableExample Value
DATABASE_URLpostgresql://..., mysql://..., or mongodb://...

Your application should read DATABASE_URL at runtime, just like it would on most production platforms. Frameworks like Rails, Django, Prisma, Laravel, and many ORMs use this variable by default.

// Prisma, many ORMs, and most frameworks read this automatically.
const databaseUrl = process.env.DATABASE_URL

Database Admin

The Dashboard includes a built-in database admin for active managed databases, so you can inspect and repair preview data without exposing credentials to the browser.

  • Browse data: open tables or MongoDB collections and load their rows or documents directly.
  • Inspect schema: view tables, columns, nullability, defaults, and key metadata for relational databases; view collections and sample fields for MongoDB.
  • Run SQL: execute SQL against PostgreSQL or MariaDB and see database errors in the UI.
  • Import and export: upload or download table data; for MongoDB, paste JSON or import files into a collection.
  • Manage MongoDB collections: create and delete collections from the admin sidebar.
  • Operations: clear data or reset the database contents without deleting the managed database itself.

Use the admin for preview and test data workflows. Production-style application access should still go through the injected DATABASE_URL inside the preview runtime.

Using with Deployment Templates

If you use Deployment Templates (Teams plan), you can save a database attachment as part of the template configuration. When a template specifies a database, every deployment using that template automatically attaches it — no need to pass --db every time.

To configure databases in a template:

  1. Go to Dashboard → Templates
  2. Edit or create a template
  3. In the Database field, enter the managed database name
  4. Save the template
# Deploy using a template with pre-configured databases
prev create . --template my-fullstack-app

Supported Database Engines

PostgreSQL

The most popular choice for web applications. Compatible with Prisma, TypeORM, Sequelize, Django ORM, ActiveRecord, and virtually every web framework.

  • Default port: 5432
  • DATABASE_URL uses a PostgreSQL connection URI

MariaDB

MySQL-compatible engine. Works with any MySQL driver or ORM.

  • Default port: 3306
  • DATABASE_URL uses a MySQL-compatible connection URI

MongoDB

Document database for flexible, schema-less data. Works with Mongoose, the MongoDB Node.js driver, PyMongo, and more.

  • Default port: 27017
  • DATABASE_URL uses a MongoDB connection URI

Backups

All managed databases are backed up daily at 3:00 AM UTC. Backups are retained for 7 days and stored on the same Prev database host.

  • PostgreSQL: pg_dump compressed backups
  • MariaDB: mysqldump compressed backups
  • MongoDB: mongodump compressed backups

Backup restoration is available on request via support.

Limits & Pricing

  • $5/month per database (billed as a Paddle add-on)
  • 1 GB soft limit per database — you'll receive a warning when approaching the limit, but the database won't be stopped
  • Available on both Individual and Teams plans
  • Attached previews receive DATABASE_URL; raw database credentials are not exposed in the Dashboard
  • No limit on the number of databases you can create (each is billed separately)

Deleting a Database

To delete a managed database:

  1. Go to Dashboard → Databases
  2. Click the database you want to delete
  3. Click Delete Database
  4. Confirm the deletion

Warning: Deleting a database permanently destroys all data. This action cannot be undone. Active preview environments attached to the database will lose their database connection.

CI/CD Integration

The --db flag works seamlessly in CI/CD pipelines:

name: PR Preview with Database

on:
  pull_request:
    types: [opened, synchronize]

jobs:
  preview:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install prev
        run: curl -fsSL https://prev.sh/install.sh | sh

      - name: Deploy Preview
        run: |
          prev create . --db staging-postgres \
               --subdomain pr-${{ github.event.number }} \
               --ttl 7d
        env:
          PREV_API_KEY: ${{ secrets.PREV_API_KEY }}

Every pull request gets a live preview with a real database connection. The database persists across preview redeployments, so data isn't lost when code changes are pushed.