Plugins configuration
The content of this page might not be fully up-to-date with Strapi 5 yet.
Plugin configurations are stored in /config/plugins.js|ts
(see project structure). Each plugin can be configured with the following available parameters:
Parameter | Description | Type |
---|---|---|
enabled | Enable (true ) or disable (false ) an installed plugin | Boolean |
config Optional | Used to override default plugin configuration (defined in strapi-server.js) | Object |
resolve Optional, only required for local plugins | Path to the plugin's folder | String |
Some features of Strapi are provided by plugins and the following plugins can also have specific configuration options: GraphQL and Upload.
Basic example custom configuration for plugins:
- JavaScript
- TypeScript
module.exports = ({ env }) => ({
// enable a plugin that doesn't require any configuration
i18n: true,
// enable a custom plugin
myplugin: {
// my-plugin is going to be the internal name used for this plugin
enabled: true,
resolve: './src/plugins/my-local-plugin',
config: {
// user plugin config goes here
},
},
// disable a plugin
'my-other-plugin': {
enabled: false, // plugin installed but disabled
},
});
export default ({ env }) => ({
// enable a plugin that doesn't require any configuration
i18n: true,
// enable a custom plugin
myplugin: {
// my-plugin is going to be the internal name used for this plugin
enabled: true,
resolve: './src/plugins/my-local-plugin',
config: {
// user plugin config goes here
},
},
// disable a plugin
'my-other-plugin': {
enabled: false, // plugin installed but disabled
},
});
If no specific configuration is required, a plugin can also be declared with the shorthand syntax 'plugin-name': true
.
GraphQL configuration
The GraphQL plugin has the following specific configuration options that should be declared in a graphql.config
object within the config/plugins
file. All parameters are optional:
Parameter | Description | Type | Default |
---|---|---|---|
apolloServer | Additional configuration for ApolloServer . | Object | {} |
artifacts | Object containing filepaths, defining where to store generated artifacts. Can include the following properties:
generateArtifacts is set to true . | Object |
|
defaultLimit | Default value for the pagination[limit] parameter used in API calls | Integer | 100 |
depthLimit | Limits the complexity of GraphQL queries. | Integer | 10 |
endpoint | The URL path on which the plugin is exposed | String | /graphql |
generateArtifacts | Whether Strapi should automatically generate and output a GraphQL schema file and corresponding TypeScript definitions. The file system location can be configured through artifacts . | Boolean | false |
maxLimit | Maximum value for the pagination[limit] parameter used in API calls | Integer | -1 |
playgroundAlways | Whether the playground should be publicly exposed. Enabled by default in if NODE_ENV is set to development . | Boolean | false |
shadowCRUD | Whether type definitions for queries, mutations and resolvers based on models should be created automatically (see Shadow CRUD documentation). | Boolean | true |
v4ComptabilityMode | Enables the retro-compatibility with the Strapi v4 format (see more details in the breaking change entry | Boolean | false |
Example custom configuration:
- JavaScript
- TypeScript
module.exports = () => ({
graphql: {
enabled: true,
config: {
playgroundAlways: false,
defaultLimit: 10,
maxLimit: 20,
apolloServer: {
tracing: true,
},
}
}
})
export default () => ({
graphql: {
enabled: true,
config: {
playgroundAlways: false,
defaultLimit: 10,
maxLimit: 20,
apolloServer: {
tracing: true,
},
}
}
})
Upload configuration
The Upload plugin handles the Media Library. When using the default upload provider, the following specific configuration options can be declared in an upload.config
object within the config/plugins
file. All parameters are optional:
Parameter | Description | Type | Default |
---|---|---|---|
providerOptions.localServer | Options that will be passed to koa-static upon which the Upload server is build. (See local server configuration in Upload documentation for additional details) | Object | - |
sizeLimit | Maximum file size in bytes. (See max file size configuration in Upload plugin documentation for additional information) | Integer | 209715200 (200 MB in bytes, i.e., 200 x 1024 x 1024 bytes) |
breakpoints | Allows to override the breakpoints sizes at which responsive images are generated when the "Responsive friendly upload" option is set to true .(See responsive images configuration in Upload plugin documentation for additional information) | Object | { large: 1000, medium: 750, small: 500 } |
- Some configuration options can also be set directly from the Admin Panel (see User Guide).
- The Upload request timeout is defined in the server options, not in the Upload plugin options, as it's not specific to the Upload plugin but is applied to the whole Strapi server instance. See upload request timeout configuration in the Upload documentation for additional details.
- When using a different upload provider, additional configuration options might be available. For Upload providers maintained by Strapi, see the Amazon S3 provider and Cloudinary provider documentations for additional information about available options.
Example custom configuration:
The following is an example of a custom configuration for the Upload plugin when using the default upload provider:
- JavaScript
- TypeScript
module.exports = ({ env })=>({
upload: {
config: {
providerOptions: {
localServer: {
maxage: 300000
},
},
sizeLimit: 250 * 1024 * 1024, // 256mb in bytes
breakpoints: {
xlarge: 1920,
large: 1000,
medium: 750,
small: 500,
xsmall: 64
},
},
},
});
export default () => ({
upload: {
config: {
providerOptions: {
localServer: {
maxage: 300000
},
},
sizeLimit: 250 * 1024 * 1024, // 256mb in bytes
breakpoints: {
xlarge: 1920,
large: 1000,
medium: 750,
small: 500,
xsmall: 64
},
},
},
})