Home

>

Tools

>

Strapi

>

Releases

>

5.0.0

Strapi Release: 5.0.0

Tag Name: v5.0.0

Release Date: 9/18/2024

Strapi LogoStrapi

Open-source headless CMS built with Node.js. Provides developers with complete freedom in choosing their favorite tools and frameworks for frontend development.

TL;DR

Strapi 5.0.0: Major Release with Significant Architecture Changes

Strapi 5.0.0 represents a major architectural overhaul of the popular headless CMS. This release introduces a new document service, improved content history tracking, enhanced draft & publish workflows, and significant TypeScript improvements. The update also includes database optimizations, a redesigned main navigation, and a more robust plugin system. While offering better performance and developer experience, this is a breaking change that requires careful migration from v4.

Highlight of the Release

    • New document service architecture replacing the entity service
    • Content history feature for tracking changes and restoring previous versions
    • Improved Draft & Publish workflow with better relation handling
    • Enhanced TypeScript support with improved type definitions
    • Database optimizations including identifier shortening for long names
    • Redesigned main navigation and UI improvements
    • New plugin system architecture with better developer experience
    • Enhanced localization features including filling content from other locales
    • Improved RBAC (Role-Based Access Control) with action aliases
    • Upgraded dependencies including React 18.3 and styled-components 6

Migration Guide

Preparing for Migration

Before upgrading to Strapi v5, ensure you:

  1. Back up your database and project files
  2. Review the breaking changes in this release
  3. Check your custom plugins and extensions for compatibility

Using the Upgrade Tool

Strapi v5 provides an upgrade tool to help with migration:

npx @strapi/upgrade@latest

This tool will:

  • Update your dependencies
  • Run codemods to update your code
  • Migrate your database schema
  • Update your configuration files

Key Breaking Changes to Address

Helper Plugin Changes

Many components and utilities from the helper plugin have been moved to the admin package. The upgrade tool includes codemods to help with this transition, but you may need to manually update some imports.

TypeScript Changes

If you're using TypeScript, note that the type system has been significantly refactored:

  • The TOrigin type parameter has been removed from Attribute.Relation and Attribute.UID
  • The namespace structure has changed

Database Changes

Database naming conventions have changed with a new shortening algorithm for identifiers. The migration will handle this, but be aware of potential issues if you have custom SQL queries.

Plugin Development

If you've developed custom plugins, you'll need to update them for the new architecture:

  • Update imports from helper-plugin
  • Adapt to the new document service API
  • Update any components that used deprecated APIs

API Changes

  • Content API now returns 201 status code for creation operations
  • Query parameter validation is stricter
  • The entity service has been deprecated in favor of the document service

Post-Migration Steps

After running the upgrade tool:

  1. Test your application thoroughly
  2. Check for any deprecation warnings
  3. Update your custom code to use the new APIs
  4. Review your database schema for any issues
  5. Update your documentation and client applications if needed

Upgrade Recommendations

Who should upgrade?

  • All Strapi users should plan to upgrade to v5.0.0 eventually, as it represents the future direction of the platform
  • Developers starting new projects should use v5.0.0 directly
  • Existing projects should carefully plan the migration based on their complexity and custom code

When to upgrade?

  • For production applications: Plan a careful migration with thorough testing
  • Consider waiting for v5.0.1 or later if you have critical production systems
  • Allocate sufficient time for testing and addressing any issues

How to upgrade?

  1. Use the official upgrade tool: npx @strapi/upgrade@latest
  2. Follow the migration guide provided in the documentation
  3. Test thoroughly in a staging environment before deploying to production
  4. Be prepared to update custom plugins and extensions

Considerations before upgrading:

  • The extent of custom code in your application
  • Any custom plugins or extensions you've developed
  • Your team's familiarity with TypeScript (if applicable)
  • Your database size and complexity
  • Your deployment pipeline and testing processes

This is a major version upgrade with significant architectural changes. While the upgrade tool will help automate much of the process, expect to spend time addressing specific issues in your codebase, especially if you have extensive customizations.

Bug Fixes

Database and Query Fixes

  • Fixed issues with database identifier shortening and migration
  • Fixed problems with relation queries and population
  • Addressed issues with unique field validation in components and dynamic zones
  • Fixed issues with morphToMany relation ordering in sanitize and validate
  • Resolved problems with self-referencing relations

UI and Navigation Fixes

  • Fixed sticky navbar width issues
  • Resolved problems with the media library uncheck functionality
  • Fixed issues with the rich text editor
  • Addressed problems with the content manager header spacings
  • Fixed draft tag color and release menu icons size

Content Management Fixes

  • Fixed issues with publishing and updating creator fields
  • Resolved problems with locale handling in content management
  • Fixed validation issues in the content manager
  • Addressed problems with JSON fields not being parsed properly
  • Fixed issues with date and time formatting

Plugin and Extension Fixes

  • Fixed issues with plugin resolution and loading
  • Resolved problems with the admin path not being taken into account
  • Fixed issues with webhook button submission
  • Addressed problems with email confirmation
  • Fixed issues with the guided tour

Security and Performance Fixes

  • Fixed escape raw queries to prevent SQL injection
  • Resolved issues with the security middleware
  • Addressed problems with the proxy configuration
  • Fixed issues with WebSocket handling for Vite HMR

New Features

New Document Service Architecture

The core architecture has been significantly refactored with the introduction of a document service that replaces the entity service. This provides a more consistent API for managing content and improves performance.

Content History

A new content history feature allows tracking changes to content over time. Users can view previous versions of content and restore them if needed. This includes capturing content types history, displaying versions in a sidebar, and showing differences between versions.

Enhanced Draft & Publish

The Draft & Publish system has been completely redesigned with better relation handling. It now warns when publishing entries with draft relations and provides better validation. Draft & Publish is now disabled by default but can be enabled per content type.

Improved Localization

Localization features have been enhanced with the ability to fill content from other locales, publish multiple locales at once, and better handling of non-localized fields. The locale parameter is now ignored on non-localized content types.

Document ID

A new document ID system has been implemented to better track content across the system. This includes indexing document IDs for improved performance and better handling of relations.

Review Workflows Enhancements

Review workflows have been improved with better stage transitions, assignee management, and webhook integration. The UI has also been improved for a better user experience.

Content Releases Improvements

The content releases feature has been migrated to v5 with improved validation, better handling of single types, and improved UI. Release settings now use the default timezone.

Bulk Actions

Bulk actions for publishing, unpublishing, and deleting content have been migrated to v5 with improved validation and better UI.

Security Updates

Query Validation and Sanitization

  • Enhanced validation for input in content API controllers
  • Improved sanitization of query parameters
  • Fixed escape raw queries to prevent SQL injection
  • Better handling of user input in the admin panel

Authentication and Authorization

  • Improved RBAC (Role-Based Access Control) with action aliases
  • Enhanced permission checking for content operations
  • Better handling of token-based authentication
  • Fixed issues with the security middleware

Data Protection

  • Better handling of sensitive data in API responses
  • Improved validation of webhook payloads
  • Enhanced protection against unauthorized access to content
  • Better handling of user passwords and sensitive information

Dependency Updates

  • Upgraded ws to 8.17.1 to address security vulnerabilities
  • Updated sanitize-html to 2.13.0 for better HTML sanitization
  • Upgraded undici to 6.19.2 to fix security issues
  • Updated other dependencies to their latest secure versions

Performance Improvements

Database Optimizations

  • New database identifier shortening algorithm to handle long names
  • Improved database schema with better naming conventions
  • Enhanced query performance with optimized relation handling
  • Better handling of database migrations

Frontend Performance

  • Switched to Vite as the default bundler for the admin panel
  • Optimistic document updates in the content manager for faster UI response
  • Reduced unnecessary API requests in the content manager
  • Improved caching strategy for content queries

API Performance

  • More efficient handling of relations in API responses
  • Better validation of query parameters to prevent unnecessary processing
  • Improved handling of populate parameters for better query performance
  • Enhanced transaction handling for database operations

System Performance

  • Better lifecycle management with providers initialized first during bootstrap
  • Improved plugin loading mechanism
  • Enhanced logging with configurable log levels
  • More efficient handling of WebSocket connections

Impact Summary

Strapi 5.0.0 represents a fundamental architectural shift for the platform, focusing on improved developer experience, better performance, and enhanced content management capabilities. The introduction of the document service as a replacement for the entity service provides a more consistent API for content operations, while the new content history feature offers powerful versioning capabilities.

For developers, the most significant changes include improved TypeScript support, a redesigned plugin system, and the dismantling of the helper-plugin with components moved to the admin package. These changes require careful migration but offer better maintainability and type safety in the long run.

Content editors will benefit from enhanced Draft & Publish workflows, improved localization features, and better bulk actions. The new content history feature allows tracking changes and restoring previous versions, providing more control over content evolution.

Administrators will appreciate the reorganized settings, improved RBAC with action aliases, and better webhook management. The new database migration system ensures smoother updates in the future.

API consumers will notice stricter validation, more consistent responses, and better handling of relations. The content API now returns 201 status codes for creation operations, aligning with REST conventions.

While this update requires careful migration planning, the improvements in architecture, performance, and developer experience make it a worthwhile upgrade for most Strapi users. The provided upgrade tool and codemods help automate much of the migration process, but custom code and plugins will likely require manual updates.

Full Release Notes

What's Changed

New Contributors

Full Changelog: v4.25.11...v5.0.0

Statistics:

User Affected:

  • Need to migrate from v4 to v5 using the new upgrade tool
  • TypeScript support has been significantly improved with better type definitions
  • Plugin development has been overhauled with a new architecture
  • Helper plugin has been dismantled with components moved to the admin package
  • Database naming conventions have changed with new shortening algorithms for identifiers

Contributors: