Skip to content

Add WASM module registry and admin panel extensibility via manifest convention#253

Open
zyrakq wants to merge 1 commit into
trailbaseio:mainfrom
zyrakq:feature/wasm-modules-page-in-admin-panel
Open

Add WASM module registry and admin panel extensibility via manifest convention#253
zyrakq wants to merge 1 commit into
trailbaseio:mainfrom
zyrakq:feature/wasm-modules-page-in-admin-panel

Conversation

@zyrakq

@zyrakq zyrakq commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Implements the extensibility described in #252.

What this adds:

  • GET /_/admin/wasm-modules — new API endpoint listing all loaded modules with their metadata
  • WASM Modules page in the admin at /wasm-modules — shows each module with icon, display name, and description
  • Optional manifest convention — a module responds at /_/wasm/<file-stem>/manifest with a JSON object: display_name, icon, description, config_path. The path segment must match the file-stem of the .wasm file; a mismatch means the manifest is silently ignored. This makes the contract opt-in and collision-free
  • Module settings page at /wasm-modules/:name — when a module declares a config_path, the admin fetches it with admin credentials and injects the returned HTML fragment. Script tags are re-cloned so module JS initializes correctly
  • is_admin check added to wasm-runtime-guest — since this feature opens the door to admin-panel extensions, module endpoints that serve management UI must be able to guard access. The project didn't previously need this in the guest crate, but shipping admin-facing modules without a built-in auth check would push that burden onto every extension author individually

Style isolation:

The settings fragment is injected directly into the admin page DOM, so TrailBase's own styles will bleed into it. Extension authors should wrap their settings UI in a Web Component using Shadow DOM to get full style isolation. This is the recommended approach for any config_path implementation.

Real-world example:

To verify the manifest convention end-to-end, wcauth-tb-component can be used as a test module — it already implements the manifest endpoint and exposes a settings page. Build it from source, place the resulting binary as wcauth.wasm in traildepot, and it should appear in the WASM Modules page with its manifest applied.

Compatibility:

Non-breaking. Modules without a manifest endpoint continue to work exactly as before and appear in the list using their file-stem as the display name.

Made loaded WASM modules visible to administrators
Allowed modules to present a branded identity in the dashboard
Enabled modules to surface their own configuration UI in admin
Equipped module authors with built-in admin access control

Turn WASM into a first-class extension model for the admin
Remove the need for a separate admin interface per extension
Spare module authors from re-implementing admin access control
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant