Medusa and Module Container Resources

This documentation page includes the list of resources registered in the container of the Medusa application and modules.

Medusa Container Resources#

The following table has a list of all resources that you can resolve in your customizations outside a module (such as API routes or workflows).

NoteLearn more about the Medusa Container in this documentation.
TipUse 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

Query to retrieve data across modules.

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 Resources#

The following table has a list of all resources that you can resolve in a module's services or loaders.

NoteLearn more about the Module Container in this documentation.
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