|
1
|
# Module Links |
|
2
|
|
|
3
|
A module link forms an association between two data models of different modules, while maintaining module isolation. |
|
4
|
|
|
5
|
For example: |
|
6
|
|
|
7
|
```ts |
|
8
|
import HelloModule from "../modules/hello" |
|
9
|
import ProductModule from "@medusajs/medusa/product" |
|
10
|
import { defineLink } from "@medusajs/framework/utils" |
|
11
|
|
|
12
|
export default defineLink( |
|
13
|
ProductModule.linkable.product, |
|
14
|
HelloModule.linkable.myCustom |
|
15
|
) |
|
16
|
``` |
|
17
|
|
|
18
|
This defines a link between the Product Module's `product` data model and the Hello Module (custom module)'s `myCustom` data model. |
|
19
|
|
|
20
|
Learn more about links in [this documentation](https://docs.medusajs.com/learn/fundamentals/module-links) |