Plugins
Learn how to create and use plugins to extend Motia's functionality
Plugins
Plugins are a powerful way to extend Motia's functionality by adding custom features to the workbench, and integrating with external services.
What are Plugins?
Plugins in Motia allow you to:
Custom Workbench Tabs
Specialized Visualizations
Service Integrations
Core Extensions
Reusable Modules
Motia comes with several official plugins like plugin-logs, plugin-endpoint, plugin-observability, plugin-states, ws-plugin, and cron-plugin that demonstrate the power and flexibility of the plugin system.
Plugin Architecture
Core Types
Plugins are built using three main TypeScript types:
MotiaPlugin
The main plugin configuration returned by your plugin function:
WorkbenchPlugin
Configuration for a workbench tab:
MotiaPluginContext
Context object provided to your plugin with access to Motia's internal APIs:
Creating a Plugin
Quick Start with CLI
The fastest way to create a new plugin is using the Motia CLI:
After creation, set up and verify the build pipeline:
What the CLI template includes
- TypeScript and React configuration
- tsdown for fast, performant builds with React Compiler and Tailwind CSS v4
- Example workbench UI component
- Required dependencies pre-installed
- Ready-to-build project structure
Manual Setup
If you prefer to set up manually or want to understand the structure, follow these steps:
Create a new directory for your plugin with the following structure:
Create a package.json with proper exports for both the main entry and plugin definition:
Create src/plugin.ts to define your plugin:
Create your React component in src/components/example-page.tsx:
Create src/index.ts to export your components:
Create src/styles.css to import Motia's UI styles:
tsdown configuration — Create tsdown.config.ts:
PostCSS configuration — Create postcss.config.js:
TypeScript configuration — Create tsconfig.json:
Add build scripts to your package.json:
Then run the build:
Local Plugins
Local plugins provide a simpler alternative to creating full distributable packages when you want to add custom functionality specific to your project. Unlike publishable plugins, local plugins don't require building, packaging, or separate dependencies—they live directly in your project directory.
When to Use Local Plugins
Local plugins are ideal for:
Development & prototyping
Project-specific features
Internal tooling
Learning environment
The ~/ Package Name Syntax
Local package resolution with ~/
The ~/ prefix in packageName tells Motia to load components from your local project directory instead of node_modules:
Motia resolves ~/ to your project root, so you can import components without publishing them as registry packages.
Creating a Local Plugin
Create a simple structure in your project:
In motia.config.ts, create a plugin function that returns the plugin configuration:
Create plugins/index.tsx with your component:
Including Custom Steps
Include custom steps
Local plugins can also include custom steps by specifying a dirname and steps pattern:
This loads API routes, event handlers, and other step types directly from the plugin directory.
Note: Plugin steps follow the same discovery rules as regular steps - they can be organized in subdirectories and will be discovered recursively. The dirname specifies the root directory to scan, and steps can be nested at any depth within it.
Best Practices for Local Plugins
Keep components simple
Use TypeScript
Organize by feature
Reuse dependencies
Document your APIs
When to Migrate to NPM Plugin
When to publish as a distributable package
- You want to share it across multiple projects
- It provides general-purpose functionality
- You need versioning and dependency management
- The plugin is stable and well-tested
Using Plugins
Installing a Plugin
Configuring Multiple Plugins
Configure multiple plugins
Registering Custom APIs
Register custom APIs
Use the registerApi method from the plugin context:
Example Plugin
Example plugin reference
A complete minimal example plugin lives at plugins/plugin-example in the Motia repository. It demonstrates:
- Basic plugin structure
- Workbench tab integration
- UI component creation
- Build configuration
- TypeScript setup
Use it as a starting point for your own plugins.
Troubleshooting
Plugin not showing in workbench
- Check that the plugin is imported in
motia.config.ts - Verify the
componentNamematches your exported component - Ensure the plugin is built (
pnpm run build) - Check browser console for errors
- Ensure tsdown and Babel plugins are installed
Styles not loading
- Verify CSS is imported in
src/index.ts - Check that the CSS build is configured in
tsdown.config.ts - Ensure TailwindCSS is properly configured in
postcss.config.js - Confirm that
cssImportsis defined insrc/plugin.tswith the correct path (e.g.,['@motiadev/plugin-example/dist/styles.css'])
Resolving type errors
- Make sure
@motiadev/coreand@motiadev/uiare listed inpeerDependencies - Run
pnpm installso TypeScript picks up the types - Confirm
declaration: trueis set intsconfig.json - Check external dependencies are correctly configured in tsdown
Publishing and Contributing Plugins
Want to share your plugin with the Motia community?
Publish to NPM and contribute
If you've created a plugin and want to share it with the community:
- Publish to NPM - Make your plugin available for everyone to install
- Add to awesome-plugins - Submit your plugin to our curated list
For complete instructions on creating, publishing, and contributing plugins, see the Plugin Contributing Guide.
The guide includes:
- Step-by-step NPM publishing workflow
- Best practices for plugin development
- Submission format and guidelines
- Troubleshooting common issues
Next Steps
- Explore the plugin-logs source code for a complete example
- Check out the awesome-plugins repository for community plugins
- Read the Plugin Contributing Guide to publish your own