Plugin contracts and extension points β
This page is Plugin Development β Backend β Advanced: what plugin contracts are, how they relate to the rest of the backend plugin surface, and where to implement them. For file layout and step-by-step wiring, follow the Golden Path β Backend.
Plugin contracts β
A plugin contract is a named service object your plugin registers so other plugins (or core) can call it without going through HTTP. Typical uses: shared helpers, cross-plugin orchestration, or stable βAPI surfacesβ that stay versioned with your npm package.
- You choose the contract id and the shape of the exported object (method names are entirely up to you).
- Registration happens from backend code β see Plugin
index.tsfor whereregisterPluginContractfits in the startup sequence. - Convention still helps: if your service methods mirror predictable CRUD-style names (
get,getAll,create,update,delete, β¦), other plugins and future generic tooling have a much easier time consuming your contract. The Golden Path β Service page ties this to routes and payloads.
For cross-plugin patterns in more depth (naming, evolution), see Cross-plugin communication on Service.
Other extension points (same backend plugin) β
Beyond contracts, a backend plugin usually touches several registration hooks that the loader and generators observe:
- HTTP routes β
fastify.get/post/ β¦ plus racletteconfigon each route (store action type, broadcast channels). See Routes. - Payload handlers β how stored documents become UI-facing payload rows. See Helpers.
- Schemas β TypeBox (or other) registration for validation and shared typing. See Schema.
- Frontend generation β
registerForFrontendGeneration/ automatic registration andgenerated-config.ts. See Frontend entity mapping, the generated config FAQ, and Backend overview βgenerated-configlifecycle.
Full backend reference (single document) β
The Plugin Backend Side guide is still available as one consolidated document alongside the split between Fundamentals, Backend overview, and Golden Path; use it when you want the whole backend side story in linear form.