Guard

Database: Postgres

A managed Postgres database for your app, with backups, branches, point in time recovery (PITR), schema diff and signed webhooks. Attach it to a site or app for connection variables.

What it is

A managed Postgres database for your app, with backups, branches, point in time recovery (PITR), schema diff and signed webhooks. Attach it to a site or app for connection variables.

In Guard

Open a database in Hosting > Databases. The sidebar has three groups, in the order you need them:

GroupSections
OverviewThe database at a glance
DataTables, SQL, Schema
AccessUsers (Auth), Data API, Realtime
OperateBranches, Database, Health, Logs, Schedules, Extensions

On a phone it is a select list in the same order.

Quick start and CLI

infaris-guard hosting db create --name mijn-db --site <siteId>
infaris-guard hosting db show <databaseId>
infaris-guard hosting db backups <databaseId>
infaris-guard hosting db pitr status <databaseId>
infaris-guard hosting db branches create <databaseId> --name test --masked --dry-run
infaris-guard hosting db diff <databaseId> --base <baseDatabaseId>
infaris-guard hosting db webhooks list <databaseId>
infaris-guard hosting db extensions list <databaseId>
infaris-guard hosting db extensions enable <databaseId> vector
infaris-guard hosting db replicas list <databaseId>
infaris-guard hosting db vault list <databaseId>

SDK and code

// Server only. DATABASE_URL comes from the database attachment.
import { Client } from 'pg';
const client = new Client({ connectionString: process.env.DATABASE_URL });
await client.connect();
try {
  console.log((await client.query('select current_database()')).rows);
} finally {
  await client.end();
}

Secure defaults

Network access starts closed: a new database only accepts connections from Infaris (Data API, Realtime, studio, backups, apps on the same server and apps on the shared Infaris Cloud servers) and from the addresses you allow. Does an app run on your organization's own server, not on the database's? Add that server's address with infaris-guard hosting db network allow <database> <address>; hosting db attach --app names the exact command when it is missing. Add your own laptop or CI with infaris-guard hosting db network allow <database> --mine or with the Add my address button under Access. Attach the database to a site on Cloudflare and the platform group cloudflare-workers goes on the list by itself (one entry for every Cloudflare Workers range, including those outside cloudflare.com/ips); you can also add it with infaris-guard hosting db network allow <database> cloudflare-workers. A list has at most 20 entries. An app on Vercel has no fixed addresses: turn on Static IPs in your Vercel project and allow those, use the Data API, or open the database on purpose (hosting db network set <database> --public --confirm <name>, or network = "public" under [db] in infaris.toml). Existing databases keep their access; the security overview (hosting security) names every database that is open, with the command that closes it. Opening it requires explicit confirmation. Use masked branches for test data and review masking rules. Webhooks contain customer data: verify signatures and make processing idempotent. Vault encrypts database secrets; replicas serve reads.

Limits

PITR depends on available backups and WAL: the status command shows the window. Branches are copies, not unlimited instant snapshots. Schema diff does not copy data. Extensions must be allowed and available in the host image. pg_cron, dblink and pg_net are forbidden.

FAQ

Restore production? Test a branch and verify data and connections first. High availability? A read replica does not promise automatic failover. Change a schema? Use Studio and keep the migration in git.

Branches, recovery and schema changes

A branch gets separate connections and privileges. --masked uses your masking rules: review them before copying production data into development. PITR can restore into a new branch without replacing the source. Choose a timestamp within the window from pitr status. Diff compares schemas; review SQL before applying it. Webhooks send events out; they do not replace a transactional integration.

infaris-guard hosting db branches create <databaseId> --name test --masked
infaris-guard hosting db restore <databaseId> --to 2026-11-09T12:00:00Z --as-branch recovery --dry-run
infaris-guard hosting db webhooks create <databaseId> --name orders --schema public --table orders --events insert,update --url https://app.example.nl/hooks/orders --yes

PostgreSQL or MariaDB

When creating a database, check which engine your app expects. Choose PostgreSQL for the Postgres features in this guide, such as the Data API, Realtime and branches. Choose MariaDB for an app that uses MariaDB, and use that database’s connection details and settings.