A plugin for Strapi Headless CMS that provides a Soft Delete feature.
✨ Features
- 🛢 Database
- Adds
deletedAt
anddeletedBy
fields to all your collection and single content types.
- Adds
- 🗂️ Content Manager & API
- The normal delete functionality behaves as the soft delete. It will set the
deletedAt
field to the current date anddeletedBy
field to the admin user that deleted it. - 👤 RBAC
- The name of the existing admin permission reflects the soft delete functionality. The
Delete
is renamed toSoft Delete
and it is located in theSettings > Roles > Edit a Role > Collection Types | Single Types
section. - A new admin permission is added to the
Settings > Roles > Edit a Role > Collection Types | Single Types
section. This is theDeleted Read
permission. This will allow the admin user to view the soft deleted entries. - A new admin permission is added to the
Settings > Roles > Edit a Role > Collection Types | Single Types
section. This is theDeleted Restore
permission. This will allow the admin user to restore the soft deleted entries. - A new admin permission is added to the
Settings > Roles > Edit a Role > Collection Types | Single Types
section. This is theDelete Permanently
permission. This will allow the admin user to delete permanently the soft deleted entries.
- The name of the existing admin permission reflects the soft delete functionality. The
- The normal delete functionality behaves as the soft delete. It will set the
- 🗂️ Adds a
Soft Delete
item in the Admin left Panel to access the Soft Deleted content explorer. This will list all the content types. You can restore or delete permanently the entries from here.- Adds a
Restore
action through the Soft Delete in the Admin Panel to the content types. This will set thedeletedAt
field tonull
anddeletedBy
field tonull
, thus restoring it. - Adds a
Delete Permanently
action through the Soft Delete in the Admin Panel to the content types. This will delete the entry permanently.
- Adds a
📦 Compatibility
Strapi Version | Plugin Version |
---|---|
v4 | 1.0.0 |
v3 | Not Supported |
This plugin is designed for Strapi v4 and will not work with v3.x.
⏳ Installation
To install this plugin, you need to add an NPM dependency to your Strapi application:
# Using Yarn
yarn add strapi-plugin-soft-delete
# Or using PNPM
pnpm add strapi-plugin-soft-delete
# Or using NPM
npm install strapi-plugin-soft-delete
Then, you'll need to build your admin panel:
# Using Yarn
yarn build
# Or using PNPM
pnpm run build
# Or using NPM
npm run build
Edit your config/plugins.js|ts
or config/<env>/plugins.js|ts
file and add the following configuration:
// ...
"soft-delete": {
enabled: true,
},
// ...
Finally, start your application:
# Using Yarn
yarn develop
# Or using PNPM
pnpm run develop
# Or using NPM
npm run develop
🤝 Contributing
Feel free to fork and make a PR if you want to add something or fix a bug.
👨💻 Community support
For general help using Strapi, please refer to the official Strapi documentation. For additional help, you can use one of these channels to ask a question:
- Discord I'm present on official Strapi Discord workspace. Find me by
ChristopheCVB
. - GitHub (Bug reports, Contributions, Questions and Discussions)
📝 License
MIT License Copyright (c) ChristopheCVB.