Features configuration
The config/features.js|ts
file is used to enable feature flags. Currently this file only includes a future
object used to enable experimental features through future flags.
Some incoming Strapi features are not yet ready to be shipped to all users, but Strapi still offers community users the opportunity to provide early feedback on these new features or changes. With these experimental features, developers have the flexibility to choose and integrate new features and changes into their Strapi applications as they become available in the current major version as well as assist us in shaping these new features.
Such experimental features are indicated by a Feature FlagThis feature requires a feature flag to be enabled. badge throughout the documentation and enabling these features requires enabling the corresponding future flags. Future flags differ from features that are in alpha in that future flags are disabled by default.
Enable future flags at your own risk. Experimental features may be subject to change or removal, may contain breaking changes, may be unstable or not fully ready for use, and some parts may still be under development or using mock data.
Enabling a future flag
To enable a future flag:
- (optional) If the server is running, stop it with
Ctrl-C
. - Open the
config/features.js|ts
file or create it if the file does not exist yet. The file will export afuture
object with all the future flags to enable. - To enable a future flag, add its property name (see full list) to the
future
object and ensure the property's value is set totrue
. The following example shows how to enable thepreview
future flag:
- JavaScript
- TypeScript
module.export = ({ env }) => ({
future: {
// You could also simply write: preview: true
preview: env.bool('STRAPI_FUTURE_PREVIEW', false),
},
})
This example assumes that you have an .env
environment file at the root of your application and that the file includes the following line:
STRAPI_FUTURE_PREVIEW=true
If your environment file does not include this value, the preview
future flag property value will default to false
and the experimental feature will not be enabled.
export default {
future: {
// You could also simply write: preview: true
preview: env.bool('STRAPI_FUTURE_PREVIEW', false),
},
};
This example assumes that you have an .env
environment file at the root of your application and that the file includes the following line:
STRAPI_FUTURE_PREVIEW=true
If your environment file does not include this value, the preview
future flag property value will default to false
and the experimental feature will not be enabled.
- Rebuild the admin panel and restart the server:
- Yarn
- NPM
yarn develop
npm run develop
Future flags API
Developers can use the following APIs to interact with future flags:
-
Features configuration is part of the
config
object and can be read withstrapi.config.get('features')
or withstrapi.features.config
. -
strapi.features.future
returns theisEnabled()
that can be used to determine if a future flag is enabled, using the following method:strapi.features.future.isEnabled('featureName')
.
Available future flags
There are currently no available future flags. This section will be updated once new experimental features are available for testing.
The following future flags are currently available and can be used in the future
object of the config/features
configuration file:
Property name | Related feature | Suggested environment variable name |
---|---|---|
preview | Preview | STRAPI_FUTURE_PREVIEW |