Moonbase Plugin System
Extend the backend and frontend without touching core code.
Moonbase ships with two plugin runtimes: a backend loader for the API and a frontend runtime for the Next.js app. Backend plugins are loaded from disk at runtime; frontend plugins are compiled into the app and registered explicitly.
At a glance
Backend plugins
Drop a file in `api/plugins` and restart the API.
Frontend plugins
Add a plugin under `app/plugins` and register it in `app/plugins/registry.ts`.
Two runtimes
- Backend plugins run inside the API and can register routes, patch services, or listen to purchase flows.
- Frontend plugins run inside the app and can render UI, open modals, and block checkout via guards.
Pick the right runtime
Choose the backend for data and workflows, and the frontend for UI and flow control.
What a plugin can do
Extend the API
Add endpoints, middleware, or background logic.
Inject UI
Render UI in slots or portals without editing core pages.
Guard checkout
Validate prerequisites before payment starts.