Skip to content

Registries

Registries allow modules to provide functionality to the core platform dynamically.

The ShellRegistry determines which “App Shell” to render for a given request. This allows modules to completely takeover the UI (e.g., Kiosk Mode, Admin Panel).

ShellRegistry.register(name, component, matcher)

Section titled “ShellRegistry.register(name, component, matcher)”
  • matcher: A string glob (e.g., /admin/*) or a predicate function (ctx) => boolean.
import { ShellRegistry } from '@/lib/registries/shell-registry';
import AdminShell from './AdminShell';
ShellRegistry.register('admin', AdminShell, (ctx) => ctx.url.pathname.startsWith('/admin'));

The RoleRegistry defines authorization policies for different roles.

import { RoleRegistry } from '@/lib/registries/role-registry';
RoleRegistry.register('admin', {
check: async (ctx, input) => {
if (ctx.locals.user.role !== 'ADMIN') throw new Error('Unauthorized');
},
});