Skip to content

Course 2: Building with MIFY — Chapter 4

Extend MIFY with your own custom nodes and publish them to the marketplace.

  • How to scaffold a plugin project
  • How to implement a custom node
  • How to test and publish
Terminal window
npx mify-plugin init my-weather-node
cd my-weather-node

Creates:

my-weather-node/
├── manifest.json # Plugin metadata
├── src/
│ └── nodes/
│ └── WeatherNode.ts # Your custom node
├── tests/
└── package.json
{
"name": "my-weather-node",
"version": "1.0.0",
"description": "Fetches weather data for any city",
"mifyVersion": ">=1.0.0",
"extensionPoints": {
"nodes": ["src/nodes/WeatherNode.ts"]
},
"permissions": ["network"],
"runtime": "v8"
}
export class WeatherNode implements NodeImplementation {
static definition = {
type: "weather.current",
name: "Current Weather",
category: "io",
description: "Get current weather for a city",
inputs: { city: { type: "string", required: true } },
outputs: { temperature: { type: "number" }, condition: { type: "string" } },
};
async execute(input: { city: string }) {
const response = await fetch(
`https://api.weatherapi.com/v1/current.json?q=${input.city}`
);
const data = await response.json();
return {
temperature: data.current.temp_c,
condition: data.current.condition.text,
};
}
}
Terminal window
npx mify-plugin dev # Hot reload dev server
npx mify-plugin test # Run unit tests
npx mify-plugin validate # Check manifest
Terminal window
npx mify-plugin publish

Your plugin appears in the Plugin Marketplace at /plugins/marketplace.

MIFY Plugins

  1. Initialize a plugin project
  2. Implement a node that takes text input and returns a word count
  3. Test it with npx mify-plugin dev
  4. Use it in a workflow on the canvas

Previous: Chapter 3 — Content Generation | Next: Chapter 5 — Advanced Patterns