Build

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.

Updated Markdown

In this page
  1. How do I add Postgres?
  2. How do I add Redis?
  3. How do I create my tables?
  4. Can I have extensions or several databases on one Postgres?
  5. How do I look inside a database from my computer?
  6. How do I run a one-off SQL change?
  7. Can I look at my data in the dashboard?
  8. What about Supabase?

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.

Terminal
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.

How do I run a one-off SQL change?

Terminal
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.

What about Supabase?

Supabase is a database type of its own, with Auth, an API, Realtime, Storage and Studio. See Self-hosted Supabase.

Account · Terms

We’ve updated our terms.

Please read and accept the current terms of service and privacy policy to keep using Aria.