A minimal starter plugin for the Flow Server Framework.
- Simple plugin structure
- Service registration
- Event listeners
- Lifecycle methods (init, start, stop)
npm install flow-server-plugin-starter
const { createFlow } = require('flow-server-framework');
const createStarterPlugin = require('flow-server-plugin-starter');
// Create Flow instance
const flow = createFlow();
// Create and register the plugin
const starterPlugin = createStarterPlugin({
// Plugin options here
});
// Register the plugin
flow.registerPlugin('starter', starterPlugin);
// Start the application
flow.start()
.then(() => {
console.log('Application started with starter plugin');
// Use the plugin's service
const greeter = flow.getService('starter.greeter');
console.log(greeter.greet('Developer')); // Hello, Developer! from StarterPlugin
})
.catch(err => {
console.error('Failed to start application:', err);
});
To create your own plugin based on this starter:
- Clone or copy this repository
- Modify the
package.json
to change the name, version, and description - Update the plugin class in
src/index.js
:- Change the class name
- Update the plugin name, version, and description
- Implement your custom services and event listeners
- Add your plugin-specific functionality
A Flow Server plugin should implement the following methods:
-
init(flow)
: Initialize the plugin with the Flow instance -
start()
: Start the plugin -
stop()
: Stop the plugin
MIT