Pluggable
A comprehensive, async plugin system for Rust applications with dependency management, security, and extensibility.
Features
- ๐ Async-first: Built from the ground up with
async/awaitsupport - ๐ Dependency Management: Automatic plugin dependency resolution and execution ordering
- ๐ Security: Capability-based permission system with sandboxing support
- โก Performance: Parallel plugin execution where dependencies allow
- ๐งช Testing: Comprehensive testing framework with mocks and harnesses
- ๐ Observability: Event system with lifecycle hooks and logging
- ๐ Developer Experience: Clean APIs, auto-discovery, and rich configuration
Quick Start
Add to your Cargo.toml:
[]
= "0.1.0"
Basic Plugin Example
use *;
// Auto-register the plugin
register_plugin!;
Running a Plugin Pipeline
use *;
async
Key Concepts
Plugin System
- Plugin Trait: Core trait that all plugins implement
- Auto-Discovery: Plugins are automatically discovered and registered
- Lifecycle Management: Initialize โ Execute โ Cleanup phases
Dependency Management
- Automatic Resolution: Dependencies are resolved and executed in correct order
- Parallel Execution: Independent plugins run concurrently
- Output Passing: Plugin outputs are available to dependent plugins
Security
- Permission-Based: Plugins declare required permissions
- Capability System: Fine-grained access control
- Sandboxing: Optional isolation for untrusted plugins
Configuration
- JSON Schema: Type-safe configuration with validation
- Flexible Loading: Support for TOML, YAML, and JSON
- Environment Integration: Environment variable expansion
Examples
The repository includes several comprehensive examples:
- Text Processor: Multi-plugin text processing pipeline
- Plugin Testing: Comprehensive testing framework usage
- Security: Permission system and sandboxing
Run examples with:
Architecture
The plugin system is built around several core components:
- Registry: Manages plugin discovery and registration
- Executor: Handles plugin lifecycle and dependency resolution
- Context: Provides plugins with workspace access and communication
- Security Manager: Enforces permission-based access control
- Event System: Enables plugin communication and observability
For detailed architecture information, see ARCHITECTURE.md.
Testing
Pluggable includes a comprehensive testing framework:
use *;
async
Performance
- Parallel Execution: Independent plugins run concurrently
- Efficient Dependencies: Topological sorting for optimal execution order
- Minimal Overhead: Zero-cost abstractions where possible
- Resource Management: Automatic cleanup and memory management
Contributing
Contributions are welcome! Please read our Contributing Guide for details on our code of conduct and the process for submitting pull requests.
License
This project is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.