3.3.1. Modules Directory Structure

In this chapter, you'll learn about the expected files and directories in your module.

Module Directory Structure Example

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:

Was this chapter helpful?
Ask Anything
Ask any questions about Medusa. Get help with your development.
You can also use the Medusa MCP server in Cursor, VSCode, etc...
FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break