modularkit
v0.0.3
Published
ModularKit is a plugin-based system framework designed for Node.js web applications. It allows developers to build and manage application features in a modular way, providing flexible plugin loading, route management, event handling, and database interact
Downloads
3
Readme
ModularKit
ModularKit is a plugin-based system framework designed for Node.js web applications. It allows developers to build and manage application features in a modular way, providing flexible plugin loading, route management, event handling, and database interaction.
Features
- Plugin-based Architecture: Easily add, remove, and update functional modules of the application.
- Route Management: Plugins can independently register and manage their own routes.
- Event-driven: Supports the publication and subscription of events, facilitating communication and collaboration between plugins.
- Database Integration: Provides encapsulated database operations, supporting data isolation and secure data access.
- Flexibility and Extensibility: Simple API and flexible design suitable for various application needs.
Installation
Install ModularKit using npm:
npm install modularkit
Getting Started
Here's a basic example of how to use ModularKit in your Node.js application.
First, create a plugin:
// plugins/YourPlugin.js
class YourPlugin {
constructor(modularkit) {
this.routeManager = modularkit.routeManager;
// ...other managers
}
initialize() {
// Plugin initialization code
}
}
module.exports = YourPlugin;
Then, load and initialize the plugin in your application:
const Koa = require('koa');
const { PluginLoader } = require('modularkit');
const path = require('path');
const app = new Koa();
const pluginLoader = new PluginLoader(path.join(__dirname, 'plugins'));
pluginLoader.loadPlugins();
app.use(pluginLoader.routeManager.routeMiddleware());
app.listen(3000, () => {
console.log('Server running on http://localhost:3000');
});
Documentation
For more detailed documentation and API reference, please check Documentation Link.
License
MIT © shitiandmw