GLOSSARY

What are ephemeral environments?

Ephemeral environments are short-lived, disposable development and testing environments created on demand and destroyed after use. Each environment is fresh, isolated, and contains everything needed to run and test an application — including the database. They replace persistent staging environments that drift from production.

HOW IT WORKS

How ephemeral environments works

Ephemeral environments are created automatically by CI/CD pipelines, preview deployment platforms, or developer commands. A typical ephemeral environment includes:

Application layer — deployed as a container or serverless function from the branch's code. Platforms like Vercel, Netlify, and Railway handle this automatically for every pull request.

Database layer — this is the hard part. The application needs a database with real schemas and (ideally) real data. Traditional approaches use empty databases with seed scripts, which miss production edge cases. Copy-on-write branching solves this by creating a full database copy in seconds.

Lifecycle management — environments are created when a PR is opened or a branch is pushed, and destroyed when the PR is merged or closed. No persistent infrastructure accumulates.

The key insight is that ephemeral environments shift the cost model: instead of maintaining N staging environments 24/7, you create them on demand and pay only for active usage. Ardent's auto-suspend feature takes this further by scaling database branch compute to zero when idle, so even long-lived preview environments cost almost nothing when unused.

WHY IT MATTERS

Why ephemeral environments matters

Persistent staging environments are one of the biggest sources of developer friction. Shared staging causes merge conflicts, data pollution, and flaky tests — and it still drifts from production. Developers routinely wait hours or days for staging environments to become available.

Ephemeral environments eliminate these problems. Every PR gets a fresh environment. No conflicts. No stale data. No waiting. When the PR is merged, the environment is destroyed.

For AI coding agents, ephemeral environments are even more critical. An AI agent that modifies a database needs its own isolated copy for every task. You can't share a staging database between 5 concurrent AI agents — they'd corrupt each other's state. Ephemeral database branches give each agent its own copy, created in seconds and destroyed when done.

EXAMPLE

ephemeral environments in practice

# 1. PR opened → create ephemeral environment
- name: Create database branch
  run: |
    ardent branch create pr-${PR_NUMBER}
    # ✓ Branch created in 5.2s
    # postgres://branch-pr-42.db.tryardent.com:5432/mydb

- name: Deploy preview app
  run: |
    DATABASE_URL=$(ardent branch url pr-${PR_NUMBER})
    vercel deploy --env DATABASE_URL=$DATABASE_URL

# 2. Developers and AI agents test on the preview
# Each has their own database with real production data

# 3. PR merged → destroy ephemeral environment
- name: Cleanup
  if: github.event.action == 'closed'
  run: |
    ardent branch delete pr-${PR_NUMBER}
    vercel remove pr-${PR_NUMBER}

The workflow above creates a complete ephemeral environment — application + database — for every pull request. The database branch contains real production data, so preview deployments show real behavior. When the PR is closed, everything is cleaned up automatically.

RELATED CONCEPTS

Related terms

Database Branching
Database Sandbox
Copy-on-Write
Change Data Capture
FAQ

Frequently asked questions

What are ephemeral environments?

Short-lived, disposable dev/test environments created on demand and destroyed after use. Each environment is fresh, isolated, and includes a database with real data.

Why are databases the hard part?

Application code deploys in seconds (containers, serverless). Databases contain state and take hours to copy via dump/restore. Copy-on-write branching creates database copies in seconds without duplicating storage.

How does Ardent help with ephemeral environments?

Ardent creates database branches in under 6 seconds with real production data. Each ephemeral environment gets its own branch. Branches auto-suspend when idle and are deleted when the environment is destroyed.

Try ephemeral environments with Ardent

Create isolated database branches in under 6 seconds. No risk to production.

Read the docsBook a demo