Skip to content
Docs menu

Data services

Rivtor runs its own Postgres, Redis and storage on the same private network as your apps, so a query never leaves the data centre and app-to-database latency stays under 1 ms.

Data services are created when detection finds code that needs them, or when a service lists them under data in deploy.toml. Provisioning runs in parallel with the build and takes under 2 seconds. Their credentials are stored encrypted and injected as environment variables at runtime.

Injected variables

environment of a project called my-app
# Postgres
DATABASE_URL=postgresql://p_my_app:<password>@host.docker.internal:6432/p_my_app
DIRECT_DATABASE_URL=postgresql://p_my_app:<password>@host.docker.internal:6432/p_my_app
PGHOST=host.docker.internal
PGPORT=6432
PGDATABASE=p_my_app
PGUSER=p_my_app
PGPASSWORD=<password>

# Redis
REDIS_URL=redis://default:<password>@redis:6379

# R2 object storage (AWS_* aliases are set too)
S3_ENDPOINT=https://<account>.r2.cloudflarestorage.com
S3_BUCKET=rv-my-app
S3_REGION=auto
S3_ACCESS_KEY_ID=<key>
S3_SECRET_ACCESS_KEY=<secret>

Postgres 17

  • Each project gets its own database p_<slug> and its own role with the same name and a random 32-character password. Other roles cannot connect to it.
  • Apps connect through PgBouncer in transaction mode on port 6432, so serverless-style apps such as Next.js do not exhaust connections. Each role is limited to 20 connections and a 60-second statement timeout.
  • DIRECT_DATABASE_URL is provided for tools such as Prisma that ask for one; in v1 it is the same as DATABASE_URL.
  • There is no public database endpoint. Use the db tool for queries, temporary connections and exports.
  • Over the plan's size limit, the database becomes read-only until you free space or upgrade. Nothing is deleted.
  • Databases never sleep, on any plan.

Redis 7

  • Each project gets its own Redis on the project's private network, reachable at redis:6379 with a password.
  • Memory is capped at the plan's Redis size with the allkeys-lru policy: when full, the least recently used keys are evicted. Use it as a cache and queue, not as the only copy of your data.

Object storage (R2)

  • Each project gets a Cloudflare R2 bucket rv-<slug> and an API key scoped to that bucket only.
  • It speaks the S3 API: point any S3 SDK at S3_ENDPOINT with region auto. The same values are also set as AWS_* variables for SDKs that read those.
  • No egress fees, and files can be served through Cloudflare's CDN.

Sizes per plan

Data service sizes per plan
FreeHobbyProTeam
Postgres1 GB per project5 GB total20 GB total80 GB total
Redis50 MB100 MB256 MB1 GB
File storage1 GB10 GB50 GB200 GB
Point-in-time backups7 days14 days30 days30 days
Database branchesNoNoYesYes

Backups

Postgres is archived continuously (write-ahead log) with nightly base backups, so a database can be restored to any point in the backup window of its plan: 7 days on Free, 14 on Hobby, 30 on Pro and Team. Every week a random database is restored automatically to prove the backups work.

Export

Your data is yours. Download a standard dump at any time:

npx rivtor db export -o my-app.dump
pg_restore --no-owner -d postgres://localhost/my_app my-app.dump
Read-only queries from your terminal or agent: npx rivtor db query "select …" or the db tool. They run in a read-only transaction with a 5-second timeout and return up to 500 rows.