Introduction
The core contract of the DMS: pages and modules, components, permissions, tenancy, invites, hooks, realtime, quick actions and layout banners.
Overview
The root export of @antelopejs/interface-dms and the subpaths listed below are the core contract of the AntelopeJS DMS. The contract rests on one inversion. The backend declares the screen as serializable data. A page is a controller class, its components are static fields that hold builders, and the page's layout route returns the description that a shared frontend renders. To add an admin screen, you change the backend.
Around that core, the interface carries what an admin backend needs beyond rendering. It derives hierarchical permissions from the page tree and scopes multi-tenant data access through the model handle. It also dispatches lifecycle hooks, carries realtime topics, and adds entries to the command palette.
You import everything here from a subpath of @antelopejs/interface-dms. Two other domains of the same package complete the picture, and these pages refer to them throughout. Auth (/auth) covers authentication and the User table. Base (/base) holds the concrete component vocabulary (Form, TableView, Grid, the chart family), built on the component types documented here.
What the core provides
- Pages as controllers.
PageControllerbuilds a controller class bound to a URL.@RegisterPage()records it, registers its permissions, and serves its layout. - Components that serialize. A
ComponentBuilderproduces data, not a live component, so one frontend renders the screens of every module. - Categories and modules. Nested categories form a sidebar tree, and a module owns a whole branch under
/modules. - Dynamic navigation. Providers resolve extra menu entries for each request, so one page can back an entry per project or workspace.
- Page extensions. A module injects components into a page that another module owns. The injected components get their permissions in that page's own tree.
- Hierarchical permissions. Permission ids derive from the page, the component and the action. Roles grant a base set, and registered resolvers shape it into the effective set.
- Route guards. The permission, tenant-member and tenant-owner decorators work as parameter decorators or as property decorators.
- Tenancy in the handle. Each tenant has its own schemas, and a model handle is bound to one tenant. No query filters a tenant column.
- Tenant access gates. One binary check denies a tenant at every authorization surface at once.
- Invites. One call either grants membership to an existing user or issues an invite that carries a token.
- Lifecycle hooks. Typed events for tenants, members, invites and registrations. The DMS dispatches each one either to notify handlers or to collect their contributions.
- Realtime topics. You bind a topic to a page, publish to the sessions on that page, and subscribe from the backend to what others publish.
- Quick actions. You contribute grouped entries to the command palette, each gated by a permission.
Dependencies
This interface relies on the following AntelopeJS packages:
@antelopejs/interface-api: Controllers, route registration and the request context.@antelopejs/interface-api-util: Theasserthelper that rejects a request with an HTTP status, used by invite resolution, tenant lifecycle admission and the table view routes.@antelopejs/interface-core: Interface functions, registering proxies and decorator helpers.@antelopejs/interface-database: Query value proxies and theSchemahandle, used by the tenancy models and tenant provisioning.@antelopejs/interface-database-decorators: Table definitions, data models and model injection.@antelopejs/interface-data-api: The data controllers behind the table views of/baseand the built-in members and roles controllers of/data-controllers.@antelopejs/interface-file-storage: File metadata and upload constraints, used by/attachmentsand the file data types.
The route guards build on the Auth domain of this same package, not on a separate package.
Quick start
The following file declares the application's table and model, a category, a page with a component, and the route that the component fetches from. Book and BookModel are not DMS exports. The example defines them with the stock flag that the KPI query reads.
import { Get } from "@antelopejs/interface-api";
import {
BasicDataModel,
Field,
GetModel,
RegisterTable,
Table,
} from "@antelopejs/interface-database-decorators";
import {
Category,
PageController,
RegisterPage,
pageRoutePath,
pagesCategory,
} from "@antelopejs/interface-dms/page";
import { KpiCard } from "@antelopejs/interface-dms/base";
export const CATALOG_SCHEMA = "example_catalog";
@RegisterTable("books", CATALOG_SCHEMA)
export class Book extends Table {
@Field("string") declare _id: string;
@Field("string") declare title: string;
@Field("boolean") declare inStock: boolean;
}
export class BookModel extends BasicDataModel(Book, "books") {}
export const catalog = Category("catalog", {
displayName: "Catalog",
icon: "i-ph-books",
category: pagesCategory,
});
@RegisterPage()
export class BooksPage extends PageController("books", {
displayName: "Books",
description: "Everything currently in the catalog",
icon: "i-ph-book-open",
category: catalog,
order: 1,
}) {
static inStockKpi = KpiCard({
title: "In stock",
icon: "i-ph-package",
fetchUrl: pageRoutePath("/catalog/books", "/stats/in-stock"),
valueFormat: "number",
});
@Get("/stats/in-stock")
async inStock() {
const value = await GetModel(BookModel).table
.filter((book) => book.key("inStock").eq(true)).count().run();
return { value };
}
}
Import the page and register the schema from the entry file of your module. If the module already has a start(), add these lines to it.
import "./books-page";
import { RegisterSchema } from "@antelopejs/interface-database-decorators";
import { CATALOG_SCHEMA } from "./books-page";
export async function start(): Promise<void> {
await RegisterSchema(CATALOG_SCHEMA);
}
The page resolves at /catalog/books. Its layout resolves at /dms/pages/catalog/books/pagelayout, and its /stats/in-stock route at /dms/pages/catalog/books/stats/in-stock. The routes of a page controller live under the /dms/pages prefix (PAGE_ROUTE_PREFIX), because the frontend server answers the page's own path with the page and proxies only /api and /dms to the backend. pageRoutePath builds the path under that prefix, so the component's fetchUrl reaches the route.
The page's permission id is the chain of ids down from the root category, pages.catalog.books. The DMS registers pages.catalog.books.inStockKpi underneath it.
Subpath map
| Subpath | Contains | Documented in |
|---|---|---|
/page | Pages, categories, layouts, page extensions | Pages and modules |
/page | Modules, the modules catalog, dynamic menus | Modules and dynamic menus |
/page | Frontend modules | Frontend modules and request helpers |
/component | Component, ComponentBuilder, actions, watches | Components |
/component-slots | RegisterComponentSlot, ComponentSlotResolver, SlotOptions | Components |
/attachments | SaveComponentFiles and its request, field and result types | Frontend modules and request helpers |
/permission-gate | Shared PermissionGate fields | Base types |
/permissions | The permission registry and the permission computation | Permissions |
/permissions-resolver | Registering and running permission resolvers | Permissions |
/guards | AuthUserWithPermission, AuthTenantOwner, AuthTenantMember | Permissions |
/constants | Schema names and the default tenant | Tenancy |
/db | The Tenant, TenantMember, Role and UserInvite tables and models | Tenancy, Invites |
/request-tenant | getRequestTenantId | Tenancy |
/tenant-scoped-model | TenantScopedModel | Tenancy |
/tenant-access | Tenant access gates | Tenancy |
/tenant-ownership | Membership and ownership writes | Tenancy |
/tenant-lifecycle | Producer admission and closure before tenant deletion | Tenancy |
/data-controllers | The built-in members and roles data controllers | Tenancy |
/invites | Inviting a user into a tenant | Invites |
/invite-extensions | Invite form contributions, callbacks and availability | Invites |
/invite-resolution | Durable terminal decisions and retryable effects | Invites |
/hooks | The Hook enum, handlers and dispatch | Hooks |
/tenant-export | The tenant data export archive, contribution and manifest types, re-exported from /hooks | Tenant data export |
/realtime | Page topics, publishing and backend subscription | Realtime |
/quick-actions | Command-palette entries | Quick actions |
/layout-banners | Global banners under the dashboard header | Layout banners |
/uploads | Signed upload tokens for the file and image fields of a serialized component | Frontend modules and request helpers |
/types | MaybePromise, the one shared type alias | Pages and modules |
/api-base-url, /client-base-url | GetApiBaseUrl and GetClientBaseUrl, the public origins of the API and the dashboard | Frontend modules and request helpers |
/client-ip | getClientIp and ResolveClientIp, the client address of a request behind the trusted proxies | Frontend modules and request helpers |
Paths under internal/, symbols tagged @internal, and internal namespaces are implementation wiring, not supported consumer APIs. The wildcard export does not change that boundary.
Pages in this section
- Pages and modules: Declare pages, group them into categories, and extend a page from another module.
- Modules and dynamic menus: Own a branch of the sidebar with a module, report its state on the modules catalog, and add menu entries resolved per request.
- Frontend modules and request helpers: Ship a frontend module, sign upload fields, build public links, read the client address, and save native files.
- Components: Build serializable components, and declare actions and watches.
- Permissions: Register permissions, compute the effective set of a user, and guard routes.
- Tenancy: Schemas, the tenancy tables, tenant-scoped models and access gates.
- Invites: Bring a user into a tenant by email.
- Hooks: React to platform events.
- Tenant data export: Contribute the data of a module to the tenant data export.
- Realtime: Bind topics to pages, publish messages and subscribe to them.
- Quick actions: Contribute entries to the command palette.
- Layout banners: Show a global banner under the dashboard header, decided per request.