# Postgres, Redis and databases on Aria

> Add Postgres or Redis to aria.yaml, wire the connection URL into your services, run migrations and seeds, and get a temporary login to inspect data.

Source: https://getaria.cloud/docs/databases (updated 1 November 2026)

To add a database, declare it under `databases` in `aria.yaml` and point a variable at it with `from`. Aria runs Postgres (version 16 or 17), Redis (version 7) and Supabase on your own server, and creates, connects and checks them for you. A database costs nothing extra: it runs on the server your plan already pays for.

## How do I add Postgres?

```yaml
databases:
  main:
    type: postgres
env:
  DATABASE_URL:
    services: [api]
    from: main.url
```

Aria creates the database, gives it a password, and sets `DATABASE_URL` for the `api` service. Other things you can read are `host`, `port`, `user`, `password` and `database`. Leave `version` out unless you need to pin one. Postgres addresses on Aria have no TLS, so an app that insists on SSL has to be told not to.

## How do I add Redis?

```yaml
databases:
  cache:
    type: redis
env:
  REDIS_URL:
    services: [api, worker]
    from: cache.url
```

Redis is password-protected. Use it as a cache.

## How do I create my tables?

Aria builds your schema when the app launches and on every push, so nobody runs SQL by hand. Pick one way.

**Your app's own migration command.** Put it in `migrate` on the service that owns the database:

```yaml
services:
  api:
    type: api
    port: 8080
    migrate: npx prisma migrate deploy
```

It runs once per deploy, in the newly built image, before the new version takes traffic. If it fails, the old version keeps serving. It must be safe to run again, because it also runs before restarts. The tool has to be installed in the image and the service must receive the database URL it reads.

**A folder of SQL files.** For Postgres:

```yaml
databases:
  main:
    type: postgres
    migrations: db/migrations
    seed: db/seed.sql
```

Files run in the order of their leading number, each once, and each in one transaction. Only names that start with digits and an underscore count, such as `0001_init.sql` or `20250101000000_init.sql`. Do not use `BEGIN`, `COMMIT`, `CREATE INDEX CONCURRENTLY` or `COPY ... FROM stdin`; write rows as `INSERT` statements. Never edit a migration that already ran: add a new one. The `seed` file runs once, on a new database.

## Can I have extensions or several databases on one Postgres?

Yes.

```yaml
databases:
  main:
    type: postgres
    extensions: [vector, pg_trgm]
    names: [shop, analytics]
env:
  ANALYTICS_URL:
    services: [worker]
    from: main.url
    database: analytics
```

`extensions` creates the extensions in every database. `vector` gives you pgvector. `names` adds databases on the same server, each owned by a login of the same name. `database` picks one of them for a variable.

## How do I look inside a database from my computer?

Ask for a temporary login. Aria waits for you to approve it in the app, then prints a connection URL for a database role that removes itself.

```bash
aria db url
aria db url --read-only --ttl 30
```

`--ttl` is minutes, from 10 to 480, and the default is 60. Add `--database NAME` if the app has more than one. `--owner` gives owner rights for imports. Keep the URL out of chat and out of git. The Database page has **Direct access** too, for two hours from your computer. See [Your data](https://getaria.cloud/docs/data).

## How do I run a one-off SQL change?

```bash
aria db migrate fix-users.sql
```

Aria shows the full SQL and the database in the app and runs it once, in one transaction, after you approve. Aria AI and your coding agent can ask the same thing, and it always waits for you.

## Can I look at my data in the dashboard?

Yes. **Open data** on the Database page browses and edits your tables, and **Copy database** gives you a zip with a dump. See [Your data](https://getaria.cloud/docs/data).

## What about Supabase?

Supabase is a database type of its own, with Auth, an API, Realtime, Storage and Studio. See [Self-hosted Supabase](https://getaria.cloud/docs/supabase).

Next: [Your data on Aria: tables, users, files, Archive](https://getaria.cloud/docs/data)
