Skip to Content

PostgreSQL

The PostgreSQL service gives your simulation a real PostgreSQL database seeded from your schema. Your agent connects to it with a standard PostgreSQL connection string, or — for apps built on Supabase — through a Supabase/PostgREST-compatible HTTP/RPC surface.

Most apps do three things: enable the service, point it at a schema file, and configure the app’s connection.

Enable the service

.veris/veris.yaml
services: - name: postgres

Without further config, the database starts empty.

Provide a schema file

Most apps need tables, functions, or RPCs to exist before startup. Point schema_path at one concrete SQL file in the image:

.veris/veris.yaml
services: - name: postgres config: schema_path: /agent/db/schema.sql

At startup Veris reads schema_path, exports it as SCHEMA_PATH, and applies that SQL file before seeding. If the path is missing or the file isn’t in the image, the database starts empty.

Copy the file into the image at that stable path:

.veris/Dockerfile.sandbox
ARG VERIS_BASE FROM ${VERIS_BASE} COPY . /agent COPY db/schema.sql /agent/db/schema.sql WORKDIR /app

Don’t have a single schema.sql? Most teams generate or export one — pg_dump --schema-only, a Supabase schema dump, or an ORM codegen step. Commit the generated file for Veris to pick up. No need to hand-write it.

Migrations directories

Veris doesn’t apply a migrations directory automatically. Produce one consolidated SQL file from your existing tooling (migrations, seeds, generated snapshots) during your build, copy it into the image, and point schema_path at it.

Connect your app

Raw PostgreSQL clients

Declaring postgres in services is enough — the sandbox auto-injects DATABASE_URL into your agent’s environment pointing at the local instance with the veris database:

.veris/veris.yaml
services: - name: postgres config: schema_path: /agent/db/schema.sql # DATABASE_URL=postgresql://postgres:postgres@localhost:5432/veris # is set automatically — no need to repeat it in agent.environment.

If you set POSTGRES_PASSWORD on the service config, the auto-injected URL uses that password instead. To point at a different host, database, or driver, set DATABASE_URL explicitly under agent.environment — user-provided values always win.

Supabase clients

For apps that use @supabase/supabase-js (including RPC calls like /rpc/execute_sql), enable the supabase preset:

.veris/veris.yaml
services: - name: postgres config: schema_path: /agent/db/schema.sql preset: supabase

NEXT_PUBLIC_SUPABASE_URL, NEXT_PUBLIC_SUPABASE_ANON_KEY, and SUPABASE_SERVICE_ROLE_KEY are auto-injected on top of the usual DATABASE_URL.

With supabase_auth: true, Veris generates a mock Supabase URL and JWT-style keys at runtime and injects them into the agent’s environment:

  • NEXT_PUBLIC_SUPABASE_URL
  • NEXT_PUBLIC_SUPABASE_ANON_KEY
  • SUPABASE_SERVICE_ROLE_KEY

Don’t set these manually in veris.yaml or the console — Veris won’t overwrite user-set values, and the wrong values break the mock connection.

Troubleshooting

No SCHEMA_PATH configured; database 'veris' is emptyschema_path isn’t set, or the file isn’t in the image at that path.

Supabase client reports its database tool is unavailable — check that supabase_auth: true is set, that you haven’t overridden the injected Supabase env vars, and that your schema actually defines the tables and RPC functions your app calls.