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

SHADE

Writing a module

These pages are about trusted modules, which run inside the API. Modules an admin uploads run in a sandbox and are written differently: see Untrusted modules.

To build a client's own module from the first command to a server package, follow Build a client module; these pages are the reference it links to:

  • Module SDK and tooling: the SDK and its versions, the SHADE workspace, starting a repository, texts, browser tests, development mode, packaging, signing and installing.
  • The manifest: what a module declares, its naming rules, permissions, settings, and modules that build on others.
  • Routes: its API routes, raw bodies for webhooks, and outside hosts.
  • Admin screens and the site part: where it appears in the admin, its site part, MCP tools.
  • Content: its tables, collections, read models, paths, previews, rebuilds, media, accessibility, content services and the events other modules raise.
  • Background work and services: core's events, schedules, events between modules, jobs, kv, webhooks, live updates, files, notifications, processes, health, retention, consent, personal data and client programs.
  • Incoming webhooks: verifying a provider's calls (Stripe, Standard Webhooks, plain HMAC, fetching back), the replay window, rotating secrets and each delivery once.
  • Calls between modules: provides and callModule, with the payments module as the example, and the events the module that offers the calls sends back.
  • Connecting accounts with OAuth2: the manifest part oauth, an admin connecting an account, and calling the provider's API with tokens SHADE keeps, refreshes and revokes.
  • Experimental parts: every part that may still change in a minor version, what it is, and the official modules that use it.
  • The website module's SDK: for a module that gives the website editor starter components, and how its data stays reachable without the website module.

A module adds a self-contained feature to SHADE — tables, API routes, admin pages, permissions, collections, MCP tools, lifecycle hooks and schedules — without touching core. Each module lives in its own repository and reaches an instance as a signed package; the SHADE workspace joins the repositories for work. The official modules are website (shadehq-dev/shade-plugin-website, in the workspace at modules/website), appointments (modules/appointments), commerce (modules/commerce, with collections) and analytics (modules/analytics, with a head part on the site), error forwarding (modules/error-forwarding, the errorForwarding part) payments (modules/payments, calls to the modules that take money) and editorial (shade-plugin-editorial, modules/editorial: scheduled publish, review requests, releases, translation state and comments, built on core's entry extension points). The website module's repository is public from the first stable release; the others stay private and reach an instance as signed packages. Core never names a module: see Core never knows a module.

The complete example

One module uses every part of the manifest once, in a repository of its own: shadehq-dev/shade-module-example. It has its own tables and collection, routes for the team, the public and accounts, an admin screen, a site part, settings, a job, a schedule, events and the rest, each as small as the part allows. Its README says which file holds which part. Its browser tests send the requests to a running SHADE, so they show what each part does there. Copy the piece you need, then read the page about that part below. It is for reading: don't install it on a live instance.

Layout

The same parts as a core feature, plus the manifest and the module's own migrations:

Path (in modules/appointments/)What it holds
module.tsdefineModule({ … }), the manifest (default export)
module.test.tsThe manifest passes validateModule
drizzle.config.tsOwn migrations, own history table (pnpm db:generate)
migrations/
shared/Browser-safe: action names (+ ActionRegistry augmentation), Zod schemas, collections
server/appointments.sql.ts (tables, prefixed appointments_), service, routes, email
admin/AppointmentsPage.vue (Nuxt UI components and admin composables are auto-imported, like in apps/admin), locales/{en,nl}.json, labels.nl.json and errors.nl.json (see Its texts)
site/index.ts (an optional head) and its Astro components
e2e/Its browser tests against SHADE with it installed (see Its browser tests)
package.json, tsconfig.json, vitest.config.ts, README.md, LICENSE.md

Lint applies the feature rules: shared/, admin/ and site/ never import server code. Core never imports a module; modules build on core.

Core never knows a module

No code, table, migration, text, build step or test of SHADE names a module; core only offers manifest parts any module fills, and a module brings everything of its own (its collections' tables, texts, styles, tests). pnpm lint keeps it true with scripts/installed-module-names.mjs:

  • an ESLint rule, shade/no-installed-module-names, in both ESLint configs: a module's name in a string, template string or name is an error; in a comment it is fine;
  • the same check over every other file (texts, SQL, CSS, Vue and Astro templates, configuration), comments left out.

The names are the official modules' and those of every folder in the workspace's modules/. website is an everyday word too (Open Graph's og:type, "the website" in a sentence), so it is flagged only as the module names itself: its namespaces (website-…, website_…, website.…) and its folder (modules/website). Core's own tests use neutral names (example, bookings, shop) and the fixture modules in shade/test/testing/fixtures/modules (package-probe, a module with a table, a collection, an admin page and a head part; test-consent; entry-probe, collections with content in a json field, a menu and posts with item pages and an address source, for the content tests, since core has no built-in collections). Every capability a module can declare has a fixture there that uses it the way a planned module would, with a test: cache-probe keeps a booking module's free times, queue-probe sends a shop's invoice later, and so on. The folder's README.md lists which fixture and which test cover each capability. test/scripts/installed-module-names.test.ts tests the rule.

Turning a module on and off

Every server package (and, in development, every folder in SHADE_DEV_MODULES) loads on start: its migrations run, its permissions, routes, admin pages and collections are registered. The plugins table says which are on; admins switch them on the Modules page (packages.manage). A module that is off is unreachable, enforced on the server:

  • its actions are refused by can/assertCan, for admins too, so its sidebar entries and collections disappear;
  • its routes answer 404; its schedules and MCP tools stop, and the events it hears wait; its site part's head is left out of the pages.

A switch is announced to every process through Redis (the plugins message), which re-reads it at once, and every 60 seconds in case a message was lost (Redis and the ports). requires names modules that must be on first (and cannot be switched off, uninstalled or removed before this one); a module counts as off while one of them is off (see Modules that build on other modules). onEnable and onDisable run after a switch. Sidebar labels are translation keys (appointments.sidebar); badge names a route returning { count }, shown next to the entry.