Core Components
The Jellyfin Server architecture consists of several key layers and components:Application Host
TheApplicationHost is the central orchestrator of the Jellyfin Server, responsible for initializing and managing all core services.
Layer Structure
Jellyfin follows a clean architecture pattern with distinct layers:1
Jellyfin.Api - REST API Layer
ASP.NET Core controllers that expose HTTP endpoints for client applications. Handles request validation, authentication, and response serialization.Location:
Jellyfin.Api/Controllers/2
MediaBrowser.Controller - Interface Layer
Defines interfaces and contracts for all core services. This layer provides abstractions for library management, user management, authentication, and more.Location:
MediaBrowser.Controller/3
Emby.Server.Implementations - Business Logic
Implements the core business logic, including library scanning, metadata retrieval, session management, and scheduled tasks.Location:
Emby.Server.Implementations/4
Jellyfin.Data - Data Layer
Entity Framework Core models and database context for persisting application data.Location:
Jellyfin.Database/Service Registration
Services are registered using ASP.NET Core’s dependency injection container:Jellyfin.Server/CoreAppHost.cs
Data Flow
The typical data flow through the Jellyfin Server architecture:- Client Request
- Library Scan
- Media Streaming
- Client sends HTTP request to Jellyfin API endpoint
- API Controller receives and validates the request
- Authentication Middleware verifies user credentials and permissions
- Business Logic processes the request using injected services
- Repository Layer retrieves or persists data to the database
- Response is serialized and returned to the client
Key Managers and Services
LibraryManager
Manages the media library, including item resolution, metadata, and library events.MediaBrowser.Controller/Library/ILibraryManager.cs
The
LibraryManager uses a caching layer (FastConcurrentLru) to improve performance when accessing frequently requested items.UserManager
Handles user creation, authentication, and policy management.MediaBrowser.Controller/Library/IUserManager.cs
PluginManager
Discovrs and loads plugins from the plugins directory, managing their lifecycle.Emby.Server.Implementations/Plugins/PluginManager.cs
Database Architecture
Jellyfin uses SQLite with Entity Framework Core for data persistence:- JellyfinDbContext: Main database context for user data, permissions, and preferences
- ItemRepository: Manages media items and their metadata
- UserDataRepository: Stores user playback positions and watch history
Migration System
The server includes a migration system for database schema updates:Jellyfin.Server/Program.cs
Configuration Management
Configuration is loaded from multiple sources in priority order:- In-memory default configuration
- JSON configuration files (
logging.json,network.xml,system.xml) - Environment variables (prefixed with
JELLYFIN_) - Command-line arguments
Jellyfin.Server/Program.cs
WebSocket Support
Real-time updates are delivered to clients via WebSocket connections:- SessionWebSocketListener: Sends session state updates
- ActivityLogWebSocketListener: Broadcasts activity log entries
- ScheduledTasksWebSocketListener: Notifies about scheduled task progress
Next Steps
Media Libraries
Learn how Jellyfin organizes and scans media
Users & Authentication
Understand the user system and authentication
Plugins
Extend Jellyfin with custom plugins
API Reference
Explore the REST API endpoints