--- displayed_sidebar: homepage --- import TypeList from "@site/src/components/TypeList" # ConfigModule The configurations for your Medusa backend are in `medusa-config.js` located in the root of your Medusa project. The configurations include database, modules, and plugin configurations, among other configurations. `medusa-config.js` exports an object having the following properties: - [projectConfig](medusa.ConfigModule-1.mdx#projectconfig): (required): An object that holds general configurations related to the Medusa backend, such as database or CORS configurations. - [plugins](medusa.ConfigModule-1.mdx#plugins): An array of plugin configurations that defines what plugins are installed and optionally specifies each of their configurations. - [modules](medusa.ConfigModule-1.mdx#modules): An object that defines what modules are installed and optionally specifies each of their configurations. - [featureFlags](medusa.ConfigModule-1.mdx#featureflags): An object that enables or disables features guarded by a feature flag. For example: ```js title="medusa-config.js" module.exports = { projectConfig, plugins, modules, featureFlags, } ``` --- ## Environment Variables It's highly recommended to store the values of configurations in environment variables, then reference them within `medusa-config.js`. During development, you can set your environment variables in the `.env` file at the root of your Medusa backend project. In production, setting the environment variables depends on the hosting provider. --- ## Properties ` & `object`","description":"An object that includes additional configurations to pass to the database connection. You can pass any configuration. One defined configuration to pass is\n`ssl` which enables support for TLS/SSL connections.\n\nThis is useful for production databases, which can be supported by setting the `rejectUnauthorized` attribute of `ssl` object to `false`.\nDuring development, it’s recommended not to pass this option.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"redis_url","type":"`string`","description":"Used to specify the URL to connect to Redis. This is only used for scheduled jobs. If you omit this configuration, scheduled jobs won't work.\n\n:::note\n\nYou must first have Redis installed. You can refer to [Redis's installation guide](https://redis.io/docs/getting-started/installation/).\n\n:::\n\nThe Redis connection URL has the following format:\n\n```bash\nredis[s]://[[username][:password]@][host][:port][/db-number]\n```\n\nFor a local Redis installation, the connection URL should be `redis://localhost:6379` unless you’ve made any changes to the Redis configuration during installation.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"redis_prefix","type":"`string`","description":"The prefix set on all keys stored in Redis. The default value is `sess:`.\n\nIf this configuration option is provided, it is prepended to `sess:`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"redis_options","type":"`RedisOptions`","description":"An object of options to pass ioredis. You can refer to [ioredis’s RedisOptions documentation](https://redis.github.io/ioredis/index.html#RedisOptions)\nfor the list of available options.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"session_options","type":"[SessionOptions](medusa.SessionOptions.mdx)","description":"An object of options to pass to [express-session](https://www.npmjs.com/package/express-session).","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"http_compression","type":"[HttpCompressionOptions](medusa.HttpCompressionOptions.mdx)","description":"Configure HTTP compression from the application layer. If you have access to the HTTP server, the recommended approach would be to enable it there.\nHowever, some platforms don't offer access to the HTTP layer and in those cases, this is a good alternative.\n\nIts value is an object that has the following properties:\n\nIf you enable HTTP compression and you want to disable it for specific API Routes, you can pass in the request header `\"x-no-compression\": true`.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"jobs_batch_size","type":"`number`","description":"Configure the number of staged jobs that are polled from the database. Default is 1000.","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"plugins","type":"(`string` \\| `object`)[]","description":"On your Medusa backend, you can use [Plugins](https://docs.medusajs.com/development/plugins/overview) to add custom features or integrate third-party services.\nFor example, installing a plugin to use Stripe as a payment processor.\n\nAside from installing the plugin with NPM, you need to pass the plugin you installed into the `plugins` array defined in `medusa-config.js`.\n\nThe items in the array can either be:\n\n- A string, which is the name of the plugin to add. You can pass a plugin as a string if it doesn’t require any configurations.\n- An object having the following properties:\n - `resolve`: The name of the plugin.\n - `options`: An object that includes the plugin’s options. These options vary for each plugin, and you should refer to the plugin’s documentation for available options.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"featureFlags","type":"`Record`","description":"Some features in the Medusa backend are guarded by a feature flag. This ensures constant shipping of new features while maintaining the engine’s stability.\n\nYou can specify whether a feature should or shouldn’t be used in your backend by enabling its feature flag. Feature flags can be enabled through either environment\nvariables or through this configuration exported in `medusa-config.js`.\n\nIf you want to use the environment variables method, learn more about it in the [Feature Flags documentation](https://docs.medusajs.com/development/feature-flags/toggle#method-one-using-environment-variables).\n\nThe `featureFlags` configuration is an object. Its properties are the names of the feature flags. Each property’s value is a boolean indicating whether the feature flag is enabled.\n\nYou can find available feature flags and their key name [here](https://github.com/medusajs/medusa/tree/master/packages/medusa/src/loaders/feature-flags).","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"modules","type":"`Record`","description":"In Medusa, commerce and core logic are modularized to allow developers to extend or replace certain [modules](https://docs.medusajs.com/development/modules/overview)\nwith custom implementations.\n\nAside from installing the module with NPM, you must add it to the exported object in `medusa-config.js`.\n\nThe keys of the `modules` configuration object refer to the type of module. Its value can be one of the following:\n\n1. A boolean value indicating whether the module type is enabled;\n2. Or a string value indicating the name of the module to be used for the module type. This can be used if the module does not require any options;\n3. Or an object having the following properties, but typically you would mainly use the `resolve` and `options` properties only:\n 1. `resolve`: a string indicating the name of the module.\n 2. `options`: an object indicating the options to pass to the module. These options vary for each module, and you should refer to the module’s documentation for details on them.\n 3. `resources`: a string indicating whether the module shares the dependency container with the Medusa core. Its value can either be `shared` or `isolated`. Refer to the [Modules documentation](https://docs.medusajs.com/development/modules/create#module-scope) for more details.\n 4. `alias`: a string indicating a unique alias to register the module under. Other modules can’t use the same alias.\n 5. `main`: a boolean value indicating whether this module is the main registered module. This is useful when an alias is used.","optional":true,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/development/entities/repositories#retrieving-a-list-of-records" sectionTitle="ConfigModule"/>