Skip to main content

Configuration

All configuration keys use camelCase.

pgDashboard({
connectionString: process.env.DATABASE_URL,
schemaName: "public",
enableCrud: false,
enableFunctions: false,
});

Options

OptionTypeDefaultDescription
connectionStringstringundefinedPostgreSQL connection string used to create an internal pool.
poolPoolundefinedExisting pg pool. If provided, it is used instead of creating a new pool.
schemaNamestring"public"PostgreSQL schema to inspect.
enableCrudbooleanfalseEnables create, update, and delete actions when possible.
enableFunctionsbooleanfalseEnables listing and executing stored functions.
maxConnectionsnumber5Max connections for the internal pool.
idleTimeoutMillisnumber30000Idle timeout for the internal pool.
connectionTimeoutMillisnumber5000Connection timeout for the internal pool.
sslPoolConfig["ssl"]undefinedSSL config forwarded to pg.
frontendDistPathstringbundled frontendCustom path for built frontend assets. Mostly useful for local development.
jsonLimitstring"100kb"Limit passed to express.json().

Read-Only Setup

This is the safest default:

app.use(
"/admin/db",
requireAdminUser,
pgDashboard({
connectionString: process.env.DATABASE_URL,
schemaName: "public",
}),
);

With this setup, reports and exports work, but CRUD and stored functions remain disabled.

Full Internal Admin Setup

Only enable mutation features behind a protected admin route:

app.use(
"/admin/db",
requireAdminUser,
pgDashboard({
connectionString: process.env.DATABASE_URL,
schemaName: "public",
enableCrud: true,
enableFunctions: true,
}),
);