docs: improvements + additions to module docs (#9152)
- Split Module and Module Links to their own chapters - Add new docs on db operations and transactions in modules, multiple services, links with custom columns, etc... - Added a list of registered dependencies in a module container
This commit is contained in:
@@ -10,20 +10,12 @@ In this chapter, you’ll learn about modules, their main service, and how to cr
|
||||
|
||||
A module is a package of reusable commerce or architectural functionalities. It's integrated as a building block in your Medusa application, without implications on the existing setup.
|
||||
|
||||
You create a module to introduce custom features, extend existing ones, or integrate third-party services.
|
||||
A module has a service, which is a class that can connect to the database or third-party systems to provide custom features. The service's methods are then used by other resources, such as API routes.
|
||||
|
||||
---
|
||||
|
||||
## How to Create a Module?
|
||||
|
||||
<Note title="Steps Summary">
|
||||
|
||||
1. Create module's main service.
|
||||
2. Create module definition.
|
||||
3. Add module to Medusa's configurations.
|
||||
|
||||
</Note>
|
||||
|
||||
Modules are created in a sub-directory of `src/modules`.
|
||||
|
||||
For example, create the directory `src/modules/hello`.
|
||||
@@ -154,7 +146,8 @@ You’ll receive the following response:
|
||||
|
||||
<Note title="Use modules when" type="success">
|
||||
|
||||
- You're implementing a custom commerce feature. For example, you're implementing digital products.
|
||||
- You're adding new tables to the database, as explained in later chapters.
|
||||
- You're integrating a third-party system for commerce or architectural features.
|
||||
- You want to re-use your custom commerce functionalities across Medusa applications or use them in other environments, such as Edge functions and Next.js apps.
|
||||
|
||||
</Note>
|
||||
|
||||
Reference in New Issue
Block a user