# Any Postgres

> What the engine needs from a database, what it installs in it, and how to install it by hand when your database is locked down.

Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service).  
Source: https://data.docs.sypnia.com/data/any-postgres/

For agents: Requirements: PostgreSQL 14 or later, reachable by connection string with TLS. No extensions required (gen_random_uuid is core; pg_trgm and citext used if present). Install creates schemas sypnia_auth, sypnia_data, auth (helper functions), sypnia (helpers) and roles anon, authenticated, service_role (NOLOGIN), sypnia_authenticator (LOGIN, NOINHERIT), sypnia_admin. Automatic install needs CREATEROLE and CREATE on the database (RDS master user is enough); manual mode: sypnia-data install --print-sql for a DBA. Tested targets: RDS, Aurora, Cloud SQL, Azure, Neon, Supabase, Crunchy, self-managed.

The engine works with **any PostgreSQL 14 or later** it can reach with a connection string: Amazon RDS and Aurora, Google Cloud SQL, Azure Database for PostgreSQL, Neon, Supabase, Crunchy Bridge, or your own server.

## What it installs

| Thing                                         | What for                                                                                                        |
| --------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| Schema `sypnia_auth`                          | users, identities, sessions, refresh tokens, one-time tokens, OAuth clients, PATs, API keys, rate limits, audit |
| Schema `sypnia_data`                          | migrations, SQL audit, settings, signing keys (encrypted)                                                       |
| Schemas `auth` and `sypnia`                   | only the helper functions your policies call                                                                    |
| Roles `anon`, `authenticated`, `service_role` | the roles requests run as (no login)                                                                            |
| Role `sypnia_authenticator`                   | the engine's login for the Data API: no rights of its own, member of the three roles above                      |
| Role `sypnia_admin`                           | owner of your schemas; the SQL endpoint and migrations run as it                                                |

No extension is required. If `pg_trgm` or `citext` are present, user search uses them.

## What it needs

For the automatic install, a user that can **create roles** (`CREATEROLE`) and **create schemas** in the database. On Amazon RDS the master user is enough. The engine **never** needs a superuser.

```bash
DATABASE_URL="postgres://admin:…@db.example.com:5432/app?sslmode=verify-full" sypnia-data install
```

## Locked-down databases

If no user can create roles, print the SQL and give it to whoever administers the database:

```bash
sypnia-data install --print-sql > sypnia-install.sql
```

Then start the engine with two connection strings: one as `sypnia_authenticator` (requests) and one as `sypnia_admin` (SQL and migrations).

## Connections

Use TLS (`sslmode=require`, better `verify-full`). The engine keeps a small pool per project: how small, and how to put a pooler in front, is in [Scaling and connection pooling](https://data.docs.sypnia.com/architecture/scaling-and-pooling).
