Plugin Architecture
Plugins in Jellyfin are .NET assemblies that implement specific interfaces and are loaded at server startup.Plugin Manager
ThePluginManager discovers, loads, and manages plugins:
Emby.Server.Implementations/Plugins/PluginManager.cs
Plugins are loaded in isolated
AssemblyLoadContext instances to prevent version conflicts and enable unloading.Plugin Discovery
Plugins are discovered by scanning the plugins directory:1
Directory Scan
The PluginManager scans the configured plugins path (typically
/config/plugins).2
Metadata Loading
Each plugin directory should contain a
meta.json file:3
Version Validation
Plugin compatibility is checked against the server version:
4
Assembly Loading
Compatible plugins are loaded into the application:
Creating a Plugin
Basic Plugin Structure
All plugins must inherit fromBasePlugin:
MediaBrowser.Common/Plugins/BasePlugin.cs
Plugin Interfaces
MediaBrowser.Common/Plugins/IPlugin.cs
Example Plugin Implementation
Service Registration
Plugins can register services with the dependency injection container:MediaBrowser.Controller/Plugins/IPluginServiceRegistrator.cs
Example Service Registration
Plugin Types
Jellyfin supports various plugin types for different functionality:- Metadata Providers
- Authentication Providers
- Notification Services
- Scheduled Tasks
Fetch metadata from external sources:
Plugin Configuration
Plugins can provide configuration UI and persist settings:Configuration Class
Configuration Storage
Plugin configurations are automatically serialized to XML and stored in the plugin’s data folder.
Plugin Lifecycle
1
Discovery
Plugins are discovered when the PluginManager scans the plugins directory during server startup.
2
Loading
Compatible and enabled plugins are loaded into
AssemblyLoadContext instances.3
Service Registration
Plugins implementing
IPluginServiceRegistrator register their services with the DI container.4
Initialization
Plugin constructors are called, and singletons are instantiated.
5
Runtime
Plugins respond to events and provide functionality as requested by the server.
6
Uninstallation
When uninstalling,
OnUninstalling() is called for cleanup:Plugin Repository
Official plugins are distributed through the Jellyfin plugin repository:manifest.json
Official Plugins
Jellyfin provides several official plugins:TMDb
Metadata provider for movies and TV shows from The Movie Database
LDAP Authentication
Authenticate users against LDAP/Active Directory
Trakt
Sync playback progress and ratings with Trakt.tv
AniDB
Anime metadata from AniDB
Bookshelf
E-book and audiobook management
Webhook
Send webhooks on server events
Reports
Generate usage and library reports
Slack Notifications
Send notifications to Slack
Plugin Development Best Practices
- Versioning
- Error Handling
- Performance
- Logging
- Use semantic versioning (MAJOR.MINOR.PATCH)
- Specify
targetAbifor compatibility checking - Document breaking changes in changelogs
- Test against multiple Jellyfin versions
Testing Plugins
Next Steps
Architecture
Understand how plugins fit into Jellyfin
Media Libraries
Learn about library management
Users & Authentication
Extend authentication with plugins
API Reference
Build plugins using the API