Instant downloads β€’ Annual updates
DocsDeveloper APIExtending Sera with Custom Spokes

Extending Sera with Custom Spokes

2026-03-018 min read

Extending Sera with Custom Spoke Plugins

Sera's hub-and-spoke architecture is designed to be extensible. You can create your own spoke plugins that integrate with the Sera ecosystem.

Spoke Plugin Structure

A minimal Sera spoke plugin needs:

my-sera-spoke/
β”œβ”€β”€ my-sera-spoke.php      # Main plugin file
β”œβ”€β”€ includes/
β”‚   └── class-sera-bridge.php  # Sera integration
└── readme.txt

Registering with the Hub

Use the sera_register_updaters action to register your spoke:

php
<?php
/**
 * Plugin Name: My Sera Spoke
 * Description: A custom spoke plugin for Sera
 * Version: 1.0.0
 * Requires Plugins: sera
 */

// Register with Sera Hub
add_action('sera_register_updaters', function($registry) {
    $registry->register([
        'slug'    => 'my-sera-spoke',
        'name'    => 'My Sera Spoke',
        'version' => '1.0.0',
        'file'    => __FILE__,
        'type'    => 'spoke',
    ]);
});

Using the AI Engine

Access Sera's AI Engine from your spoke:

php
// Check if Sera Core is available
if (function_exists('sera_ai_request')) {
    $response = sera_ai_request([
        'messages' => [
            ['role' => 'system', 'content' => 'You are a helpful assistant.'],
            ['role' => 'user', 'content' => 'Analyze this data: ' . $data],
        ],
    ]);
    
    $content = $response['choices'][0]['message']['content'];
}

Sending Alerts

Push alerts to the Sera Alert Center:

php
if (function_exists('sera_create_alert')) {
    sera_create_alert([
        'type'     => 'warning', // 'critical', 'warning', 'info'
        'title'    => 'Custom Alert',
        'message'  => 'Something important happened in my spoke plugin.',
        'spoke'    => 'my-sera-spoke',
    ]);
}

Registering Commands

Add commands to the Sera Command System:

php
add_filter('sera_commands', function($commands) {
    $commands['my_spoke_scan'] = [
        'name'        => 'My Spoke Scan',
        'description' => 'Run a custom scan',
        'callback'    => 'my_spoke_run_scan',
        'spoke'       => 'my-sera-spoke',
    ];
    return $commands;
});

function my_spoke_run_scan($args) {
    // Your scan logic here
    return ['status' => 'complete', 'results' => $results];
}

Adding to the Dashboard

Register a dashboard widget:

php
add_filter('sera_dashboard_widgets', function($widgets) {
    $widgets['my_spoke_widget'] = [
        'title'    => 'My Spoke Status',
        'callback' => 'my_spoke_dashboard_widget',
        'priority' => 20,
    ];
    return $widgets;
});

function my_spoke_dashboard_widget() {
    echo '<div class="sera-widget">';
    echo '<p>Everything is running smoothly.</p>';
    echo '</div>';
}

Best Practices

  1. Always check for Sera Core β€” Use function_exists() before calling Sera functions
  2. Graceful degradation β€” Your plugin should work (with reduced features) even if Sera Core is deactivated
  3. Follow WordPress coding standards β€” Use proper sanitization, escaping, and nonce verification
  4. Use Sera's hooks β€” Don't modify Sera Core files directly; use the provided hooks and filters
  5. Version compatibility β€” Check sera_version() to ensure compatibility with the installed Sera Core version