Context
Every model needs the same create, read, update, delete, list and restore code. Medusa’sMedusaService generates eight
CRUD methods per model. The first wording of 0098 generated only actions and no services;
the owner then chose generated CRUD services as part of the Medusa port.
Decision
@Crudon a module service generates its CRUD methods for the named models, on the rich CRUD API of 0097: retrieve, list, list-and-count, create, update, delete, soft-delete and restore, with list filtering, sorting and includes.- The generated methods are inherited, not written to disk, and a hand-written method of the same name overrides one.
@Crudalso generates opt-in actions that call those methods, each with akey@version, permission, risk level andactorslike any action. An action is generated only when the decorator lists it.- No controllers are generated. Exposure is the adapters of 0098.
Consequences
- Module services expose the same CRUD vocabulary everywhere, which workflows’ steps call.
- Generated actions still need reviewers to check the permission and risk on each.
Enforcement
Planned: a conformance test per generated method in@stackra/database; the gen validation pass applies the action rules of
0098 to generated actions. Nothing checks this today.
Supersedes and sources
Supersedes: none. Amends 0098 decision 4 (which now points here). Sources: owner decision in chat, 2026-10-19 (Round 11 W4, “Generated CRUD services”). Informational: MedusaMedusaService.