Skip to content

AdminConfig

AdminConfig = object

Defined in: packages/admin/src/types.ts:388

Top-level configuration for createAdmin.

Combines the database factory, auth adapter, Drizzle schema, and optional customizations for tables, user management, and the dashboard.

const admin = createAdmin({
db: (grants, user) => createDb({ d1: env.DB, schema, grants, user }),
auth,
schema,
requiredRole: "admin",
tables: { posts: { label: "Blog Posts" } },
users: { assignableRoles: ["user", "editor", "admin"] },
dashboard: {
widgets: [{ type: "count", table: "users", label: "Total Users" }],
},
});

auth: AdminAuthConfig

Defined in: packages/admin/src/types.ts:392

Auth adapter that provides user authentication, role management, and impersonation. See AdminAuthConfig.


optional dashboard: DashboardConfig

Defined in: packages/admin/src/types.ts:413

Configuration for the admin dashboard index page. See DashboardConfig.


db: CreateDbFn

Defined in: packages/admin/src/types.ts:390

Factory function that creates a permission-scoped DB instance per request. See CreateDbFn.


optional email: RowActionEmailClient | () => RowActionEmailClient

Defined in: packages/admin/src/types.ts:405

Optional email client exposed to row actions via RowActionContext.email. Pass your app’s existing EmailClient (from @cfast/email or any structurally compatible implementation) so row actions like “approve vendor” can send notification emails without rebuilding a client per invocation.

Accepts either the client directly or a zero-arg getter that returns one — the getter form matches the lazy env-binding pattern the email package already uses and avoids capturing Cloudflare bindings at module scope.


optional requiredRole: string

Defined in: packages/admin/src/types.ts:415

Role required to access the admin panel. Defaults to "admin".


schema: Record<string, unknown>

Defined in: packages/admin/src/types.ts:407

Your Drizzle schema object (e.g., import * as schema from "~/schema"). Non-table exports (Relations, helpers) are silently skipped.


optional tables: Record<string, TableOverrides>

Defined in: packages/admin/src/types.ts:409

Per-table display and behavior overrides, keyed by table name. See TableOverrides.


optional users: UserManagementConfig

Defined in: packages/admin/src/types.ts:411

Configuration for the built-in user management views. See UserManagementConfig.