Example Plugins
Learning from existing plugins is one of the best ways to understand Unraid plugin development. Here are some well-structured plugins to study.
π· Screenshot needed: Example plugin interfaces
Recommended for Learning
Dynamix Plugins (by @bonienl)
The gold standard for Unraid plugins. Clean, well-organized code.
| Plugin | Good For Learning |
|---|---|
| dynamix.system.temp | Settings pages, sensor polling, nchan |
| dynamix.system.stats | Dashboard widgets, real-time updates |
Key patterns:
- Clean PLG structure
- Proper package building
- Multi-language support
- Settings page templates
Community Applications (by @Squid)
The app store plugin itself is a masterclass in PHP development.
- Repository: Squidly271/community.applications
- Good for: Complex PHP, AJAX patterns, large-scale plugin architecture
Key patterns:
- Extensive JavaScript/AJAX
- Plugin template management
- API integration
Compose Manager
A great example of Docker integration and modern plugin patterns.
- Repository: dcflachs/compose_plugin (original)
- Repository: mstrhakr/compose_plugin (refactored fork with UX improvements)
- Good for: Docker integration, event handlers, WebUI patching
Key patterns:
- Event scripts for Docker (
started,stopping_docker) - WebUI patches (version-specific in
patches/directory) - Settings with multiple options
- Build scripts for packages
- Docker labels integration (
net.unraid.docker.*) - Async loading patterns for better UX
- Header menu items (
Type="xmenu") - Conditional page display
User Scripts (by @Squid)
Simple but effective plugin for running custom scripts.
- Repository: Squidly271/user.scripts
- Good for: Script management, scheduling, simple UI
Unassigned Devices (by @dlandon)
Advanced device management plugin.
- Repository: dlandon/unassigned.devices
- Good for: Hardware integration, mount management, complex state
Plugin Patterns to Study
Simple Settings Plugin
Look at dynamix.system.temp for:
βββ TempSettings.page # Settings form
βββ default.cfg # Default values
βββ include/
βββ helpers.php # Utility functions
Dashboard Widget
Look at dynamix.system.stats for:
- Footer integration
- Real-time updates via nchan
- CSS for dashboard styling
Docker Integration
Look at compose.manager for:
βββ event/
β βββ started # Autostart stacks
β βββ stopping_docker # Graceful shutdown
βββ php/
β βββ exec.php # AJAX backend
βββ scripts/
βββ compose.sh # Docker commands
WebUI Patching
Look at compose.manager/patches/ for:
- Patching Docker Manager UI
- Version-specific patches
- Patch/unpatch scripts
Code Snippets from Real Plugins
Reading Plugin Config
From dynamix.system.temp:
$plugin = 'dynamix.system.temp';
$cfg = parse_plugin_cfg($plugin);
$unit = $display['unit']; // System temperature unit
AJAX Endpoint
From compose.manager/php/exec.php:
<?php
require_once("/usr/local/emhttp/plugins/compose.manager/php/defines.php");
$action = $_POST['action'] ?? '';
switch($action) {
case 'getStatus':
echo getStackStatus();
break;
case 'startStack':
echo startStack($_POST['name']);
break;
default:
echo "Unknown action";
}
Event Handler
From compose.manager/event/started:
#!/bin/bash
source /usr/local/emhttp/plugins/compose.manager/default.cfg
source /boot/config/plugins/compose.manager/compose.manager.cfg
for dir in $PROJECTS_FOLDER/*; do
if [ -f "$dir/autostart" ]; then
logger "Starting stack: ${dir##*/}"
# Start the stack...
fi
done
Package Build Script
From compose.manager/pkg_build.sh:
#!/bin/bash
tmpdir=/tmp/build.$$
mkdir -p $tmpdir/usr/local/emhttp/plugins/myplugin
# Copy source files
cp -R source/myplugin/* $tmpdir/usr/local/emhttp/plugins/myplugin/
# Set permissions
chmod +x $tmpdir/usr/local/emhttp/plugins/myplugin/event/*
chmod +x $tmpdir/usr/local/emhttp/plugins/myplugin/scripts/*
# Create package
cd $tmpdir
makepkg -l y -c y /output/myplugin-package-$VERSION.txz
Finding More Examples
GitHub Search
Search for Unraid plugins:
unraid plugin plgin GitHubemhttp pluginsin code search- Look at forks of popular plugins
Installed Plugins
Your own server is a learning resource:
# List installed plugins
ls /usr/local/emhttp/plugins/
# View a plugin's files
ls -la /usr/local/emhttp/plugins/community.applications/
# Read a page file
cat /usr/local/emhttp/plugins/dynamix.system.temp/TempSettings.page
Unraid Forums
- Plugin Support - Each plugin has a support thread
- Programming - Developer discussions
Tips for Studying Plugins
- Start with simple plugins - Donβt jump into Community Applications first
- Compare similar plugins - See how different authors solve the same problem
- Test live - Edit files in
/usr/local/emhttp/to experiment - Read the PLG first - Understand what gets installed where
- Check the events - See how plugins integrate with system lifecycle
Contributing Examples
Have a well-documented plugin? Consider:
- Adding detailed comments to your code
- Writing a README explaining architecture
- Submitting it to this documentation as an example
See Also
- Getting Started - Build your first plugin
- Best Practices - Tips from experienced developers
- PLG File Reference - Understanding the installer
