Skip to main content
Jellyfin Server is built on .NET and follows a modular, layered architecture that separates concerns and enables extensibility through plugins. The server is designed to manage media libraries, handle user authentication, stream content, and provide a RESTful API for client applications.

Core Components

The Jellyfin Server architecture consists of several key layers and components:

Application Host

The ApplicationHost 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:
  1. Client sends HTTP request to Jellyfin API endpoint
  2. API Controller receives and validates the request
  3. Authentication Middleware verifies user credentials and permissions
  4. Business Logic processes the request using injected services
  5. Repository Layer retrieves or persists data to the database
  6. 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
Jellyfin maintains two separate databases: the main Jellyfin database (users, settings) and the library database (media items). This is a legacy design being gradually refactored.

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:
  1. In-memory default configuration
  2. JSON configuration files (logging.json, network.xml, system.xml)
  3. Environment variables (prefixed with JELLYFIN_)
  4. 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
WebSocket listeners are automatically registered and managed by the WebSocketManager service.

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