[data-reveal]{opacity:1!important;transform:none!important}
AntelopeJS DMS
DocumentationIntroduction

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. PageController builds a controller class bound to a URL. @RegisterPage() records it, registers its permissions, and serves its layout.
  • Components that serialize. A ComponentBuilder produces 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:

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.

books-page.ts typescript
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.

index.ts typescript
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

SubpathContainsDocumented in
/pagePages, categories, layouts, page extensionsPages and modules
/pageModules, the modules catalog, dynamic menusModules and dynamic menus
/pageFrontend modulesFrontend modules and request helpers
/componentComponent, ComponentBuilder, actions, watchesComponents
/component-slotsRegisterComponentSlot, ComponentSlotResolver, SlotOptionsComponents
/attachmentsSaveComponentFiles and its request, field and result typesFrontend modules and request helpers
/permission-gateShared PermissionGate fieldsBase types
/permissionsThe permission registry and the permission computationPermissions
/permissions-resolverRegistering and running permission resolversPermissions
/guardsAuthUserWithPermission, AuthTenantOwner, AuthTenantMemberPermissions
/constantsSchema names and the default tenantTenancy
/dbThe Tenant, TenantMember, Role and UserInvite tables and modelsTenancy, Invites
/request-tenantgetRequestTenantIdTenancy
/tenant-scoped-modelTenantScopedModelTenancy
/tenant-accessTenant access gatesTenancy
/tenant-ownershipMembership and ownership writesTenancy
/tenant-lifecycleProducer admission and closure before tenant deletionTenancy
/data-controllersThe built-in members and roles data controllersTenancy
/invitesInviting a user into a tenantInvites
/invite-extensionsInvite form contributions, callbacks and availabilityInvites
/invite-resolutionDurable terminal decisions and retryable effectsInvites
/hooksThe Hook enum, handlers and dispatchHooks
/tenant-exportThe tenant data export archive, contribution and manifest types, re-exported from /hooksTenant data export
/realtimePage topics, publishing and backend subscriptionRealtime
/quick-actionsCommand-palette entriesQuick actions
/layout-bannersGlobal banners under the dashboard headerLayout banners
/uploadsSigned upload tokens for the file and image fields of a serialized componentFrontend modules and request helpers
/typesMaybePromise, the one shared type aliasPages and modules
/api-base-url, /client-base-urlGetApiBaseUrl and GetClientBaseUrl, the public origins of the API and the dashboardFrontend modules and request helpers
/client-ipgetClientIp and ResolveClientIp, the client address of a request behind the trusted proxiesFrontend 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.