cardinal-plugins
The middleware runtime.
What it does
- Tracks builtin middleware (
RestrictedRouteMiddleware, etc.) and user-supplied WASM plugins insidePluginContainer. - Executes middleware chains via
PluginRunner, respecting global order and destination-scoped middleware. - Wraps WASM modules by delegating to
cardinal-wasm-plugins.
Adding middleware
Rust
;
Register it by inserting into PluginContainer during bootstrap (either by editing the defaults or supplying a provider factory).
WASM
- Compile an AssemblyScript or Rust-compiled WASM file.
- Add it to configuration:
[[]]
= { = "my-filter", = "filters/my_filter.wasm" }
The runner validates exports (handle, __new) and executes it in inbound or outbound mode depending on where it’s registered.