1 # Concept Definitions
2
3 When a concept is introduced for the first time in a tutorial step, include a 1-2 sentence definition before the implementation details. Use these verbatim (or adapt minimally for context). Always follow the definition with a `<Note>` linking to further documentation.
4
5 ---
6
7 ## Module
8
9 > **IMPORTANT:** If the Module is a Module Provider, use the definition for the specific provider instead. DO NOT add both definitions.
10
11 ```mdx
12 In Medusa, you can build custom features in a [module](!docs!/learn/fundamentals/modules). A module is a reusable package with functionalities related to a single feature or domain. Medusa integrates the module into your application without affecting your setup.
13
14 In the module, you define the data models necessary for a feature and the logic to manage these data models. Later, you can build commerce flows around your module.
15
16 <Note title="Tip">
17
18 Refer to the [Modules documentation](!docs!/learn/fundamentals/modules) to learn more.
19
20 </Note>
21 ```
22
23 ---
24
25 ## Data Model
26
27 ```mdx
28 A data model represents a table in the database. You create data models using Medusa's Data Model Language (DML), which simplifies defining a table's columns, relations, and indexes with straightforward methods and configurations.
29
30 <Note title="Tip">
31
32 Learn more about data models in the [Data Models documentation](!docs!/learn/fundamentals/data-models).
33
34 </Note>
35 ```
36
37 ---
38
39 ## Service
40
41 ```mdx
42 A service is a TypeScript or JavaScript class that the module exports. In the service's methods, you can connect to the database to manage your data models, or connect to a third-party service, which is useful when integrating with external systems.
43 ```
44
45 ---
46
47 ## Migration
48
49 ```mdx
50 Since data models represent tables in the database, you define how to create them in the database using migrations. A migration is a TypeScript or JavaScript file that defines database changes made by a module.
51 ```
52
53 ---
54
55 ## Module Links
56
57 ```mdx
58 Medusa integrates modules into your application without side effects by isolating them from one another. This means you can't directly create relationships between data models in your module and data models in other modules.
59
60 Instead, Medusa provides a mechanism to define links between data models and to retrieve and manage linked records while maintaining module isolation. Links are useful for defining associations between data models in different modules or for extending a model in another module to associate custom properties with it.
61
62 <Note>
63
64 Refer to the [Module Isolation documentation](!docs!/learn/fundamentals/modules/isolation) to learn more.
65
66 </Note>
67 ```
68
69 ---
70
71 ## Workflow
72
73 ```mdx
74 To build custom commerce features in Medusa, you create a [workflow](!docs!/learn/fundamentals/workflows). A workflow is a series of queries and actions, called steps, that complete a task. You can track the workflow's execution progress, define rollback logic, and configure other advanced features.
75
76 <Note>
77
78 Learn more about workflows in the [Workflows documentation](!docs!/learn/fundamentals/workflows).
79
80 </Note>
81 ```
82
83 ---
84
85 ## Workflow Hook
86
87 ```mdx
88 A hook is a specific point in a workflow where you can inject custom functionality.
89
90 <Note>
91
92 Refer to the [Workflow Hooks documentation](!docs!/learn/fundamentals/workflows/workflow-hooks) to learn more.
93
94 </Note>
95 ```
96
97 ---
98
99 ## API Route
100
101 ```mdx
102 An API route is created in a `route.ts` file under a sub-directory of the `src/api` directory. The path of the API route is the file's path relative to `src/api`.
103
104 <Note>
105
106 Refer to the [API routes](!docs!/learn/fundamentals/api-routes) documentation to learn more about them.
107
108 </Note>
109 ```
110
111 ---
112
113 ## Subscriber
114
115 ```mdx
116 A subscriber is an asynchronous function that runs in the background when specific events are emitted.
117
118 <Note>
119
120 Refer to the [Subscribers documentation](!docs!/learn/fundamentals/events-and-subscribers) to learn more.
121
122 </Note>
123 ```
124
125 ---
126
127 ## Admin Dashboard Customization (intro paragraph)
128
129 Use this when first introducing any Admin customization in a step:
130
131 ```mdx
132 The Medusa Admin dashboard is customizable, allowing you to insert widgets into existing pages, or create new pages.
133
134 <Note title="Tip">
135
136 Refer to the [Admin Development](!docs!/learn/fundamentals/admin) documentation to learn more.
137
138 </Note>
139 ```
140
141 ---
142
143 ## Admin UI Route (Page)
144
145 Use this when creating a new admin page:
146
147 ```mdx
148 A UI route is a React component that specifies the content to be shown in a new page in the Medusa Admin dashboard.
149
150 <Note>
151
152 Refer to the [UI Routes documentation](!docs!/learn/fundamentals/admin/ui-routes) to learn more.
153
154 </Note>
155 ```
156
157 ---
158
159 ## Scheduled Job
160
161 ```mdx
162 A scheduled job is a function that runs at a specified interval in the background of your Medusa application.
163
164 <Note>
165
166 Refer to the [Scheduled Jobs documentation](!docs!/learn/fundamentals/scheduled-jobs) to learn more.
167
168 </Note>
169 ```
170
171 ---
172
173 ---
174
175 ## Integration: Generic Module Provider Intro
176
177 Use this paragraph when first introducing the idea of creating a module to integrate a third-party service. Place it at the top of the step that creates the module provider:
178
179 ```mdx
180 To integrate third-party services into Medusa, you create a custom module. A module is a reusable package with functionalities related to a single feature or domain. Medusa integrates the module into your application without implications or side effects on your setup.
181
182 <Note>
183
184 Learn more about modules in [this documentation](!docs!/learn/fundamentals/modules).
185
186 </Note>
187 ```
188
189 ---
190
191 ## Integration: Notification Module Provider
192
193 Use after the generic module intro when the provider implements the Notification Module:
194
195 ```mdx
196 Medusa's Notification Module delegates sending notifications to other modules, called module providers. In this step, you'll create a [Service Name] Module Provider that implements sending notifications through the [channel, e.g., email] channel.
197
198 A Notification Module Provider's service must extend the `AbstractNotificationProviderService`. It has a `send` method that you'll implement to send notifications. The service must also have an `identifier` static property, which is a unique identifier that the Medusa application uses to register the provider in the database.
199
200 <Note>
201
202 Refer to the [Create Notification Module Provider](/references/notification/provider) guide for more details.
203
204 </Note>
205 ```
206
207 ---
208
209 ## Integration: Payment Module Provider
210
211 Use after the generic module intro when the provider implements the Payment Module:
212
213 ```mdx
214 Medusa's [Payment Module](../../../commerce-modules/payment/page.mdx) provides an interface to process payments in your Medusa application. It delegates the actual payment processing to the underlying providers.
215
216 A Payment Module Provider's service must extend the `AbstractPaymentProvider` class. It must also have a static `identifier` property that uniquely identifies the provider.
217
218 <Note>
219
220 Refer to the [Create Payment Provider](/references/payment/provider) guide for more details about the methods to implement.
221
222 </Note>
223 ```
224
225 ---
226
227 ## Integration: Fulfillment Module Provider
228
229 Use after the generic module intro when the provider implements the Fulfillment Module:
230
231 ```mdx
232 Medusa's Fulfillment Module delegates processing fulfillments and shipments to other modules, called module providers. In this step, you'll create a [Service Name] Module Provider that implements all functionalities required for fulfillment.
233
234 A Fulfillment Module Provider's service must extend the `AbstractFulfillmentProviderService` class.
235
236 <Note>
237
238 Refer to the [Create Fulfillment Provider](/references/fulfillment/provider) guide for more details about the methods to implement.
239
240 </Note>
241 ```
242
243 ---
244
245 ## Integration: Analytics Module Provider
246
247 Use after the generic module intro when the provider implements the Analytics Module:
248
249 ```mdx
250 Medusa's [Analytics Module](../../../infrastructure-modules/analytics/page.mdx) provides an interface to track events in your Medusa application. It delegates the actual tracking to the configured Analytics Module Provider.
251
252 An Analytics Module Provider's service must extend the `AbstractAnalyticsProviderService` class. It must also have an `identifier` static property with the unique identifier of the provider.
253
254 <Note>
255
256 Refer to the [Create Analytics Module Provider](/references/analytics/provider) guide for more details about the methods to implement.
257
258 </Note>
259 ```
260
261 ---
262
263 ## Integration: Auth Module Provider
264
265 Use after the generic module intro when the provider implements the Auth Module:
266
267 ```mdx
268 Medusa's [Auth Module](../../../commerce-modules/auth/page.mdx) provides the interface to authenticate users. It delegates the actual authentication logic to the underlying Auth Module Provider.
269
270 An Auth Module Provider's service must extend the `AbstractAuthModuleProvider` class. It must also have a `DISPLAY_NAME` static property for display in the UI, and an `identifier` static property with the unique identifier of the provider.
271
272 <Note>
273
274 Refer to the [Create Auth Module Provider](/references/auth/provider) guide for more details about the methods to implement.
275
276 </Note>
277 ```
278
279 ---
280
281 ## Integration: Custom Module (non-provider)
282
283 Use when the integration is built as a standalone custom module rather than a built-in module provider (e.g., a CMS, search engine, or custom third-party service):
284
285 ```mdx
286 To integrate third-party services into Medusa, you create a custom module. A module is a reusable package with functionalities related to a single feature or domain. Medusa integrates the module into your application without implications or side effects on your setup.
287
288 In this step, you'll create a custom module that provides the necessary functionalities to integrate [Service Name] with Medusa.
289
290 <Note>
291
292 Refer to the [Modules documentation](!docs!/learn/fundamentals/modules) to learn more.
293
294 </Note>
295 ```
296
297 ---
298
299 ## Usage Guidelines
300
301 - Only include a definition the **first time** the concept appears in the tutorial.
302 - Subsequent steps that use the same concept (e.g., a second workflow) do NOT repeat the definition.
303 - Adapt the definition sentence minimally for context — for example, replace "a tier" with the tutorial's actual entity name.
304 - Always follow definitions with a `<Note>` linking to the relevant documentation page.
305 - For integration guides: always use the **Generic Module Provider Intro** first, then add the module-specific definition below it (Notification, Payment, etc.).