diff --git a/www/apps/api-reference/markdown/admin.mdx b/www/apps/api-reference/markdown/admin.mdx index 9301938695508..64a1f360fa785 100644 --- a/www/apps/api-reference/markdown/admin.mdx +++ b/www/apps/api-reference/markdown/admin.mdx @@ -832,7 +832,7 @@ If you click on the workflow, you'll view a reference of that workflow, includin This is useful if you want to extend an API route and pass additional data or perform custom actions. -Refer to [this guide](https://docs.medusajs.com/learn/customization/extend-models/extend-create-product) to find an example of extending an API route. +Refer to [this guide](https://docs.medusajs.com/learn/customization/extend-features/extend-create-product) to find an example of extending an API route. diff --git a/www/apps/book/app/learn/customization/extend-models/create-links/page.mdx b/www/apps/book/app/learn/customization/extend-features/create-links/page.mdx similarity index 100% rename from www/apps/book/app/learn/customization/extend-models/create-links/page.mdx rename to www/apps/book/app/learn/customization/extend-features/create-links/page.mdx diff --git a/www/apps/book/app/learn/customization/extend-models/define-link/page.mdx b/www/apps/book/app/learn/customization/extend-features/define-link/page.mdx similarity index 100% rename from www/apps/book/app/learn/customization/extend-models/define-link/page.mdx rename to www/apps/book/app/learn/customization/extend-features/define-link/page.mdx diff --git a/www/apps/book/app/learn/customization/extend-models/extend-create-product/page.mdx b/www/apps/book/app/learn/customization/extend-features/extend-create-product/page.mdx similarity index 99% rename from www/apps/book/app/learn/customization/extend-models/extend-create-product/page.mdx rename to www/apps/book/app/learn/customization/extend-features/extend-create-product/page.mdx index 17c0f3e165ef9..62148eb1221d6 100644 --- a/www/apps/book/app/learn/customization/extend-models/extend-create-product/page.mdx +++ b/www/apps/book/app/learn/customization/extend-features/extend-create-product/page.mdx @@ -30,7 +30,7 @@ It's useful when you want to pass custom data, such as the brand ID, then perfor }, { text: "Defined link between the Brand and Product data models.", - link: "/learn/customization/extend-models/define-link" + link: "/learn/customization/extend-features/define-link" } ]} /> diff --git a/www/apps/book/app/learn/customization/extend-features/page.mdx b/www/apps/book/app/learn/customization/extend-features/page.mdx new file mode 100644 index 0000000000000..8cea08345e77b --- /dev/null +++ b/www/apps/book/app/learn/customization/extend-features/page.mdx @@ -0,0 +1,25 @@ +export const metadata = { + title: `${pageNumber} Extend Core Commerce Features`, +} + +# {metadata.title} + +In the upcoming chapters, you'll learn about the concepts and tools to extend Medusa's core commerce features. + +In other commerce platforms, you extend core features and models through hacky workarounds that can introduce unexpected issues and side effects across the platform. It also makes your application difficult to maintain and upgrade in the long run. + +Medusa's framework and orchestration tools mitigate these issues while supporting all your customization needs: + +- [Module Links](../../advanced-development/module-links/page.mdx): Link data models of different modules without building direct dependencies, ensuring that the Medusa application integrates your modules without side effects. +- [Workflow Hooks](../../advanced-development/workflows/workflow-hooks/page.mdx): inject custom functionalities into a workflow at predefined points, called hooks. This allows you to perform custom actions as a part of a core workflow without hacky workarounds. +- [Additional Data in API Routes](../../advanced-development/api-routes/additional-data/page.mdx): Configure core API routes to accept request parameters relevant to your customizations. These parameters are passed to the underlying workflow's hooks, where you can manage your custom data as part of an existing flow. + +--- + +## Next Chapters: Link Brands to Products Example + +The next chapters explain how to use the tools mentioned above with step-by-step guides. You'll continue with the [brands example from the previous chapters](../custom-features/page.mdx) to: + +- Link brands from the custom [Brand Module](../custom-features/module/page.mdx) to products from Medusa's [Product Module](!resources!/commerce-modules/product). +- Extend the core product-creation workflow and the API route that uses it to allow setting the brand of a newly created product. +- Retrieve a product's associated brand's details. diff --git a/www/apps/book/app/learn/customization/extend-models/query-linked-records/page.mdx b/www/apps/book/app/learn/customization/extend-features/query-linked-records/page.mdx similarity index 98% rename from www/apps/book/app/learn/customization/extend-models/query-linked-records/page.mdx rename to www/apps/book/app/learn/customization/extend-features/query-linked-records/page.mdx index 3a4ba06e02440..2d357f46dadd1 100644 --- a/www/apps/book/app/learn/customization/extend-models/query-linked-records/page.mdx +++ b/www/apps/book/app/learn/customization/extend-features/query-linked-records/page.mdx @@ -28,7 +28,7 @@ Query is a utility that retrieves data across modules and their links. It’s re }, { text: "Defined link between the Brand and Product data models.", - link: "/learn/customization/extend-models/define-link" + link: "/learn/customization/extend-features/define-link" } ]} /> diff --git a/www/apps/book/app/learn/customization/extend-models/page.mdx b/www/apps/book/app/learn/customization/extend-models/page.mdx deleted file mode 100644 index 875dfd60fee59..0000000000000 --- a/www/apps/book/app/learn/customization/extend-models/page.mdx +++ /dev/null @@ -1,40 +0,0 @@ -export const metadata = { - title: `${pageNumber} How to Extend Data Models`, -} - -# {metadata.title} - -In this chapter, you'll learn about Medusa's alternative approach to extending data models. - -## Extend Models Alternative: Module Links - -Since modules are isolated from one another, it's not possible to directly extend a module's data models. - -Instead, you define a link between the modules' data models. - -### Why are Modules Isolated? - -Some of the module isolation's benefits include: - -- Integrate your module into any Medusa application without side-effects to your setup. -- Replace existing modules with your custom implementation, if your use case is drastically different. -- Use modules in other environments, such as Edge functions and Next.js apps. - -### How does Medusa Manage Module Links? - -When you define a link, the Medusa application creates a table in the database for it. - -Then, when you create a link between two records, the Medusa application stores the IDs of the linked records in that table. - -Medusa also provides the necessary tools to manage and query the linked records, which you'll learn about in the next chapters. - ---- - -## Next Chapters: Link Brands to Products Example - -The next chapters continue the brands example. It shows you how to: - -- Link a brand, which you defined in a [previous example](../custom-features/module/page.mdx), to a product. -- Manage linked records between the brands and products. -- Extend Medusa's Create Product API route to link a product to a brand. -- Query linked brands and products. \ No newline at end of file diff --git a/www/apps/book/generated/edit-dates.mjs b/www/apps/book/generated/edit-dates.mjs index d536e4c167549..d70daef569df2 100644 --- a/www/apps/book/generated/edit-dates.mjs +++ b/www/apps/book/generated/edit-dates.mjs @@ -92,15 +92,15 @@ export const generatedEditDates = { "app/learn/customization/custom-features/api-route/page.mdx": "2024-11-28T13:12:10.521Z", "app/learn/customization/custom-features/module/page.mdx": "2024-11-28T09:25:29.098Z", "app/learn/customization/custom-features/workflow/page.mdx": "2024-11-28T10:47:28.084Z", - "app/learn/customization/extend-models/create-links/page.mdx": "2024-09-30T08:43:53.133Z", - "app/learn/customization/extend-models/extend-create-product/page.mdx": "2024-09-30T08:43:53.134Z", + "app/learn/customization/extend-features/create-links/page.mdx": "2024-09-30T08:43:53.133Z", + "app/learn/customization/extend-features/extend-create-product/page.mdx": "2024-09-30T08:43:53.134Z", "app/learn/customization/custom-features/page.mdx": "2024-11-28T08:21:55.207Z", "app/learn/customization/customize-admin/page.mdx": "2024-09-12T12:25:29.853Z", "app/learn/customization/customize-admin/route/page.mdx": "2024-10-07T12:43:11.335Z", "app/learn/customization/customize-admin/widget/page.mdx": "2024-10-07T12:44:24.538Z", - "app/learn/customization/extend-models/define-link/page.mdx": "2024-09-30T08:43:53.134Z", - "app/learn/customization/extend-models/page.mdx": "2024-09-12T12:38:57.394Z", - "app/learn/customization/extend-models/query-linked-records/page.mdx": "2024-09-30T08:43:53.134Z", + "app/learn/customization/extend-features/define-link/page.mdx": "2024-09-30T08:43:53.134Z", + "app/learn/customization/extend-features/page.mdx": "2024-09-12T12:38:57.394Z", + "app/learn/customization/extend-features/query-linked-records/page.mdx": "2024-09-30T08:43:53.134Z", "app/learn/customization/integrate-systems/handle-event/page.mdx": "2024-09-30T08:43:53.135Z", "app/learn/customization/integrate-systems/page.mdx": "2024-09-12T12:33:29.827Z", "app/learn/customization/integrate-systems/schedule-task/page.mdx": "2024-09-30T08:43:53.135Z", diff --git a/www/apps/book/next.config.mjs b/www/apps/book/next.config.mjs index f460bf4d23591..a6a91336ba325 100644 --- a/www/apps/book/next.config.mjs +++ b/www/apps/book/next.config.mjs @@ -160,18 +160,23 @@ const nextConfig = { { source: "/recipes/:path*", destination: "/resources/recipes", - permanent: true + permanent: true, }, { source: "/plugins/:path*", destination: "/v1/plugins/:path*", - permanent: true + permanent: true, }, { source: "/medusa-react/:path*", destination: "/v1/medusa-react/:path*", - permanent: true - } + permanent: true, + }, + { + source: "/learn/customization/extend-models/:path*", + destination: "/learn/customization/extend-features/:path*", + permanent: true, + }, ] }, } diff --git a/www/apps/book/sidebar.mjs b/www/apps/book/sidebar.mjs index fd0616167d538..8d8f7ddd84cdc 100644 --- a/www/apps/book/sidebar.mjs +++ b/www/apps/book/sidebar.mjs @@ -115,28 +115,28 @@ export const sidebar = numberSidebarItems( }, { type: "link", - title: "Extend Models", - path: "/learn/customization/extend-models", + title: "Extend Features", + path: "/learn/customization/extend-features", children: [ { type: "link", title: "Define Link", - path: "/learn/customization/extend-models/define-link", + path: "/learn/customization/extend-features/define-link", }, { type: "link", title: "Create Links Between Records", - path: "/learn/customization/extend-models/create-links", + path: "/learn/customization/extend-features/create-links", }, { type: "link", title: "Extend Route", - path: "/learn/customization/extend-models/extend-create-product", + path: "/learn/customization/extend-features/extend-create-product", }, { type: "link", title: "Query Linked Records", - path: "/learn/customization/extend-models/query-linked-records", + path: "/learn/customization/extend-features/query-linked-records", }, ], }, diff --git a/www/apps/resources/app/examples/page.mdx b/www/apps/resources/app/examples/page.mdx index 6d5e36777afc8..d82e19ff17db6 100644 --- a/www/apps/resources/app/examples/page.mdx +++ b/www/apps/resources/app/examples/page.mdx @@ -378,7 +378,7 @@ In this example, you'll pass additional data to the Create Product API route, th -Find this example in details in [this documentation](!docs!/learn/customization/extend-models/extend-create-product). +Find this example in details in [this documentation](!docs!/learn/customization/extend-features/extend-create-product).