SHADE is young: 0.1.0-next.2 is a pre-release, and 0.1.0 isn't out yet.

SHADE
Writing a plugin

Admin screens and the site part

A package's admin screens and site part

The admin and the site are built once, for every client, without the packages an instance installs. A package brings its screens compiled and its site part as sources:

  • Admin pages are compiled by shade-module build (shade/module-sdk/tools/admin.ts): each page in admin.pages becomes an ES module, admin-dist/<file>.mjs, with its own components and shared code bundled in. It brings no Vue, Nuxt UI or composables of its own; it takes the admin's from a global the admin sets, the host (apps/admin/app/module-host.ts):
    • vue is a module that reads the admin's Vue, so a page and the admin share one; its resolveComponent finds the admin's components by name (Nuxt UI's, SHADE's features', and the shell's list pieces ListEmpty, ListError, ListPager, ListLoading and ListFilters: the search field and a Filters button over the page's own filter fields, active naming the filters that are on as { label, clear } chips), each loaded the first time a page uses it (#build/shade-module-components.mjs, written by modules/shade-installed-modules.ts);
    • a page uses Vue's usual names and the admin's composables without importing them, as in a feature's page. The names are ADMIN_VUE_IMPORTS and ADMIN_HOST_IMPORTS (shade/features/packages/shared/admin-host.ts): useFetch, $fetch, useI18n, useToast, useRoute, useSeoMeta, refDebounced, …, and SHADE's useCan, useConfirm, formatDate (the exact moment, in the admin's language and the site's time zone), timeAgo, apiErrorMessage, apiFormErrors, useSession, useLanguages, useMedia, useApiAction (a request with its busy flag and its failure shown), useApiList (one page of a list, back on the first when a filter changes), useConfirmedAction (the answer to a list's Delete or Revoke: one question in a modal, the request, the list loaded again and a success toast, or the failure shown as useApiAction shows it; its texts are functions, so a page writes each key out as t('…')), useCopy (copies a text to the clipboard and says so), useSecondFactor (a typed code or a passkey for signing in again before a sensitive step), useSettingsForm (a draft of loaded settings, whether it changed, the question before leaving; after a save, markSaved(sent) with a copy of what was sent, so what the server stored replaces it), and for a list's table on a phone wideOnly (a column's meta: shown from sm up only), phoneLine(children) (a muted second line with what the hidden columns held, rendered on a phone only) and usePhone() (whether the admin is narrower than sm), …. Anything else a page needs it imports, and it is bundled. definePageMeta does nothing in a package: the manifest says what a page needs. These names reach a page's <script setup>, not its template: a template that needs one (say formatDate) calls it through a binding of the script (const dateTime = (value: string) => formatDate(value)); in a development folder both work, so only the package shows the difference. Components (Nuxt UI's and the shell's, such as ListEmpty) work in templates as usual. apps/admin/test/app/module-host.test.ts checks the host provides exactly those names.
  • Its CSS is one stylesheet, admin-dist/style.css: the Tailwind classes its files use, compiled against the admin's design tokens (tools/admin-theme.css, a copy of Nuxt UI's theme that admin-theme.test.ts keeps equal to the admin's) without Tailwind's theme or base styles, in the admin's utilities layer; its pages' own <style> blocks (scoped ones get a scope id from the module's name and the file); and the CSS of what it bundles. <style module> is not supported. It applies to the module's own markup only (tools/scope-css.ts): every style rule is put under :where([data-shade-module="<name>"]), and the admin renders the module's pages, widgets, panels and settings sections inside such an element, and opens its modals, menus and popovers (Nuxt UI's, and those of useOverlay) in a container of its own marked the same way. So nothing in it can change the admin's own screens, and inside the module's markup its classes work as in any Tailwind project (hidden md:block, flex-col md:flex-row), at their own specificity, whichever classes the admin has. A selector for what is outside the module's markup (html, :root, body, .dark .card) matches nothing: write dark mode with Tailwind's dark: variant.
    What cannot be scoped is checked, and the build refuses it, naming the module and the rule. At-rules that select nothing apply to the whole admin, so in the module's own CSS (its <style> blocks and the CSS of what it bundles):
    • the names it defines start with the module's name: @keyframes shop-spin, @font-face { font-family: shop-icons } and @counter-style shop-steps with <name>-, @property --shop-angle (and @font-palette-values, @position-try) with --<name>-. A @keyframes spin or an @font-face with the admin's family would change the admin's own screens. Every font-family in an @font-face needs the prefix, since a browser uses the last one. In a scoped <style>, Vue adds the scope id to a keyframes name (shop-spin-1a2b3c4d), so the prefix holds there too;
    • any other global at-rule (@page, @font-feature-values, @view-transition, @namespace, …) is refused;
    • @scope is refused anywhere (@scope (body) would reach the whole page), and so is @import (a stylesheet loaded unscoped): import a CSS file from a page's script instead, so it is bundled and scoped, or copy it in.

    Tailwind's own output is not checked: compiled from the admin's theme, its @keyframes spin (for animate-spin) and @property --tw-* are the admin's own. Library CSS a page bundles is the module's own CSS: if it defines keyframes or fonts of its own, copy it in with the names prefixed. This keeps a package's mistakes off the admin's screens; it is no sandbox: a module's code, which runs in the admin, can still add styles at runtime.
  • The admin mounts them once signed in (useModulePackages, called by middleware/auth.global.ts): it reads GET /api/packages/server/admin (pages with their module URLs, sidebar entries and group, widgets, panels and, for admins, settings sections with theirs, actions, texts per language, stylesheet), adds the pages to the router, registers the actions for useCan(), merges the texts and links the stylesheet. A link straight to a package's page is tried again once its pages are mounted. The files are served by GET /api/packages/server/<name>/<version>/admin-dist/…, only for the version the API runs, to signed-in accounts. In development, modules from SHADE_DEV_MODULES are built into the admin instead (modules/shade-installed-modules.ts).
  • The site part is compiled with the site. A package carries its site/ and shared/ folders as sources; its site/index.ts may export head. Before every build, @shadestack/astro fetches them from GET /api/v1/content/module-sites (the build's read token), writes them into the site's .shade/modules/ (ignored by git) and offers them as virtual:shade/module-sites (packages/astro/src/integrations/module-sites.ts in shade-frontend); the site's layout renders the heads of the modules that are on. A build fails when the API can't say which packages there are, rather than leave them out. Their imports resolve from the site: it depends on @shadestack/module-sdk and zod. A site in another repository that uses no packages can switch it off with shade({ modules: false }).
  • When: like the server code, screens of an installed or updated package appear after the restart; its site part reaches the website with the next publish (the next build).

Where a module appears in the admin

Besides its pages, a module may fill these places of the admin, all in the manifest's admin part:

admin: {
  locales: 'admin/locales',
  // `fullScreen: true` gives a page the whole window, without the sidebar; it brings its own header with a way back.
  // A page's `name` (optional) is the module's name or starts with `<module>-` (`shop-orders`), once per module: it
  // never takes a route of the admin's own.
  pages: [{ path: '/modules/shop/orders', name: 'shop-orders', file: 'admin/OrdersPage.vue' }],
  // `section` (on an entry or a group; its entries take the group's unless they name their own) puts the screens in
  // one of the sidebar's sections: 'content', 'customers', 'sales', 'bookings', 'website' or 'insights'; never
  // 'inbox', which is one row fed by inbox sources (below). An entry with `area: 'settings'` stands in the settings
  // area's Modules group and takes no section (refused if it names one).
  // Name a section for the module's work pages: that keeps the sidebar's top level short. Without one, a group (or a
  // plain list of entries, under the module's title) goes in the shared "More" row after the sections, a view with a
  // heading per module; it is the fallback, not a place to aim for.
  sidebar: {
    group: { label: 'shop.sidebar.group', icon: 'i-lucide-store', section: 'sales' },
    // `keywords`: more words search finds the entry by, not shown (translation keys or plain text, commas between words).
    entries: [{ label: 'shop.sidebar.orders', icon: 'i-lucide-shopping-bag', to: '/modules/shop/orders', requires: 'shop.orders.read', keywords: ['shop.sidebar.ordersKeywords'] }]
  },
  // Dashboard cards (decision 0012 point 22): small (4 of 12 columns), medium (6) or wide (12), the sizes it allows, whether
  // it is in the default layout, a description for the Add list, and settings kept with the layout (its prop `settings`).
  widgets: [{ id: 'to-ship', label: 'shop.widgets.toShip', description: 'shop.widgets.toShipHelp', file: 'admin/ToShipWidget.vue', requires: 'shop.orders.read', size: 'small', sizes: ['small', 'medium'], settings: [{ kind: 'number', name: 'days', label: 'shop.widgets.days', defaultValue: 7 }] }],
  // A panel beside the entry editor of core's collections or the module's own (not the pages).
  panels: [{ id: 'stock', label: 'shop.panels.stock', file: 'admin/StockPanel.vue', collections: ['shop-products'], requires: 'shop.stock.manage' }],
  // Next to Publish in the entry editor, and in its status row (experimental): `entryActions` and `entryChips`. Both show
  // on the collections with drafts, or on the `collections` named.
  entryActions: [{ id: 'schedule', file: 'admin/ScheduleAction.vue', requires: 'editorial.schedules.create' }],
  entryChips: [{ id: 'release', file: 'admin/ReleaseChip.vue', requires: 'editorial.releases.read' }],
  // One column in the entry list (experimental): a badge per entry, from a route of the module, with an optional filter.
  entryColumns: [{ id: 'translations', label: 'editorial.columns.translations', route: '/api/packages/editorial/translations/column', requires: 'editorial.translations.read', filter: { label: 'editorial.columns.filter', options: [{ value: 'outdated', label: 'editorial.columns.outdated' }] } }],
  // A panel on a contact of the People screen (experimental): what the module keeps about that person.
  contactPanels: [{ id: 'orders', label: 'shop.contactPanel.title', file: 'admin/ContactOrders.vue', requires: 'shop.orders.read' }],
  // A panel on an organisation of the Organisations screen (experimental): what the module keeps for that organisation.
  organisationPanels: [{ id: 'orders', label: 'shop.organisationPanel.title', file: 'admin/OrganisationOrders.vue', requires: 'shop.orders.read' }],
  // A tab of the Settings screen, after core's one "Site" tab: module configuration, for admins only.
  settings: [{ id: 'general', label: 'shop.settings.title', file: 'admin/ShopSettings.vue' }],
  // A button on every collection's list (experimental): a link to one of the module's pages, opened with ?collection=<slug>.
  listActions: [{ label: 'shop.listAction', icon: 'i-lucide-file-up', to: '/modules/shop/collection' }],
  // What waits for the team member, in the Inbox: a count route, an items route and the screen with all of it.
  inbox: [{ id: 'to-ship', label: 'shop.inbox.toShip', icon: 'i-lucide-package', requires: 'shop.orders.read', count: '/orders/to-ship-count', items: '/orders/to-ship/inbox', to: '/modules/shop/orders' }],
  // What the admin's search (Ctrl+K) finds in the module as the team member types: a route asked with ?q=.
  search: [{ id: 'orders', label: 'shop.sidebar.orders', icon: 'i-lucide-shopping-bag', requires: 'shop.orders.read', route: '/orders/search' }]
}
  • Each is a .vue file compiled like a page (shade-module build puts it in admin-dist/), with the same host: Vue, Nuxt UI, the composables of ADMIN_HOST_IMPORTS and the admin's components by name. A widget gets no props; a panel gets entry (its id, data and meta, read-only) and collection (ModulePanelProps from @shadestack/module-sdk/shared), and may emit changed after it changed the entry through the API, so the editor loads it again; a contact panel gets contact (its id, email, confirmedAt, language and accountId, read-only; ModuleContactPanelProps) and reads the module's own data about it through the module's own routes (see Contacts); an organisation panel gets organisation (its id and name, read-only; ModuleOrganisationPanelProps), shown on an organisation of the Organisations screen; a settings section gets plugin, its module's name (ModuleSettingsProps), and shows on the module's settings page (/module-settings/<name>, in the settings area), below the module's settings form.
  • A collection's own place is admin.section beside admin.group in its definition: the collection is then a link in that sidebar section instead of in Content under its group. An unknown section is refused when collections are checked, and so is inbox, which is one row of what waits in the inbox sources.
  • An inbox source (inbox, ModuleInboxSource) is what waits for the team member in the module, such as unread messages or orders to ship. Its entry stays in its own section; the source adds what waits to the Inbox. count is one of the module's routes answering { count }; items one answering ModuleInboxItems, { items: [{ id, title, detail?, at, to }] }, newest first and at most 20, where at is an ISO date and to one of the module's own pages; and to is the module's screen with all of it, behind See all. Both routes check the team member's rights themselves. The sidebar's Inbox row adds up the counts of every source the team member may see (requires), the Inbox screen merges the items by time with a filter per source, and the top bar's bell names the sources with something waiting. An item of another shape, or one whose to leads elsewhere, is left out. Make something a source only when it can wait for someone: a list of what is coming, such as today's bookings, stays on its own screen.
  • A search source (search, ModuleSearchSource) is what the admin's search finds in the module, such as orders by number or customer. route is one of the module's routes, asked with ?q= once two characters are typed, and answering ModuleSearchItems, { items: [{ id, title, detail?, to }] }, best first and at most five (SEARCH_SOURCE_LIMIT), where to is one of the module's own pages and detail a line beside the title. The route checks the team member's rights itself; search asks it only for whoever may perform requires. Each source is a group of its own in the palette, shown as soon as it answers: one that takes longer than 1.5 seconds (SEARCH_SOURCE_TIMEOUT_MS) is left out, and one that fails is one line, so a slow source never holds up the others. Open the found thing on its screen (/modules/shop/orders?order=<id>); search never acts by itself.
  • Entry actions and chips (entryActions, entryChips; ModuleEntrySlot, experimental) are components that get collection, entry (the editor's entry), canPublish and dirty (unsaved changes) (ModuleEntrySlotProps) and may emit changed, so the editor loads the entry again. Actions sit next to Publish, chips in the status row. The website module's editor shows the same actions in its header through the admin host component ModuleEntrySlots; a module with an editor of its own can mount it too.
  • An entry column (entryColumns, ModuleEntryColumn, experimental) adds a column to core's entry list. Core asks the module's route GET <route>?collection=<slug>&ids=<comma list> once per page, and the route answers each id's { text, color? } (ModuleEntryColumnValues), which the list shows as a badge. With a filter, a chosen option asks GET <route>?collection=<slug>&filter=<value>, which answers { ids } (at most 1000), and the list shows only those.
  • A list action (listActions, ModuleListAction) is only a link: it runs no component on the list. It shows on every collection's list while the module is on, and opens the module's page with ?collection=<slug>; the page and its routes check what the editor may do there, as the import module's does. Its to must be one of the module's own pages.
  • Who sees what. Nothing shows while the module is off. Widgets, panels, contact and organisation panels show to editors who may perform their requires (required): the module's own declared action, a core action, or an action of core's collections or the module's own. Settings sections show to admins only, whatever the module's actions (only admins configure modules): they have no requires, and the API sends them to nobody else. What a part reads or changes it does through the API, with the editor's own rights: a panel that saves an entry calls PUT /api/collections/<slug>/<id>. A settings section only calls routes that check packages.manage: it saves the module's settings with PUT /api/packages/catalog/<name>/settings ({ values }, which checks it), and every session route of the module's own that it calls to read or change configuration (test a connection, store a key) starts with assertModuleAdmin(ctx) from @shadestack/module-sdk/server. Not the module's own action: those can be granted to editors and to custom roles, and hiding the tab is no check.
    { method: 'POST', path: '/check-connection', handler: async (ctx) => {
      assertModuleAdmin(ctx) // FORBIDDEN unless an admin: module configuration
      return { ok: await pingProvider(ctx) }
    } }
    
  • A part that fails stays on its own. Each is mounted in an error boundary: when it fails to load, or throws while it sets up, renders or handles an event, a short notice takes its place (naming the part and the module, never the error) and the screen goes on. The error goes to the error log as package:<name>, with the part (widget to-ship) and the admin's path, marked as reported by a browser: the admins' alert emails count it, never quote it, and it stays in groups of its own, apart from the module's server-side errors. Errors the code raises outside Vue (a timer, a promise nobody waits for) are not caught: catch those yourself.
  • Checked when the module loads, like every part of the manifest: an admin key SHADE doesn't know (at any level, such as a widget's requries), an id that isn't kebab-case or comes twice, a file outside the module's folder or not .vue, an unknown or undeclared action in requires, another module's collection or the pages in panels, requires on a settings section, a page, sidebar link or badge with a . or .. segment, //, a backslash or %, and a locales folder outside the module's all stop the module from loading, with every problem listed.
  • No new consent, but listed. These parts run in the editor's browser with the editor's rights, as a module's pages always did; they are listed under the adminPlaces capability for information, and an update that adds one asks nothing again. Unlike pages they run without being opened (a widget whenever an editor who may see it opens the dashboard), so shade-module build writes where the module shows (adminPlaces: its widgets, the collections of its panels, its settings sections) into the package, and the install screen lists them under "Where it shows in the admin". The API leaves out a package whose manifest shows in more places than that list.
  • Untrusted modules have none of them: they keep admin pages described with fields.

The top bar

Every admin screen starts with the admin's top bar, a module's too: AdminTopBar in the panel's header slot, with the screen's title (its one h1) and the screen's own buttons in the right slot.

<UDashboardPanel id="orders">
  <template #header>
    <AdminTopBar :title="t('commerce.orders.title')">
      <template #right>
        <UButton :label="t('commerce.orders.export')" @click="exportOrders" />
      </template>
    </AdminTopBar>
  </template>
  <template #body>…</template>
</UDashboardPanel>

The bar adds the rest itself, the same on every screen: on a phone or tablet the button that opens the menu, where the screen is (its section or group, and on an item's screen a link to the list above it, which replaces a back button of your own), search, what waits in the Inbox and a link to the site. The screen above is the sidebar link your page's address is under (/modules/shop/orders/42 goes back to a sidebar link /modules/shop/orders); when the address doesn't say it, name it yourself with parent, as the import screens do for the collection they import into (:parent="{ label: 'Posts', to: '/collections/posts' }"), or pass :parent="null" for none, as a tab beside its siblings does.

Don't draw Nuxt UI's UDashboardNavbar yourself: a screen with one loses all of that, and shade-module build refuses a page that draws it or has no AdminTopBar. A fullScreen page is the exception: it has the whole window and brings its own header. shade-module init writes a page this way.

Forms from the admin's field components

A module's screens build their forms from SHADE's own components (ADMIN_HOST_COMPONENTS, shade/features/packages/shared/admin-host.ts), by name in a template:

  • FieldForm: a form from a list of field descriptors, <FieldForm v-model="values" :fields="fields" :issues="issues" />. issues are a VALIDATION answer's (apiErrorOf(error)?.issues), shown next to their fields; issue-prefix strips a prefix from their paths, disabled locks every field. Put it in a <form> or UForm to submit it; give a UForm :validate-on="['input', 'change']", as core's forms have, so focusing an empty field and leaving it shows no error.
  • AdminFormGrid: the cards of a form or settings page in columns of at least 22 rem that fill the page, <AdminFormGrid><UCard>…</UCard><UCard>…</UCard></AdminFormGrid>. A card stays whole in one column; give an item the class form-grid-wide to span the row. FieldForm already lays its fields out this way, so it needs no AdminFormGrid around it. Admin pages fill the width of the sheet, so a page sets no maximum width of its own, and running text keeps a reading measure of about 70 characters.
  • FieldRenderer: one field, with its label, help and the server's message for it (field, v-model, path).
  • RelativeTime: how long ago a moment was, for a list (<RelativeTime :value="order.createdAt" />), with the exact moment on hover. Lists show it; details, logs and scheduled times show formatDate, as the admin's own screens do.
  • The field editors, one per field kind (FieldText, FieldTextarea, FieldSelect, FieldToggle, FieldDate, FieldNumber, FieldImage, FieldFile, FieldLink, FieldRelation, FieldGroup, FieldRepeater, FieldRichText, FieldJson): field, v-model. FieldJson shows how much a json field holds and which module checks it; the module's own screen edits it (the website editor a page's content).

apps/admin/test/app/module-host.test.ts checks the admin has every one of them, and that every field kind's editor is on the list.

Admin patterns

Beside the field components, the admin lends a module's screens its patterns: the pieces Nuxt UI doesn't have, built from Nuxt UI and the admin's theme only, so a module's stats screen looks like the admin's (SHADE decision 0012 point 16). Use them by name, as the field components. StatCard, StatRow, RankList, BarChart, CopyField, SettingRow and ConnectionCard are experimental: each may change in a minor version until a second, different module's screen uses it; the others are stable. Buttons, inputs, selects, badges, tabs and modals stay Nuxt UI's own (UButton, USelect…); SHADE doesn't wrap them.

  • PageHeader: the top of a page's body, below the top bar's title: title, lead, an optional note (with note-icon) and the page's controls in the actions slot.
  • StatCard in a StatRow (columns: 2 to 4): a figure in mono, label, value (a number is written in the admin's language), help, and with previous the change on the period before in words ("20% more"), with compared saying which period.
  • RankList: ranked values with a bar behind each, items of { label, value, detail?, title?, key? }, mono for paths and codes, empty for the text without items, and a label slot.
  • BarChart: bars in one colour, oldest on the left, with a line of text (the total and the highest bar) and a "Show as a table" view: items of { key, label, value, more? }, caption, label-header, value-header, columns for the figures of more, :table="false" for a widget that links to a full report, and size (md or sm).
  • CopyField: a value to copy (a script tag, a key), value, label, masked to hide it until "Show" is pressed, and failed-text for when the browser refuses to copy.
  • SectionLabel: the mono, uppercase label above a group or a card's content; as is its element (h3 for a section heading).
  • SettingRow: one on/off setting, label, description (one line of what it does), error, name (for a UForm), disabled, v-model and a hint slot beside the label. A form's toggle fields are drawn as one already, a module's settings among them, so give a toggle field a short help.
  • ConnectionCard: an outside service the module connects to, name, connected, icon, description, account, receives (the data it gets, listed before anyone connects), busy and disabled; it emits connect and disconnect for the screen to handle, and its default slot takes anything else (a last sync).
  • StatusBadge: a state in a dot and its word, label, status and tones, the screen's one map of its states to success, warning, error, info or neutral (a state the map doesn't name is neutral); or tone directly.
  • ListDetail: a list and its selected item, v-model:open, title and description; the list (a UTable, keeping wideOnly and phoneLine) in the default slot, the item in detail. From 64rem wide the item opens beside the list and takes the focus, and Escape or its close button gives the focus back; narrower, it opens as a sheet. The screen keeps which item is selected.
  • Timeline: what happened, when and by whom or what, in the order given (oldest first), items of { key, title, at?, by?, detail?, tone? } (at an ISO time; an entry without one says nothing of when), empty, and a detail slot.
  • KeyValue: label and value rows, items of { key, label, value?, mono? }; a row without a value is left out, so pass every fact and only those there show. A slot named by an item's key draws its value (a badge, a link).
  • ContactPanelList: the body of a contact panel, what the module keeps about one person: items of { key, title, mono?, detail?, value?, status? } (title the row's lead, such as a date or a number, mono for an id, value at the end in tabular figures, status a { label, tone } drawn as a StatusBadge), empty, more (your own words for the ones not shown, such as "and 3 older orders"), to and open (the link to your screen and its label), pending and error from the fetch; it emits retry.

The analytics module's report is built from them, and the shop's orders screen from ListDetail, StatusBadge, KeyValue and Timeline; the forms inbox uses the same four, the appointments screen ListDetail, StatusBadge and KeyValue, error forwarding's settings a Timeline of its last sends, and the shop's and the appointments' contact panels ContactPanelList. In development, the admin's component gallery (/gallery) shows each in its states, in light and dark.

The site part

site/index.ts may export head: an Astro component the site's layout renders in every page's <head> while the module is on, with SiteHeadProps from @shadestack/module-sdk/site (accountApiUrl, locale, preview). The content API's site data lists the modules that are on (modules). An inline script or <style> in it is hashed into the page's Content-Security-Policy, as everything inline in the <head> is; a style attribute is not (only an Image's focal point is allowed). Render nothing in the team's preview unless it belongs there.

A site part imports the responsive Image from @shadestack/astro/site, the kit's. The SDK's site entry no longer gives it (24 November 2026, decision 0016 point 12), and the SDK doesn't depend on @shadestack/astro.

Pages are node trees. A website page's content is a json field the website module checks (website:tree): getEntry(ctx, 'website-pages', id).data.content, a page version's content and an entry event's event.data.entry.data.content are a NodeTree (from @shadestack/module-sdk/shared, with TreeNode), its nodes the top-level elements and component instances. There are no blocks (no defineBlock, no blocks part in the manifest): what a module shows on a page it gives the editor as a starter component. The new editor's styles (@shadestack/styles) keep the theme's custom properties as their default variables, with the same names and values (--color-primary, --font-body, --space-4, --radius…), so a module's components that style themselves with them keep working; a page's own variables and classes come on top. Styles refuse class ids and variable names starting with shade- (and classes starting with site-): those are SHADE's own. A module's classes are not kept from styles, so a site's class with the same name styles them too; name them after the module (my-plugin-booking) so that only happens on purpose.

Modules' routes from the new editor's pages. An element inside a client island can call a module's public or account route when it is clicked or a form is sent (the callRoute action): { action: 'callRoute', module: 'wishlist', route: '/items', method: 'POST', body: { slug: <expression> } }. The page's runtime makes the call with callAccountRoute, so it goes through the same dispatcher, session, origin check and rate limits as any other (see above). The tree is saved only when the API confirms the module has that route with auth: 'account' or 'public' (validateTree's visitorRoutes); a route path can't leave the module's routes. Treat the body as any visitor input: validate it with the route's schema.

What a route answers. A public or account route may say what it answers, as a zod schema of what a page can show: objects, lists, text (z.url() for an address), numbers and on/off, each maybe nothing (.nullable(), .optional()). Give dates and times as ISO text (z.iso.date(), z.iso.datetime()): a page writes them with formatDate in its own language and the site's time zone. Give them as plain text too (id) where a page needs a key or a value to send: a date is not text to the page.

{
  method: 'GET',
  path: '/slots',
  auth: 'public',
  rateLimit: { limit: 120, windowMs: 600_000, key: 'ip' },
  answer: z.object({ days: z.array(z.object({ label: z.string(), times: z.array(z.object({ start: z.string(), label: z.string() })) })) }),
  handler: (ctx, request) => listSlots(ctx, parseInput(SlotsQuery, request.query))
}
  • SHADE checks every answer against it before sending it, and sends what it parsed: keys the schema doesn't name are left out. An answer that doesn't fit is your bug: a 500, in the error log, never sent. The OpenAPI document describes it.
  • The loader refuses an answer on a session or token route, and one a page can't show: a union of types, a date object, a record (fields that aren't named), a field named like constructor, more than 8 levels or 64 fields.
  • On a page, an interactive part keeps it in a state of type answer that names the route; callRoute's result puts it there, its query sends values in the address (?offset=14), its form sends a form of the part (its controls by name, website, elapsedMs and the ticked consent box's label, then body on top; POST, PUT or PATCH only), and its status says how the call went (sending, then done, refused, busy or failed). A call to an idempotent route sets idempotent: the runtime sends an Idempotency-Key it keeps for that action until a call of it is done. A POST, PUT or PATCH call may set challenge: true: before sending, the runtime fetches the same module's public GET /challenge route, solves the proof of work (ALTCHA) in the browser with solveChallenge (@shadestack/client/challenge) and sends the answer as the body field altcha, so a bot pays in CPU time. A GET call may repeat ({ every: 2–60 seconds, while: <condition> }) after it went well, for two minutes at most; with realtime: true too, it also asks again as soon as the route says its answer changed (see Realtime updates below), and every is only the safety net. Name your inputs so a form's controls can carry them: a control can't be called name, location or another property of the page or a form (fullName, locationId). The call goes to SHADE's account API (the page's shade-account-api address) with the visitor's cookie; public routes take that from the site's own origin. Bindings into the answer are checked when the page is saved (findVisitorRoute(plugin, method, path) gives the type, validateTree's visitorRoutes).
  • Text, number and on/off state may be kept: in the visitor's browser, shared by every island of the site with a kept state of that name and type. kept: true stays in local storage: keep an id there, never personal data (a cart's id, with the cart on your side). kept: 'session' stays in session storage and is gone when the browser closes: use it for what a visitor typed and a module's islands share, such as an address looked up by one island and shown by another. Islands that share a name use the same kind, and clear the state when it has done its work (an order was placed).

Contributions: data for another module. A module hands another module data by its name, without requiring it: the website editor takes starter components this way.

// appointments
contributes: { website: { starters: [{ name: 'appointments-booking', label: t('starters.booking.label'), … }] } }

// website
accepts: { starters: ContributedStarters }
// in a service:
const given = moduleContributions('website', 'starters') // [{ module: 'appointments', value: [...] }]
  • A starter is built with the website module's SDK, @shadestack/module-website/sdk (el, words, show, when, each, slot, use, on, tree, literal, bound, formula; v, rem, px, style, sides, radius…; and the starter helpers routeCall, stateIs, outcomes, introHead, themeButton…), which the module takes as an optional peer and bundles, and checked in the module's tests as the editor would check it when an admin adds it: checkComponent(starter, { uses: STARTERS }) from @shadestack/module-website/sdk/testing, after loadModules([plugin], …) so its data sources and visitor routes are known (commerce and appointments: server/starters.test.ts). Its styles read the default theme's variables. See The website module's SDK for the optional peer and the version check.
  • A starter may declare one pick, pick: { source, parameter, prop, label }: on the Components screen the admin chooses from the data source source (for example the published forms), under the question label; the starter is added once per choice, and the choice is the source's parameter and the component's prop prop. The forms module's Form starter is made this way (Forms).
  • Every text in a starter is a key in the giving module's locale files, written t('starters.booking.label') (batch ES2; see Texts for visitors): the website module reads labels and descriptions in the admin's language and the words it places on pages in each of the site's languages, so a starter speaks a new language once its module has the file.
  • It counts only while both modules are installed and on. Neither requires the other: a client who uses bookings without website editing installs bookings alone. The appointments module's server/starters.ts is a worked example: two starter components as data, their formulas written as expression trees ({ type: 'path', root: 'state', keys: ['slots', 'days'] }).
  • contributes is plain JSON, at most 256 KB in all, under module names and keys such as starters; untrusted modules may contribute too (a sandbox package's contributes). accepts gives each key's zod schema, trusted modules only.
  • The receiver's schema parses each contribution when it is read, never at start: what doesn't fit is left out, and contributionIssues(name, key) says why. What the receiver then does with it is its own to check: the website module checks a given component as any component and refuses raw HTML in it.

MCP tools

Each tool is an McpToolSpec (ModuleMcpToolSpec) plus exposure. defineMcpTool(spec, exposure?) builds the manifest's entry (safe-for-ai unless you say admin-only) and holds the one cast the input's type needs, so a module's list of tools needs none (experimental):

  • safe-for-ai — registered on the MCP server. Its action must be granted to the ai role (a module's own collections' actions count when the collection's access.ai grants them) and must not be a publishing or deleting action of any collection, nor an account, token, settings or rebuild action. A tool with readOnly: true needs a .read action, and one that writes may not have one: a write gated only by a read permission is refused when the module loads.
  • destructive: true marks a write that removes something (the website module's website_remove_node_from_draft). The AI client sees it as the MCP annotation destructiveHint and may ask before calling it.
  • admin-only — never exposed over MCP. Commerce's order tool is admin-only because orders contain customers' personal data.

Details

  • Admin languages: built on @nuxtjs/i18n (apps/admin/nuxt.config.ts), strategy no_prefix, locales en (en-GB) and nl (nl-NL), default en. apps/admin/app/plugins/admin-locale.ts picks the saved choice (cookie shade_admin_locale, one year), else the first browser language the admin has, else English. Nuxt UI's texts (app.vue) and browser-side Zod messages (modules/zod-locale.ts) follow the admin language ("Required" / "Not a valid value" instead of Zod's wording). Every UForm has :validate-on="['input', 'change']", held by apps/admin/test/checks/forms.test.ts. Texts: the shell's in apps/admin/i18n/locales/{en,nl}.json, each feature's in shade/features/<name>/admin/locales, each module's through its manifest; apps/admin/test/checks/locales.test.ts checks every key exists in both languages.