# Databases

> Provision and manage databases on Tarout

# Databases

Tarout lets you provision managed PostgreSQL databases in a few clicks. Databases run on Tarout's infrastructure with connection pooling, TLS for external connections, and usage insights in the dashboard.

## Supported Databases

| Database | Version | Use Case |
|----------|---------|----------|
| **PostgreSQL** | 16 | Relational data, full-text search, JSON |

> MySQL, MariaDB, MongoDB, and Redis are on the roadmap and are not yet available.

## Creating a Database

1. Go to **Databases** in the sidebar.
2. Click **New Database**.
3. Choose a plan tier.
4. Optionally enter a name and description. If you leave the name blank, Tarout generates one.
5. Click **Create Database**.

There is no version or credential to pick: every database runs PostgreSQL 16, and Tarout generates the database name, user, and password for you. Your database is ready within seconds, and its connection details are shown on the database detail page.

## Connecting to Your Database

### Connection String

Copy the connection string from the database detail page. From the CLI, `tarout db info <db> --json` returns it as `externalConnectionString` (the plain `tarout db info` output masks the password):

```bash
tarout db info <db> --json
```

It already carries the host, port, database name, user, password, and `sslmode=require`, so use it as-is instead of assembling one by hand. Connections from outside Tarout always use TLS. For verified TLS, download the CA certificate from the database page and replace `sslmode=require` with `sslmode=verify-full&sslrootcert=/path/to/tarout-postgres-ca.pem`.

### From Your Application

When a database is attached to an app on Tarout, the connection variables (`DATABASE_URL`, `DIRECT_DATABASE_URL`, `PGHOST`, `PGPORT`, `PGUSER`, `PGPASSWORD`, `PGDATABASE`) are written into the app's environment for you.

For an app hosted anywhere else, add the connection string you copied as an [environment variable](https://tarout.sa/docs/applications/environment-variables):

```bash
DATABASE_URL="<connection string copied from the dashboard>"
```

## Backups

Tarout backs up its shared database hosts daily for disaster recovery. Only Tarout can restore those host backups, and only for a whole host, so they are not restore points for a single database.

To keep your own backups of a database, send them to storage you control:

1. Add a backup destination (any S3-compatible bucket) under **Settings → Backup destinations**.
2. Open the database's **Backups** tab and create a schedule that writes to that destination.

Schedules run on a cron expression and can keep only the newest N backup files. From the same tab you can also run a backup on demand and restore from a saved file. Backups to your own storage are available for databases on paid tiers (Starter, Standard, Pro). See [PostgreSQL](https://tarout.sa/docs/databases/postgres#backups) for the CLI commands.

## Learn More

- [PostgreSQL](https://tarout.sa/docs/databases/postgres)
- [MySQL](https://tarout.sa/docs/databases/mysql) (not available yet)

---

## Every Tarout agent guide

- [Start Here (Agents)](https://tarout.sa/docs/for-ai/start.md)
- [Overview](https://tarout.sa/docs/for-ai.md)
- [Deploying an app](https://tarout.sa/docs/for-ai/deploy.md)
- [Databases](https://tarout.sa/docs/for-ai/database.md)
- [Object storage](https://tarout.sa/docs/for-ai/storage.md)
- [Custom domains](https://tarout.sa/docs/for-ai/domains.md)
- [Plans and upgrades](https://tarout.sa/docs/for-ai/billing.md)
- [Troubleshooting](https://tarout.sa/docs/for-ai/troubleshoot.md)
- [Agent Onboarding](https://tarout.sa/docs/for-ai/onboarding.md)
- [CLI Reference](https://tarout.sa/docs/for-ai/cli-reference.md)
- [CLI JSON Schema](https://tarout.sa/docs/for-ai/cli-json-schema.md)

Whole corpus in one file: https://tarout.sa/llms-full.txt · index: https://tarout.sa/llms.txt
Any docs page is raw markdown at the same URL + `.md`. Short link to the entry point: https://tarout.sa/deploy.md
