Skip to content

introspectSchema

introspectSchema(schema, tableOverrides?): AdminTableMeta[]

Defined in: packages/admin/src/introspect.ts:128

Introspect a Drizzle schema and produce AdminTableMeta for each visible table.

Reads every SQLiteTable in the schema, extracts column types, foreign keys, and primary keys, then applies user-provided TableOverrides. Auth-internal tables (session, account, verification, passkey) are auto-excluded unless you explicitly provide overrides for them.

Use this directly when you need server/client code splitting (the result is JSON-serializable minus the drizzleTable references, which stay on the server).

Record<string, unknown>

Your Drizzle schema object (e.g., import * as schema from "~/schema").

Record<string, TableOverrides>

Optional per-table display and behavior overrides, keyed by table name.

AdminTableMeta[]

An array of AdminTableMeta sorted alphabetically by table name.

import { introspectSchema } from "@cfast/admin";
import * as schema from "~/schema";
const tableMetas = introspectSchema(schema, {
posts: { label: "Blog Posts", listColumns: ["title", "createdAt"] },
});