Browse documentation
Developer guide1 min read

Database adapters

Database adapters translate the same typed table request into allowlisted queries and normalize rows, totals, summaries, facets, and cursor results.

Declare an allowlist

#

Map public column IDs to database fields and explicitly enable search, filtering, sorting, facets, and aggregation. Never accept table or field identifiers from a request.

Choose an adapter

#

Use native PostgreSQL, MySQL, or SQLite adapters for SQL control; Knex for query-builder portability; or Prisma for an injected model.

Keyset cursors and editing

#

Provide a primary key and secret for signed keyset cursors. Editor-option loaders and multipart upload handlers reuse the same authorization boundary.

PostgreSQL adapter

#

This recipe focuses on the integration pattern. Replace application-specific values and callbacks with your own data and services.

PostgreSQL adapter
TypeScript
const database = createDataTablePostgreSqlAdapter({
  client: pgPool,
  table: 'people',
  primaryKey: 'id',
  cursorSecret: process.env.CURSOR_SECRET,
  columns: [
    { id: 'name', field: 'name', facet: true },
    { id: 'score', field: 'score', type: 'number' }
  ]
});
Need a complete starting point?

The framework quick start includes install commands, a typed data file, and the component that renders it.

Go to the quick start →

Ready to try it with real data?

Explore configurable examples ↗