| Import Path | Contents | Environment |
|---|---|---|
@adminforge/core |
Core schema, fields, DB client | Node.js |
@adminforge/core/next |
API controller, route handlers, auth, agent tokens | Node.js |
@adminforge/core/ui |
Admin dashboard UI components | React (client) |
@adminforge/core/styles |
Admin dashboard stylesheet | CSS |
import { defineConfig, collection, fields, type InferRecord } from "@adminforge/core";defineConfig(config)— Creates anAdminForgeConfigfrom collections and auth settingscollection(input)— Creates aCollectionDefinitionwith name, label, fields, hooks, and accessfields— Object with field builders:text,boolean,richText,slug,relation,date,imagetype Record = InferRecord<typeof myCollection>— Utility to infer the TypeScript type of a record
import type {
AdminForgeConfig,
CollectionDefinition,
CollectionHooks,
FieldDefinition,
FieldOptions,
AccessConfig,
AuthConfig,
TextOptions,
BooleanOptions,
RichTextOptions,
SlugOptions,
RelationOptions,
DateOptions,
ImageOptions,
NormalizedSchema,
FieldDBMapping,
FieldUI,
FieldHooks,
FieldMeta,
} from "@adminforge/core";import { createAdminForgeApi, verifyAgentToken } from "@adminforge/core/next";
import type { DbClient } from "@adminforge/core";
const db = createDbClient(config, existingPrismaClient?);
db.create(collectionName, data);
db.findMany(collectionName, { where, orderBy, skip, take });
db.findUnique(collectionName, id);
db.update(collectionName, id, data);
db.delete(collectionName, id);
db.count(collectionName, { where });import { registerField, getField, getRegisteredFields, clearRegistry } from "@adminforge/core";
registerField("customType", definition);
const field = getField("customType");import {
executeBeforeCreate,
executeAfterCreate,
executeBeforeUpdate,
executeAfterUpdate,
executeBeforeDelete,
executeAfterDelete,
} from "@adminforge/core";import { normalize } from "@adminforge/core";
// Normalizes config (fills defaults for labels, auth, etc.)The easiest way to mount AdminForge. Creates catch-all route handlers for the App Router.
Returns: { GET, POST, PATCH, DELETE }
Creates a signed JWT for AI agents.
Verifies an AI agent JWT and returns the payload.
Low-level controller for manual API implementations.
The primary React entry point. Handles internal routing and data fetching automatically.
config: YourAdminForgeConfigparams: The catch-all route params (from Next.js)
import {
AdminPage, // Dashboard overview
CollectionListPage, // Collection data table with search/pagination
CollectionFormPage, // Create/edit form for a record
CollectionSchemaPage, // Schema viewer for a collection
RolesListPage, // Role management list
RoleDetailPage, // Role detail view
} from "@adminforge/core/ui";import {
AdminLayout, // Sidebar + topbar layout wrapper
FormEngine, // Dynamic form renderer from collection definition
TableEngine, // Generic data table with sorting/pagination
RichTextEditor, // Full-featured Tiptap editor
ImageUpload, // Image upload component
} from "@adminforge/core/ui";import { AuthProvider, useAdminSession } from "@adminforge/core/ui";AuthProvider— React context provider wrapping the appuseAdminSession()— Hook to access current session
npx adminforge migrate # Create and run migrations (dev)
npx adminforge migrate --push # Sync DB directly (local dev)
npx adminforge migrate --deploy # Apply migrations (production/Vercel)
npx adminforge makemigrations # Create migration files without applyingnpx adminforge-ai start # Start MCP server
npx adminforge-ai token # Generate agent token