We recently released Strapi 5 "release candidate" of our headless CMS. It is available here. You can try it now, allowing you to explore all its new features before release and provide feedback. We would love to hear from you.
We are excited about all the cool new features Strapi 5 has to offer, but don't just take our word for it; here is what the folks at Notum are excited about.
Paul
Notum is a Strapi-centric software agency with a team of over 40 professionals. We develop Strapi-powered applications and websites for growing businesses and enterprises, handling everything from design to deployment and ongoing support.
You can find the article summary video here
Here are the 5 new Strapi features, we are all excited about.
This is probably the most important addition to V5. In the current version, once content has been published, it is not possible to prepare a draft version of the same content for future publication. When you hit the save button, the currently published content gets updated.
Many of our clients needed this feature, so we developed a content-versioning plugin to address this.
However, maintaining it and keeping up with new versions of Strapi has been quite challenging. Hence, we are glad this feature is becoming a core part of the CMS.
As you can see in the picture below, the content editor has a refreshed look and features two new tabs — Draft and Published.
By clicking these tabs, you can easily switch between the published and draft versions of the content. You can prepare new content in the Draft tab and publish it whenever you think it is ready.
What happens when you accidentally save a new version of content with the wrong data and want to roll it back? In V4, the content gets overwritten in the database, so there is very little chance of restoring the old content. Unfortunately, people make mistakes, so having a content history can be a lifesaver.
This feature will be available in V5 for Strapi customers with an Enterprise license. Unfortunately, we cannot test it personally yet. Still, we have reviewed the materials provided by Strapi, and it looks great!
The Document Service API will replace the Entity Service API, which we are accustomed to and love using due to its excellent documentation and simplicity. This change is likely to facilitate easier integration with the new Draft & Publish feature. To support this, new methods such as publish(), unpublish(), and discardDraft() have been introduced.
This new API also includes the count() method, allowing you to count documents that match set parameters. We need this feature on almost every project. With the Entity Service API, we always need to create a custom endpoint and controller, which will save a lot of time.
What we really like about the Document Service API is that it now uses random IDs like "a1b2c3d4e5f6g7h8i9j0klm" instead of just incrementing numbers with each new content creation.
Using the Document Service API is relatively straightforward. See the example below.
1const entries = await strapi.documents('api::article.article').findMany({
2 filters: {
3 title: {
4 $eqi: 'Exploring Strapi V5',
5 },
6 },
7});
When fetching data via the API, the response structure has changed slightly in version 5. In version 4, the data response had the following shape:
1{
2 "data": {
3 "id": number,
4 "attributes": {
5 ...
6 }
7 }
8}
In version 5, the attributes are no longer nested and are present directly in the data object. This is a small change, but writing long chains like the article.data.attributes.xy or destructuring the response has been quite annoying, mainly when populating relations because the nesting would occur multiple times. This change makes working with the API response more convenient and reduces size.
Additionally, the GraphQL API now offers partial support for Relay-style queries. This enhancement provides a more efficient way to handle data fetching, making it easier to work with complex datasets.
Migrating between versions of Strapi has historically been a complex and time-consuming process.
Fortunately, this might not be the case anymore, as Strapi has introduced a CLI upgrade tool designed to assist in migrating to any version of Strapi.
While it's important to note that only some things will be automated and some manual work will still be required, this tool significantly speeds up the overall process.
Note: The migration tool is still in active development, but Notum has given it a first test. You can read more about it in their blog post here or checkout the video.
Ondřej is a Strapi consultant at Notum Technologies. He maintains Notum's open-source Strapi plugins and develops Vue and React applications that utilize Strapi as CMS. He loves FinTech applications, so besides the development, he is also a host of a podcast and editor of a local FinTech magazine.