Features configuration#
Future flags in `/config/features` toggle experimental Strapi features, allowing early testing at your own risk.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 badge throughout the documentation, where the name of the feature flag to use is included in the badge (e.g., ). 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.
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|tsfile or create it if the file does not exist yet. The file will export afutureobject with all the future flags to enable. - To enable a future flag, add its property name (see full list) to the
futureobject and ensure the property's value is set totrue. The following example shows how to enable theexperimental_firstPublishedAtfuture flag:
module.exports = ({ env }) => ({
future: {
experimental_firstPublishedAt: env.bool('STRAPI_FUTURE_EXPERIMENTAL_FIRST_PUBLISHED_AT', 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_EXPERIMENTAL_FIRST_PUBLISHED_AT=true
If your environment file does not include this value, the experimental_firstPublishedAt future flag property value will default to false and the experimental feature will not be enabled.
export default {
future: {
experimental_firstPublishedAt: env.bool('STRAPI_FUTURE_EXPERIMENTAL_FIRST_PUBLISHED_AT', 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_EXPERIMENTAL_FIRST_PUBLISHED_AT=true
If your environment file does not include this value, the experimental_firstPublishedAt future flag property value will default to false and the experimental feature will not be enabled.
- Rebuild the admin panel and restart the server:
```sh
yarn develop
```
```sh
npm run develop
```
Future flags API#
Developers can use the following APIs to interact with future flags:
-
Features configuration is part of the
configobject and can be read withstrapi.config.get('features')or withstrapi.features.config. -
strapi.features.futurereturns 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#
| Property name | Related feature | Suggested environment variable name |
|---|---|---|
experimental_firstPublishedAt | Draft & Publish | STRAPI_FUTURE_EXPERIMENTAL_FIRST_PUBLISHED_AT |