3.3.1. Modules Directory Structure
In this chapter, you'll learn about the expected files and directories in your module.
index.ts#
The index.ts
file is in the root of your module's directory and exports the module's definition as explained in the Modules chapter.
service.ts#
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 chapter.
Other Directories#
The following directories are optional and you can choose to create them based on your module's functionality:
models
: Holds the data models representing tables in the database.migrations
: Holds the migration files used to reflect changes on the database.loaders
: Holds the script files to run on the application's startup when Medusa loads the module.
Was this chapter helpful?