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

# Database

> Learn how to use Replit's built-in SQL database to store and retrieve data for your app.

Replit Database uses a fully-managed SQL database that lets you add persistent data storage to your Replit App from the Project Editor.

> [!NOTE]
>
> The fastest way to get started is to ask **Agent** to add a database to your app. Agent will set up the integration, create the database schema, and update your app to store and retrieve data.

![screenshot of the database editor](https://mintcdn.com/replit/tlGd6oyGOaUUeRxr/images/databases/database-editor.jpg?fit=max\&auto=format\&n=tlGd6oyGOaUUeRxr\&q=85\&s=18a9293165cc5d42db6c61ea572780d1)

## Features

The Replit Database tool provides the following features:

* **Database tools**: Run queries, manage database schema, and visualize data with the built-in SQL tools
* **Time travel**: Restore your development database to an **Agent** checkpoint within the available history. See [Data recovery](https://docs.replit.com/features/data-and-storage/data-recovery.md)
* **Free storage**: Each Replit App includes 20GB of free development database storage, or 50GB on Pro and Enterprise plans. Development database storage is capped at this limit: you can't exceed it, and there are no overage charges.
* **Environment variables**: Use environment variables in your Replit App to securely access the database

> [!NOTE]
>
> Prior to December 4th, 2025, the development database was hosted on Neon and has a few crucial differences.
> See [Development and production](https://docs.replit.com/features/data-and-storage/development-and-production.md#legacy-development-database) for more details.

## Usage

[How to use Databases on Replit](https://www.youtube.com/embed/zbyRuoPNIc8)

You can access the Replit Database tool directly in the Project Editor.
The following sections guide you through setting up and managing your Database.

> [accordion] How to access the Database tool
>
> 1. Open the **Tools** pane and select **Database** under **Replit Cloud**.
> 2. The landing view lists your databases. Select one, such as **Development Database**, to open it.

The Database tool is organized around your list of databases. The landing view shows each database with its storage use, plus your current **Billing Period** and **Hours of Compute Used**. Opening a database gives you the following tabs:

* **Overview**: The tables in your database.
* **My Data**: Browse and edit rows, or run SQL queries.
* **Monitoring**: The queries running right now, and the ones costing the most time. Production databases only.
* **Settings**: The connection string, storage usage, and connection details.

### Add a database

All Replit Apps come with a database by default. You can access it by selecting the ![PostgresSQL database icon](https://mintcdn.com/replit/rJldsgYVucXB_6kW/images/icons/postgres.svg?fit=max\&auto=format\&n=rJldsgYVucXB_6kW\&q=85\&s=68fc78519888560040eb7096f68e76df) **Database** tool in the Project Editor.

You can integrate the database with your Replit App by asking the **Agent** to add a PostgreSQL database to your Replit App,
including details on what data your Replit App should store. The Agent will create the database schema
and update your app to communicate with the database.

### Security features

When you add a database integration using **Agent**, it adds an Object-Relational Mapper (ORM)
that handles all database communications with built-in security.

This ORM layer, combined with Agent's security best practice implementation, protects your app from
exploits through the following features:

* **Schema validation**: Verifies data conforms to expected formats
* **Data sanitization**: Automatically cleans up builder input to prevent SQL injection attacks

## Next steps

* [Development and production](https://docs.replit.com/features/data-and-storage/development-and-production.md): Your two databases, the infrastructure upgrade, and the legacy Neon comparison.
* [Work with your data](https://docs.replit.com/features/data-and-storage/work-with-your-data.md): Browse, edit, and query your data.
* [Connection details](https://docs.replit.com/features/data-and-storage/connection-details.md): Credentials and external tools.
* [Data recovery](https://docs.replit.com/features/data-and-storage/data-recovery.md): Restore development or production data.
