5 Things to Keep in Mind Before Creating a Strapi Plugin
This article suggests several factors you might want to take into account when developing a Strapi plugin.
Author: Alexander Godwin
This article suggests several factors you might want to take into account when developing a Strapi plugin.
The ability to customize computer programs, mobile apps, and online browsers is made possible via plugins, which are software add-ons. Plugins let us add software functionality that the product's author did not provide by default. Strapi enables us to create plugins and increase the functionality of the CMS. This article outlines several factors to take into account when developing a Strapi plugin.
An Introduction to Strapi
The Strapi documentation says that "Strapi is a flexible, open-source headless CMS that gives developers the freedom to choose their favorite tools and frameworks while also allowing editors to manage and distribute their content easily."
Strapi enables the world's largest companies to accelerate content delivery while building beautiful digital experiences by making the admin panel and API extensible through a plugin system.
What are Plugins?
Plugins allow us add to software functionality that the product's author did not provide by default. Typically, such programs (plugins) provide advantages for particular objectives to the creator. They help to solve certain problems. Plugins can be available to the entire community after they are published.
Strapi allows us the ability to create plugins and increase the functionality of the CMS. That's fantastic because it gives us a chance to increase Strapi's abilities and customize it to our taste.
It's excellent news, but before you start building your plugin to transform Strapi into the fairy world of your dreams, there are a few things you should think about when developing your plugin.
1. Planning Phase
Before creating a plugin, you should make a plan. During the planning stage, you should take a few things into account. Some of them are listed below:
A. Which problem are you trying to solve?
When developing a plugin, you are almost always attempting to solve a specific problem. For example, adding a feature that, for reasons best known to the developers, did not make it into the production version of that software.
It is always in your best interest to have a clear vision of the problem that you’re trying to solve.
B. Will you use TypeScript or JavaScript?
Strapi recently made available a version that enables TypeScript development. What this implies is that you have the option of building your plugin in TypeScript or JavaScript.
Creating a Strapi plugin is easy. Run the following command:
npm run strapi generate
or
yarn strapi generate
- From the options, choose "plugin".
- Give the plugin a name.
- Choose your preferred language of choice.
Further steps to take if you used choose TypeScript:
- Run
npm run install
oryarn install
in the newly-created plugin directory, i.esrc/plugins/slugify
. - Run
yarn build
ornpm run build
to build the plugin. Every time we make a modification to our plugin, we run this command.
Finally, run the following command in order to start our server in watch mode.
yarn strapi develop --watch-admin
2. Deciding Your Plugin Features
In this phase, you'll decide what you want to include in your plugin.
A. Homepage - Admin Panel
Your Strapi Plugin might need a homepage in the admin panel; however, this feature is not compulsory because some plugins can work properly without one. This feature is entirely dependent on the plugin you want to create.
For instance, a task-tracking plugin obviously needs a home page but an email provider plugin most certainly does not.
B. Settings Page
Another feature to think about is a settings page, where users may activate or deactivate your plugin. If your plugin communicates with a third-party API, the settings page might also be useful for storing specific credentials.
3. Research
A strong community is always crucial to have when establishing something new because challenges frequently arise during this process. Strapi provides just that. Here are ways the Strapi community can assist you while you create your plugin:
A. The Strapi Marketplace
It is important to visit the Strapi marketplace before developing a Strapi plugin. Due to the current state of software development, there is a possibility that the Plugin you intend to build has already been created by someone else who may have encountered the same issues you have.
You might be able to avoid the stress of having to reinvent the wheel by going to the Strapi marketplace.
B. The Strapi Discord Channel
The Strapi forum and the Strapi Discord community are additional helpful sites for conducting research prior to creating a Strapi plugin.
Several channels, including one for plugin creation, are available in the Strapi Discord community. If you are creating a plugin for the community, it's a fantastic place to conduct research to determine demand. Even if you do not plan to publish your plugin, the Discord community may still be able to assist you by providing answers to questions that puzzle you.
Another useful tool for finding solutions to questions is the Strapi forum. You're never alone with Strapi, thanks to its vibrant community.
C. The Strapi Theme
If you intend to put your plugin on the market, you should consider adopting the Strapi theme to give your plugin the strapi feel.
You can find the Strapi design system here. The Strapi Design System provides all the elements you'll need to give your plugin homepage the Strapi feel you desire, allowing you to concentrate on developing the logic of your plugins.
4. Maintenance
In the future, you might think about making your Plugin open source or even about listing it on the Strapi marketplace. You'll need to maintain your plugin in some way.
Managing Your Plugin
You might bring updates, features, or patches to your plugin. To do this, you'll need to update the code on GitHub but also update the package on npm.
You will need a system in place for dealing with plugin-related problems that arise. Choose which features to include. Instead of developing a plugin that can perform multiple functions, focus on doing one thing well.
Additionally, for ease of usage and maintenance, you should include a README.md
file and some sort of documentation.
5. How Strapi Can Help
If you are willing to list your plugin on the Strapi Marketplace be sure to read the guidelines. Here's a link to submit your plugin on the Marketplace.
Conclusion
The various factors that should be considered before developing a Strapi plugin have been covered in this post. I hope that you have the necessary information and are ready to tackle your plugin now that you are aware of the wealth of resources available to you.