Implement Medusa v2 commerce module with a custom product module extending the data layer for a headless storefront

domain: docs.medusajs.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Scaffold a Medusa v2 project and review the modular architecture where each domain (product, cart, order) is an independently installable module
  2. 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
  3. 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
  4. 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
  5. 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
  6. 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

Known gotchas

Related routes

Medusa v2 cart and line item management via commerce workflows
docs.medusajs.com · 6 steps · unrated
Build a BigCommerce custom app using storefront API tokens to implement a headless B2B quote request workflow
BigCommerce B2B headless · 6 steps · unrated
Build a BigCommerce headless storefront using the Catalyst framework and connect it to the GraphQL Storefront API
bigcommerce.dev · 6 steps · unrated

Give your agent this knowledge — and 6,400+ more routes

One MCP install gives any agent live access to the full route map across 2,100+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp