Search code examples
javascriptnode.jsexpresscontent-management-systempluggable

Node.js: How to create pluggable Application?


I'm going to create a CMS in Node.js and Express i have a folder structure like below:

  • MyCMS
    • plugins
    • themes
    • uploads
    • index.js

i want to load plugins from plugins folder:

  • plugins
    • sample-plugin
    • awesome-plugin

i want to know how to make my CMS pluggable?

what is best way to make an application pluggable?

and then how to load plugins?

(i need a plugin system at all)

EDIT: As i said, i need a plugin system like wordpress. wordpress has hooks (actions and filters), is it best? how to implement it?


Solution

  • You don't really need a plugins folder as NPM essentially does this for you. You then maintain a list of npm packages that are officially supported. You could look at Ember-CLI and see what they do with their 'ember install' and specific packages for Ember.