|
1
|
export const metadata = { |
|
2
|
title: `${pageNumber} Modules Directory Structure`, |
|
3
|
} |
|
4
|
|
|
5
|
# {metadata.title} |
|
6
|
|
|
7
|
In this chapter, you'll learn about the expected files and directories in your module. |
|
8
|
|
|
9
|
 |
|
10
|
|
|
11
|
## index.ts |
|
12
|
|
|
13
|
The `index.ts` file is in the root of your module's directory and exports the module's definition as explained in the [Modules](../page.mdx) chapter. |
|
14
|
|
|
15
|
--- |
|
16
|
|
|
17
|
## service.ts |
|
18
|
|
|
19
|
A module must have a main service that contains the module's business logic. It's created in the `service.ts` file at the root of your module directory as explained in the [Modules](../page.mdx) chapter. |
|
20
|
|
|
21
|
--- |
|
22
|
|
|
23
|
## Other Directories |
|
24
|
|
|
25
|
The following directories are optional and you can choose to create them based on your module's functionality: |
|
26
|
|
|
27
|
- `models`: Holds the [data models](../../data-models/page.mdx) representing tables in the database. |
|
28
|
- `migrations`: Holds the [migration](../../data-models/write-migration/page.mdx) files used to reflect changes on the database. |
|
29
|
- `loaders`: Holds the [script files to run on the application's startup](../loaders/page.mdx) when Medusa loads the module. |