Configuration
All configuration keys use camelCase.
pgDashboard({
connectionString: process.env.DATABASE_URL,
schemaName: "public",
enableCrud: false,
enableFunctions: false,
});
Options
| Option | Type | Default | Description |
|---|---|---|---|
connectionString | string | undefined | PostgreSQL connection string used to create an internal pool. |
pool | Pool | undefined | Existing pg pool. If provided, it is used instead of creating a new pool. |
schemaName | string | "public" | PostgreSQL schema to inspect. |
enableCrud | boolean | false | Enables create, update, and delete actions when possible. |
enableFunctions | boolean | false | Enables listing and executing stored functions. |
maxConnections | number | 5 | Max connections for the internal pool. |
idleTimeoutMillis | number | 30000 | Idle timeout for the internal pool. |
connectionTimeoutMillis | number | 5000 | Connection timeout for the internal pool. |
ssl | PoolConfig["ssl"] | undefined | SSL config forwarded to pg. |
frontendDistPath | string | bundled frontend | Custom path for built frontend assets. Mostly useful for local development. |
jsonLimit | string | "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,
}),
);