PrimeBrickPrimeBrick
  • Docs
  • Contact
  • MIT License
  • Documentation
  • MCP Server
  • API Catalog
  • Services
  • Libraries
PrimeBrickPrimeBrick

© 2026 PrimeBrick. MIT License. v3.11.2

github
Backend
Frontend
    Developer Guide
      OverviewGetting startedUI stackApp shell & sidebarAuthentication & sessionsSystem settingsUI componentsUI patternsIcon ConventionsInput AnatomyField Hints & TooltipsButton Style StandardsEntity metadatai18n — Translations on the FrontendThe AI Tool Loop (caller-driven)Error HandlingComposables (use* hooks)
      Components
      API Reference
Microservices
powered by Zudoku
Developer Guide

Composables (use* hooks)

src/lib/composables/ holds Svelte 5 reactive hooks ($state/$derived rune-backed classes) that components share. This page maps the catalog by concern — signatures live in api-reference.

Permissions & roles

HookFor
usePermissionsCatalogthe full permission catalog (admin screens, role editors)
useActiveRolesthe caller's active roles for the current org/session
useRoleMappingsrole↔group mapping data (Casdoor-synced surfaces)

Entity & data access

HookFor
useEntityMetadata*.meta.ts-driven entity metadata (fields, permissions, labels) — powers every entity form page
useEntityListentity list state machine — meta cache, rows, search/sort/filters, pagination, deletion mode, persistence, sync channel. Consumed by EntityTablePage; use directly only in composite hosts
useConfigEntriesconfig_entries rows — settings pages, feature flags
useAuditBoxentity audit-trail panel data
useExistingGroupKeysreserved/group-key existence checks in pickers
useTypeCapabilities / useMachineCapabilitieswhat a type/machine supports (feature-gated UI) — useMachineCapabilities lives in @primebrick/ui

AI

HookFor
useAiModelsinstalled AI models for selectors/settings
useAiCerebellumcerebellum rules for assistant config screens

The chat/tool loop itself lives in shell/ai-chat/ — see ai-tool-loop.

Forms & guards

HookFor
useFormGuard / useUnsavedChangesGuarddirty-state tracking + "leave without saving?" interception
useTabsModetab-state for multi-section forms
useMfaStepUpstep-up challenge flow around sensitive actions
usePasswordPolicylive password-rules checklist (pairs with password-checklist)

Selection & input primitives

HookFor
useSelectionmulti-select state for list/bulk operations
useNumericInput / useOtpInput (@primebrick/ui)constrained inputs (numeric, OTP boxes)
useAvatarPreviewimage preview before upload (component doc: avatar-preview)

Health & realtime

HookFor
useHealthChipservice/module health chip state (sidebar badges)
useSyncChannelcross-tab sync via BroadcastChannel (session, theme, lang)

Conventions

  • Rune-backed classes, not function closures — .svelte.ts files expose $state-reactive objects; instantiate per component tree, not module-scope singletons.
  • Name = use<Purpose>; file = use<Purpose>.svelte.ts (camelCase, same name as the hook — e.g. useFormGuard.svelte.ts).
  • Composables fetch through api.ts — never raw fetch; errors flow through the errors pipeline.
Last modified on October 28, 2026
Error HandlingEntity list table
On this page
  • Permissions & roles
  • Entity & data access
  • AI
  • Forms & guards
  • Selection & input primitives
  • Health & realtime
  • Conventions