Medusa and Module Container Dependencies

This documentation page includes the list of dependencies registered in the container of the Medusa application and a module.

Medusa Container Dependencies#

The following list of dependencies are resources that can be resolved by all resources (such as API route or workflow) except of a module's.

NoteUse the ContainerRegistrationKeys enum imported from @medusajs/framework/utils where specified.

Resource

Description

Registration Name

Configurations

The configurations that are exported from medusa-config.ts.

configModule or ContainerRegistrationKeys.CONFIG_MODULE

Logger

An instance of Medusa CLI’s logger. You can use it to log messages to the terminal.

logger or ContainerRegistrationKeys.LOGGER

Query

The Query utility methods.

query or ContainerRegistrationKeys.QUERY

Remote Link

The remote link function.

remoteLink or ContainerRegistrationKeys.REMOTE_LINK

Modules' main services

The main service of every module added in medusa-config.ts.

  • For custom modules, the registration name is the key of the module in the modules configuration in medusa-config.ts.
  • For Medusa's commerce modules, use the Modules enum imported from @medusajs/framework/utils.

Module Container Dependencies#

The following resources are resources that can be resolved by a module's services and loaders.

NoteUse the ContainerRegistrationKeys enum imported from @medusajs/framework/utils where specified.

Resource

Description

Registration Name

Logger

An instance of Medusa CLI’s logger. You can use it to log messages to the terminal.

logger or ContainerRegistrationKeys.LOGGER

Entity Manager

An instance of MikroORM's entity manager.

manager or ContainerRegistrationKeys.MANAGER

Base Repository

An instance of the base repository, used to run transactions or perform other database operations.

baseRepository

Configurations

The configurations exported from medusa-config.ts.

configModule or ContainerRegistrationKeys.CONFIG_MODULE

Modules' services

All services exported by the services/index.ts file of a module.

Each service is registered by its camel-case name. For example, if the service's class name is ClientService, its registration name is clientService.

Was this page helpful?
Edit this page