Skip to content

In a Nutshell (🌰)

  • SSM has a flexible plugin architecture for extending functionality
  • Plugins can add new UI components, data models, and backend services
  • The system uses a modular approach with clearly defined extension points
  • Developers can create plugins with React and TypeScript
  • Plugins are distributed as standalone modules that can be installed by users

Understanding SSM's Plugin Architecture

Squirrel Servers Manager (SSM) was designed with extensibility in mind. The plugin system allows developers to extend and enhance SSM's functionality without modifying the core codebase.

Plugin System Components

The plugin architecture consists of several key components that work together to provide a flexible extension mechanism:

Plugin Registry

The Plugin Registry is the central component that:

  • Discovers and loads available plugins
  • Manages plugin lifecycle (activation/deactivation)
  • Provides access to plugin metadata

Extension Points

SSM offers several extension points where plugins can integrate:

  1. UI Components

    • Add new pages
  2. API Extensions

    • Add new API endpoints
  3. Data Models

    • Define new data structures
    • Create custom storage solutions
  4. Event Handlers

    • Subscribe to system events
    • Implement custom event processing
    • Generate new events for other plugins

Plugin Structure

A typical SSM plugin consists of:

plugin-name/
├── manifest.json       # Plugin metadata and configuration
├── package.json        # Node.js package information
├── public/             # Static assets
│   └── icon.svg        # Plugin icon displayed in the UI
└── src/
    ├── client/         # Frontend React components
    │   └── index.tsx   # Client-side entry point
    └── index.ts        # Server-side entry point

The Manifest File

The manifest.json file defines the plugin's metadata and extension points:

json
{
  "id": "my-awesome-plugin",
  "name": "My Awesome Plugin",
  "version": "1.0.0",
  "description": "Adds awesome functionality to SSM",
  "author": "Your Name",
  "license": "MIT",
  "icon": "public/icon.svg",
  "entrypoints": {
    "client": "src/client/index.tsx",
    "server": "src/index.ts"
  },
  "slots": [
    {
      "id": "dashboard-widget",
      "component": "CustomDashboardWidget"
    }
  ],
  "routes": [
    {
      "path": "/plugins/awesome",
      "component": "AwesomePluginPage",
      "exact": true
    }
  ]
}

Plugin Lifecycle

Installation

Plugins can be installed through several methods:

  • From the Plugin Store in the SSM UI
  • Manually by placing files in the plugins directory
  • Via command line using npm or similar tools

Activation

When SSM starts up, it:

  1. Discovers installed plugins
  2. Validates plugin manifests
  3. Resolves dependencies between plugins
  4. Loads plugin code in the correct order
  5. Initializes plugin components and services

Execution

During runtime, plugins can:

  • Render UI components in their allocated slots
  • Process API requests through added endpoints
  • Respond to system events
  • Interact with other plugins through defined APIs

Deactivation

Plugins can be deactivated through the UI, which:

  • Unregisters UI components
  • Stops processing API requests
  • Unsubscribes from events
  • Releases allocated resources

Plugin Communication

Plugins can communicate with each other through several mechanisms:

Events

The event system allows plugins to:

  • Publish events that other plugins can subscribe to
  • React to events from the core system or other plugins
  • Implement event-driven architecture patterns

Shared Services

Plugins can register and consume services through the plugin registry:

  • Access core system services
  • Implement dependency injection patterns

Data Storage

Plugins can store and share data using:

  • Plugin-specific storage in the database
  • Temporary caches for performance optimization

Plugin Development Workflow

  1. Setup: Create a new plugin using the plugin generator tool
  2. Develop: Implement your plugin functionality
  3. Test: Use the development environment to test your plugin
  4. Package: Build and package your plugin for distribution
  5. Publish: Share your plugin with the community

Security Considerations

When developing or installing plugins, consider these security aspects:

  • Permissions: Plugins run with the same permissions as the SSM application
  • Data Access: Plugins can access and modify system data
  • Resource Usage: Poorly written plugins can impact system performance
  • Code Review: Always review plugin code before installation in production environments

Next step

🛠️
Plugin Development Guide

Learn how to create, test, and distribute your own SSM plugins

Made with love