I am working on this particular E-Commerce application, it’s a fully open source project.
It’s an umbrella with three apps:
- A core app to handle logic and db related things.
- An api app to expose APIs for customer frontend client.
- A phoenix app for the admin interface.
The next phase of our development is to design the system in a manner that it’s very simple for people to create plugins or extensions. Also, the design to integrate the plugins should be such that the admin
has the flexibility to add or remove them from the admin interface.
It is similar to how Shopify allows installation of extensions. We don’t fully understand how extension installation works for individual sellers.
e.g.
Let’s say the admin wants to install a library to provide support for marketing in the system he/she should be able to install the plugin created for the purpose.
What this plugin would be capable of?
- Track User login and send a welcome email.
- Check for abandoned carts etc.
The plugin should be created in a manner that once it is installed it should be able to track the call to session controller's
login` action and send a ping to the third party service. This can be done by somehow injecting code which comes from the extension. e.g. making a specific api call to third-party service.
Constraints:
- Can’t include the library in mix.exs as the number of packages can be many.
- Since this is a multitenant app these installations are also seller specific, every seller can have a unique combination of plugins.
- We can not have a central
One of the approaches is to inject a piece of code in the controller action to be tracked, to send an event to another library which based on metadata that the event sent(which includes a list of plugins for that particular seller) makes a decision and makes calls to the respective third party services.
What could be a possible design solution to provide the functionality?