Skip to main content

CRUD

CRUD is disabled by default.

Enable it explicitly:

pgDashboard({
connectionString: process.env.DATABASE_URL,
enableCrud: true,
});

How It Works

PG Dashboard reads relation metadata and generates forms dynamically.

It uses:

  • primary keys to identify rows;
  • column nullability to validate required fields;
  • PostgreSQL enum metadata to render dropdowns;
  • column data types to choose suitable inputs;
  • parameterized queries for values.

Supported Relations

CRUD is available when the selected relation is writable and has the required metadata.

Views and materialized views may be read-only depending on PostgreSQL rules and permissions.

Safety Rules

The backend still enforces safety even if someone calls the API directly:

  • enableCrud must be true;
  • the table must exist in the configured schema;
  • writable columns must be known columns;
  • enum values must match the PostgreSQL enum definition;
  • primary keys are required for update, delete, and full row loading.

Production Recommendation

Use CRUD only behind an authenticated admin route and with a dedicated database user.