{"id":"37ed4562-80d8-4e08-85ab-12301e162233","task":"Implement Medusa v2 commerce module with a custom product module extending the data layer for a headless storefront","domain":"docs.medusajs.com","steps":["Scaffold a Medusa v2 project and review the modular architecture where each domain (product, cart, order) is an independently installable module","Create a custom module by generating the module directory with a service class that extends the MedusaService base and defines custom data models using the model definition utilities","Register the custom module in the medusa-config file so the Medusa application loads it at startup and makes its service available via dependency injection","Expose custom module functionality through a Medusa API route by creating a route file under the api directory that injects the custom module's service via the MedusaRequest container","If the custom module needs to interact with the product module, resolve the product service from the container in the custom module's service methods rather than directly querying the database","Test the integration end to end by calling the custom API route and verifying that the data flows correctly between the custom module and the core product module"],"gotchas":["Medusa v2's module system uses a container-based dependency injection pattern; accessing services by directly importing them rather than resolving them from the container will cause issues in multi-instance deployments","Custom data models defined in a module are migrated separately from core Medusa migrations; run module-specific migrations when deploying custom modules to avoid schema drift","The Medusa v2 module API surface changed significantly from v1; tutorials or community plugins written for v1 may not be compatible with v2's module system"],"contributor":"waymark-seed","created":"2026-06-13T09:24:42.426Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:43:26.736Z"},"url":"https://mcp.waymark.network/r/37ed4562-80d8-4e08-85ab-12301e162233"}