> ## Documentation Index
> Fetch the complete documentation index at: https://docs.repl.it/llms.txt
> Use this file to discover all available pages before exploring further.

# Development and production databases

> Understand your app's two databases: the development database you build with and the production database that serves your published app.

Every Replit App works with two databases. The **development database** is where you and Agent experiment while building. The **production database** stores the live data that powers your published app, keeping your real-world data safe while you keep building.

![Production database management interface](https://mintcdn.com/replit/tlGd6oyGOaUUeRxr/images/databases/production-databases.jpg?fit=max\&auto=format\&n=tlGd6oyGOaUUeRxr\&q=85\&s=b60de03dc3f59d971894d1795033cc6b)

## How they compare

| Aspect | Development database | Production database |
| - | - | - |
| **Purpose** | Experimentation and feature development | Serving real users and storing business data |
| **Data** | Test data, dummy records, small datasets | Real user data, business-critical information |
| **Created** | Automatically with every Replit App | When you publish your app |
| **Agent** | Agent can create and modify tables | Agent can read it through a read replica but can't change it |
| **Changes** | Frequent schema changes, rapid iteration | Careful, planned changes applied when you publish |
| **Billing** | Included free with every Replit App | Compute usage and storage |

> [!NOTE]
>
> Agent is not able to modify the production database. This restriction is in place so that your production database stays safe.
>
> Agent can make edits to your development database. At the time of publishing, any changes you've made with Agent to the structure of your development database (adding and deleting columns or tables) are applied to your production database.
>
> You can manually edit your production data: open the **Database** tool, select the production database, open **My Data**, and turn on **Enable Editing**.

> [!NOTE]
>
> Publishing uses drizzle-kit to apply changes to tables, columns, indexes, constraints, views, and row-level security policies. It doesn't copy domains, functions, procedures, triggers, or grants, and has limited support for roles. See [Unsupported database objects](https://docs.repl.it/help/troubleshooting/databases.md#unsupported-database-objects).

## Create a production database when you publish

Your published app gets its own production database, separate from the development database you use while building.

* **Current infrastructure (Helium)**: Replit automatically creates a production database when you publish, provided your development database contains data.
* **Legacy Neon development databases**: You create the production database from the publish settings. Open **Database settings** while publishing, turn on **Create production database**, and optionally turn on **Set up your production database with your current development data** to copy your development data across.

![First Publish pane with Advanced settings expanded, automatic production database creation selected, and Set up your production database with your current development data checked](https://mintcdn.com/replit/NxrdpRj_2lsFxkvM/images/databases/first-publish-database-settings.webp?fit=max\&auto=format\&n=NxrdpRj_2lsFxkvM\&q=85\&s=d69d55a080865587ebcff7506d731c18)

First publish: Publishing → Advanced settings → Database settings. Deployment secrets section hidden.

> [!WARNING]
>
> Only copy development data into production if that data is safe to use in your live app. Development data can include test accounts, sample records, or incomplete content.

After publishing, your published app uses the production database while the Project Editor keeps using the development database, so future development changes don't directly modify live data.

## Find which database your app uses

In almost every case, your published app uses its Replit-managed production database: the one listed as **Production Database** in the **Database** tool.

Both databases use a variable called `DATABASE_URL`, but each environment has its own value:

* **Project Editor**: In your workspace, the Shell, and Agent's sessions, `DATABASE_URL` points to the development database. Replit connects it automatically, so on [current infrastructure](#legacy-development-database) it doesn't appear in [**Secrets**](https://docs.repl.it/core-concepts/project-editor/app-setup/secrets.md).
* **Published app**: When you publish, your app gets a separate `DATABASE_URL` that points to the production database.

> [!NOTE]
>
> Seeing `REPLIT_ENVIRONMENT=production` in the Shell doesn't mean your workspace uses the production database. That variable describes Replit's platform, not your app. Your published app runs with `REPLIT_DEPLOYMENT=1`.

### Ask Agent to check

Agent can check your code and Secrets, and for most apps it can look at your production data without changing it. Agent reads production through a **read replica**: a read-only copy of your production database that's kept up to date. Very recent changes can take a moment to appear there. A read replica isn't the same as a [deployment preview](#test-changes-with-a-deployment-preview), which is a separate, temporary copy for testing changes before you publish.

Paste this prompt into Agent:

```text Prompt wrap theme={null}
Check which database my app uses, without showing any secret values or changing anything:
1. Find the environment variable my code reads to connect to its database (for example DATABASE_URL) and show me the file and line.
2. Check whether my Secrets include a DATABASE_URL I added myself or any other database connection, and list only the names.
3. Run a read-only query on my production database: list its tables and show the five newest rows in my main table, so I can compare them with my live app.
```

If all three checks pass, your published app uses its Replit-managed production database. That means your code reads `DATABASE_URL`, Secrets has no other database connection, and the newest rows match your live app.

### Check in the Database tool and Publishing

**1. Open your production database**

In the **Database** tool, open the database menu next to **All Databases** and select **Production**.

![Database tool with the database menu open and Production highlighted](https://mintcdn.com/replit/0F3Y9ZQ8dk8HCiaZ/images/databases/find-your-database/select-production-database.png?fit=max\&auto=format\&n=0F3Y9ZQ8dk8HCiaZ\&q=85\&s=ce3217c589c6e94a49b5da103b7cf72a)

**2. Find a record from your live app**

Open **My Data** and look for something you recently created in your published app, such as a new account or order. If you can see it, your published app writes to this database. Production opens in read-only mode, so browsing it is safe.

![Production Database My Data tab showing a customers table with the newest row highlighted](https://mintcdn.com/replit/0F3Y9ZQ8dk8HCiaZ/images/databases/find-your-database/production-live-data.png?fit=max\&auto=format\&n=0F3Y9ZQ8dk8HCiaZ\&q=85\&s=ea801854d38d36fc629ab832f26d078c)

**3. Compare the connection settings**

Open the production database's **Settings** tab and find **Connection string**. Then open **Publishing**, select **Adjust settings**, and find `DATABASE_URL` under **Production app secrets**. Reveal each value and check that both point to the same host. For most apps, that means the same endpoint ID, the part that starts with `ep-`. A pooled address adds `-pooler` after the ID, so the full strings don't have to match exactly.

![Production Database Settings tab with the Connection string highlighted and an example showing where the endpoint ID appears](https://mintcdn.com/replit/0F3Y9ZQ8dk8HCiaZ/images/databases/find-your-database/production-connection-string.png?fit=max\&auto=format\&n=0F3Y9ZQ8dk8HCiaZ\&q=85\&s=9e2128392293ae30318f2a86b90ce920)

![Publishing settings with Production app secrets and the DATABASE\_URL row highlighted](https://mintcdn.com/replit/0F3Y9ZQ8dk8HCiaZ/images/databases/find-your-database/production-app-secrets.png?fit=max\&auto=format\&n=0F3Y9ZQ8dk8HCiaZ\&q=85\&s=19e39c4b8e94feeb43053669f934bd94)

> [!WARNING]
>
> Both values include your database password. Compare them yourself; don't paste them into a chat, support ticket, or screenshot.

**4. Check Secrets for another database**

Open **Secrets**. Replit's built-in connection isn't listed there. If you see a `DATABASE_URL` you added yourself, or another database connection such as `SUPABASE_DATABASE_URL`, your app may use that database instead. Ask Agent which one your code reads. A `NEON_DATABASE_URL` secret is your previous development database connection, saved during the [database infrastructure upgrade](#database-infrastructure-upgrade). Your app only uses it if your code reads it.

![Secrets pane with two database connection secrets highlighted](https://mintcdn.com/replit/0F3Y9ZQ8dk8HCiaZ/images/databases/find-your-database/secrets-database-connections.png?fit=max\&auto=format\&n=0F3Y9ZQ8dk8HCiaZ\&q=85\&s=8c6c3ead28275fc8aec84d7db61aa9a9)

### What the results mean

| What you see | What it means |
| - | - |
| Your code reads `DATABASE_URL`, Secrets has no other database connection, and your live records appear in **Production Database** | Your published app uses its Replit-managed production database. This is the case for almost every app. |
| A `DATABASE_URL` you added in Secrets, or code that reads another database variable | Your app connects to that database. The Database tool only shows databases Replit manages for you. |
| No **Production Database** in the Database tool | Your app doesn't have a Replit-managed production database yet. Replit creates one when you publish. If your app is already published and uses a database, check Secrets for one you added. |
| Your development and production connection strings have the same endpoint ID | Your app may still use a legacy setup where development and production share one database. See [Fix a published app using a shared database](https://docs.repl.it/features/data-and-storage/shared-database-migration.md). |
| Two projects, such as a remix, show the same development connection string | Each project still has its own development database. The built-in connection uses the same address inside every project, so matching values don't mean shared data. |

These checks show how your app is set up. If your live app still shows data you don't expect, ask Agent to find where your code reads and writes that data.

## Connection pooling

By default, production databases do not have connection pooling enabled. Your app connects directly to the database using the `DATABASE_URL` connection string, so most frameworks should manage their own client-side connection pool.

> [!NOTE]
>
> Each Neon project includes a direct and a pooled connection string. A direct connection string looks like `postgresql://neondb_owner:<password>@<host>.<region>.neon.tech/<db>?sslmode=require`.
>
> To use the pooled connection, append `-pooler` to the host: `postgresql://neondb_owner:<password>@<host>-pooler.<region>.neon.tech/<db>?sslmode=require`.

If a production connection string was exposed, [regenerate your production database credentials](https://docs.repl.it/features/data-and-storage/connection-details.md#regenerate-production-database-credentials).

## Making safe changes to your production database

When you publish updates that include database changes, Replit walks you through the migration in the Publish pane. It flags changes that could remove data, lets you test your app against a migrated copy of production, and applies the changes only after you approve. For the full flow, see [How Publish updates your production database](https://docs.repl.it/features/data-and-storage/publish-database-changes.md).

> [!NOTE]
>
> You may notice a brief downtime for your published app during publishing. Database changes sometimes require stopping your app temporarily to prevent conflicts and protect your data while the changes are applied.

The following types of changes typically require care:

* **Removing columns or tables** that still contain data
* **Changing column data types**, which can fail if existing values don't convert
* **Adding required fields** without default values to tables that already have rows
* **Renaming tables or columns**: confirm the rename when Publish asks, or the data is dropped
* **Adding unique constraints** to tables whose existing rows may violate them

### Test changes with a publish preview

A publish preview is a temporary, isolated copy of your production environment where you can test database changes and application updates before they affect real users. Use it to:

* Verify your app still works with the database changes applied, across your major user flows
* Confirm existing data was properly migrated and new fields contain expected values
* Watch for performance regressions in query response times

To create one, select **Create preview deploy** in the Publish pane after your migration is validated. See [Preview your app on the migrated copy](https://docs.repl.it/features/data-and-storage/publish-database-changes.md#step-5-optional-preview-your-app-on-the-migrated-copy).

## Billing and resource usage

Production database charges include compute usage and storage. The database enters an idle state after five minutes of inactivity, pausing compute billing until another query arrives. Stored data continues to incur storage charges while compute is idle.

The Database tool's landing view shows your **Billing Period** and **Hours of Compute Used**. For per-database storage, open the database's **Settings** tab. To see usage across every Replit App, go to [Account usage](https://replit.com/settings/usage) in **Settings** and expand the **PostgreSQL Storage** and **PostgreSQL Compute** rows.

To learn how Replit charges for database usage, see [Deployments and Database Billing](https://docs.repl.it/billing/about-usage-based-billing.md#databases).

## Removing a production database

> [!WARNING]
>
> Back up important data before removing a production database. Removal disables access to the database and starts a seven-day soft-delete period.
>
> To recover a database removed by mistake, [contact Replit Support](https://replit.com/support) within seven days. Include your project URL and when you removed it, but don't include credentials. After seven days, the database is permanently deleted.

Recovering a removed database is different from restoring deleted rows or tables. For data changes in an existing database, see [Data recovery](https://docs.repl.it/features/data-and-storage/data-recovery.md).

> [accordion] How to remove a database
>
> From the **Database** tool:
>
> 1. Select the database, then open the **Settings** tab
> 2. Select **Remove database** and confirm by selecting **Yes, Remove database**

## Legacy development database

Prior to December 4th, 2025, the development database was hosted on [Neon](https://neon.com/). All new development databases are hosted on Replit's own infrastructure (Helium). You can check which one your app uses in the **Settings** tab: a `DATABASE_URL` containing `neon.tech` means legacy Neon; `helium` means current infrastructure.

| **Feature** | **Replit (current)** | **Neon (legacy)** |
| - | - | - |
| **Hosting** | Hosted on Replit's own infrastructure | Hosted on Neon (third-party provider) |
| **Billing** | Included for free with every Replit App | Usage-based billing. See [Publishing and Database Billing](https://docs.repl.it/billing/about-usage-based-billing.md#databases) for more details. |
| **Restore capability** | Restore your database to any checkpoint using the [rollback feature](https://docs.repl.it/features/data-and-storage/data-recovery.md) | Point-in-time restore (PITR): recover to any point within the backup retention window. |
| **Connection security** | Only accessible from within your app; never exposed publicly. | Used a full connection string. If leaked, anyone could access and modify your database. |
| **Remixing behavior** | [Remixing](https://docs.repl.it/build/remix-an-app.md) creates a new development database with copied data for isolation and security. | Remixing reuses the same database for all copies, so changes in remixes could affect the original app. |
| **Database creation** | Automatically created for each Replit App. | Required explicit setup. |
| **Publishing workflow** | Publishing creates a separate production database for isolation between environments. | Development and production shared the same database, so unintended development changes could affect production apps. |

## Database infrastructure upgrade

Replit is upgrading development databases from Neon to **Helium**, Replit's own managed PostgreSQL infrastructure. The upgrade is automatic, runs once per app when you open it in the Project Editor, and preserves all your data.

What changes:

* **Lower latency and more storage**: Your database runs on Replit infrastructure alongside your app, and your storage limit increases from 10 GB to 20 GB, or to 50 GB on Pro and Enterprise plans.
* **Same database engine**: Helium uses PostgreSQL 16, the same version as Neon. Your queries, schemas, and data work the same way.
* **Connection updates automatically**: `DATABASE_URL` is updated to point to Helium. Your previous Neon connection string is saved as `NEON_DATABASE_URL` in your Secrets for reference.
* **Individual PG variables removed**: `PGHOST`, `PGPORT`, `PGUSER`, and `PGPASSWORD` are removed. Use `DATABASE_URL` instead.

During the upgrade you'll see an **"Upgrading your database"** progress screen. It can take from a few minutes to a few hours for large databases; you can close the tab and come back. If the upgrade encounters an issue, it's automatically skipped and retried the next time you open your app. When it completes, a confirmation dialog appears.

For most builders, no action is needed afterward. Review the following if they apply:

* **Hardcoded Neon connection strings**: Update code that references a `neon.tech` connection string to use the `DATABASE_URL` environment variable instead.
* **Custom PostgreSQL roles**: Roles and permissions migrate automatically, but role passwords can't be copied. Reset passwords for custom roles on the new database.

### SSL connection errors after the upgrade

If you see errors like `The server does not support SSL connections`, your connection code is forcing an SSL handshake. Neon required SSL; Helium runs locally alongside your app and doesn't use it. Make the SSL setting conditional on the environment:

```js JavaScript theme={null}
// Before (breaks after upgrade)
const pool = new Pool({
  connectionString: process.env.DATABASE_URL,
  ssl: { rejectUnauthorized: false },
});

// After (works in both development and production)
const pool = new Pool({
  connectionString: process.env.DATABASE_URL,
  ssl:
    process.env.NODE_ENV === "production"
      ? { rejectUnauthorized: false }
      : false,
});
```

> [!TIP]
>
> If you use an ORM like Drizzle, Prisma, or Sequelize, check its documentation for how to configure SSL settings conditionally. The same principle applies: disable SSL for the development database and enable it for production.

### Forked apps that shared a database

Under the legacy Neon system, forking an app copied the original app's `DATABASE_URL`, so both apps and their published versions connected to the same database. Shared legacy databases were shut down on **June 8, 2026**. If your published app stopped working or lost access to its data, see [Fix a published app using a shared database](https://docs.repl.it/features/data-and-storage/shared-database-migration.md) or [contact support](https://replit.com/support).

## Next steps

* [How Publish updates your production database](https://docs.repl.it/features/data-and-storage/publish-database-changes.md): Review, test, and approve schema changes when you publish.
* [Data recovery](https://docs.repl.it/features/data-and-storage/data-recovery.md): Restore development or production data.
* [Connection details](https://docs.repl.it/features/data-and-storage/connection-details.md): Find your database's connection string.
* [Work with your data](https://docs.repl.it/features/data-and-storage/work-with-your-data.md): Browse, edit, and query your data.
