How to develop a robust plugin architecture?
Photo by Justin Morgan on Unsplash
Disclaimer: I haven’t developed an extremely complete plugin architecture myself. What I have developed is a plugin architecture which is robust enough. There are too many points to the discussion. These are all my thoughts.
Identify places in your application which you want to provide as plugin
Identify how plugin is going to share data? And can plugin update in real time? if Yes how?
For example: 1 Plugin can be of 2 parts.
How will P1 and P2 share data?
Ideally, these should be microservices?
Note: This is how slack and teams do it.
Define interfaces that plugin developers can use
- Zapier allows using CLI to generate a project architecture
- They have specific interfaces that can be used for generating plugin
- They also have a z object that can be used for a limited set of features such as API calls.
Keep your product as lean as possible
For plugin architecture, the whole product should be made pluggable. That is even first party features should be developed as plugin. Which means there will be almost nothing in the core.
You could have 2 interfaces for this.
1 for publish
2 for first hand
interface firstHand extends pluginInterface
Or you could provide a limited set of components that can be rendered on UI.
The term interface and components are loose here. Many plugins are simply JSON based.
You’ll have to create infrastructure for managing plugins and plugin lifecycle
- Interfaces for plugins
- Plugin repository
- How will you manage so many third party plugins?
- How will plugin versions be managed?
- Approval process
- This will also include manual approavls.
- I would also add a virus scanner and other security measures.
Plugin Development for Wordpress: They are much more low-level about implementation. Especially go through their best practices section.
Plugin Architecture: Why and How?: Goes into detail about why to implement plugin architecture. How is plugin architecture better than monoliths? How are predefined hooks used in plugin architecture? And how yarn2 does it.
Microsoft Adaptive Cards: A very interesting open source UI plugin architecture
YouTube: The Power Of The Plugin Architecture In Python
StackOverflow: The plugin design pattern explained (as described by Martin Fowler)
Trello Plugin - Your First Power-Up
How to build a plugin system on the web and also sleep well at night