Skip to main content

Llamafin Architecture & Technology

Audience: End users and technical evaluators Last Updated: 2026-04-04 Version: 2.0.0


Overview​

Llamafin is a cross-platform media player application built with modern web technologies. It connects to your Jellyfin media server to deliver a rich, feature-complete music listening experience across mobile, desktop, and web platforms.


Technology Foundation​

Built With Industry-Standard Frameworks​

Llamafin leverages battle-tested technologies to ensure reliability, performance, and maintainability:

ComponentTechnologyWhy It Matters
Application FrameworkAngular 16Enterprise-grade framework with strong typing and component-based architecture
User InterfaceIonic 7Native-quality UI components that work consistently across all platforms
Mobile PlatformCapacitor 5Direct access to native device features (camera, filesystem, haptics)
Desktop PlatformElectron 25Full desktop application with system tray integration and native menus
State ManagementNgRx 16Predictable state management ensuring UI consistency and debuggability
Audio StreamingHLS.js + Web Audio APIAdaptive bitrate streaming with professional audio processing capabilities
VisualisationButterchurnIndustry-standard MilkDrop-compatible audio Visualisations

Application Architecture​

Three-Tier Architecture​

Llamafin follows a clean separation of concerns across three layers:

┌─────────────────────────────────────────┐
│ Presentation Layer │
│ User Interface & User Interaction │
└─────────────────────────────────────────┘
↓
┌─────────────────────────────────────────┐
│ Business Logic Layer │
│ State Management & Feature Services │
└─────────────────────────────────────────┘
↓
┌─────────────────────────────────────────┐
│ Infrastructure Layer │
│ Networking, Storage & Device Access │
└─────────────────────────────────────────┘

1. Presentation Layer​

The presentation layer handles everything you see and interact with:

  • Component-Based Design: Every UI element is a self-contained component
  • Change Detection: Optimised rendering only updates what's necessary
  • Responsive Layouts: Adapts seamlessly to phone, tablet, and desktop screens
  • Theme System: Light, dark, black, and white themes with customizable backgrounds

2. Business Logic Layer​

The intelligence behind the application:

  • Feature Modules: 33 independent feature modules, each managing a specific capability
  • State Management: 45+ state slices tracking everything from playback to settings
  • Reactive Programming: UI automatically updates in response to state changes
  • Unidirectional Data Flow: All data flows in one direction, preventing bugs and making the app predictable

3. Infrastructure Layer​

The foundation that powers everything:

  • HTTP Communication: Six-layer interceptor pipeline for robust API communication
  • Offline Storage: IndexedDB-based storage for downloads and app data
  • Device Integration: Native device features through Capacitor plugins
  • WebSocket Connection: Real-time event subscription with your Jellyfin server

Platform Support​

Mobile Platforms​

iOS & Android (via Capacitor 5):

  • Native file system access for offline downloads
  • Haptic feedback for tactile interactions
  • Media Session API integration (car UI, lock screen controls)
  • Background audio playback
  • Network awareness (WiFi vs cellular optimisation)

Desktop Platforms​

Windows, macOS, Linux (via Electron 25):

PlatformArchitecturePackage Format
Windowsia32, x64Installer (.exe), Portable
macOSx64Installer (.dmg), Application bundle
Linuxx64Debian (.deb), AppImage, Generic

Desktop Features:

  • System tray integration
  • Global media key support
  • Native file dialogues
  • Custom title bars
  • Window state persistence
  • Service Worker for caching and offline capability
  • Web app manifest for installability
  • Push notification support
  • Browser-based HLS streaming

Feature Architecture​

33 Feature Modules​

Llamafin's functionality is organised into independent feature modules:

Core Features​

FeaturePurpose
AuthenticationSecure login with Jellyfin, Quick Connect support, session management
Audio EngineProfessional audio processing with 10-band EQ, stereo control, loudness compensation
PlayerQueue management, shuffle/repeat modes, autoplay, preview playback
LibraryBrowse and manage your music collection (albums, artists, songs, genres, playlists)
SearchFind content with online and offline search, suggestions
Settings10 categories of customizable preferences

Advanced Features​

FeaturePurpose
DJ ModeAutomatic queue generation with smart play modes
Sonic AnalysisAudio fingerprinting to find sonically similar tracks
Llamafin ConnectPeer-to-peer device control with cryptographic security
Remote ControlSynchronised playback across multiple devices
DownloadsOffline playback with chunked downloads and transcoding
Device MetricsReal-time and historical performance monitoring

UI/UX Features​

FeaturePurpose
VisualisationsButterchurn (MilkDrop) and spectrum analyser visualizers
LyricsDisplay synchronised lyrics with remote search
Sleep TimerAutomatic playback shutdown
ThemesLight, dark, black, and white themes with custom backgrounds
InternationalizationMulti-language support with dynamic switching

State Management​

Predictable State with NgRx​

Llamafin uses NgRx (Redux for Angular) to manage application state:

How It Works:

  1. User Action: You interact with the UI (e.g., click "Play")
  2. Action Dispatched: A typed action object is sent to the store
  3. Effects Handle Side Effects: API calls, navigation, etc.
  4. Reducer Updates State: Pure function creates new state
  5. Selectors Provide Data: Memoized selectors extract needed data
  6. UI Updates Automatically: Components react to state changes

Why This Matters:

  • Predictability: Same actions always produce same state changes
  • Debuggability: Every state change is traceable and logged
  • Performance: Memoized selectors prevent unnecessary recalculations
  • Consistency: Single source of truth eliminates state conflicts

45+ State Slices​

Each major feature has its own isolated state slice:

State SliceTracks
authLogin status, user info, session token
playerQueue, current track, shuffle/repeat mode
audioPlayback state, volume, EQ settings
libraryActive library, user views
settingsAll user preferences (composite)
downloadsDownload status, metadata, file paths
networkConnectivity, server status, speed
websocketReal-time connection status

Security Architecture​

Authentication Flow​

  1. Login: Username and password sent to Jellyfin server
  2. Token Storage: Authentication token stored securely with expiry
  3. Session Rehydration: On app start, token validated and session restored
  4. User Hashing: SHA-256 hash of User ID computed for P2P pairing
  5. Auto-Logout: Invalid tokens trigger secure logout

Data Protection​

  • Password Hashing: Passwords never stored locally, only server-authenticated
  • Token Expiry: Authentication tokens have expiration dates
  • Secure P2P: Cryptographic key pairs for device identity
  • HTTPS Support: All communication can be encrypted in transit

HTTP Security​

Six-layer interceptor pipeline:

  1. Server URL Injection: Routes requests to correct server
  2. Error Handling: Global error management
  3. Authentication: Automatic token injection
  4. Retry Logic: Automatic retry on transient failures
  5. Cache Prevention: Timestamps prevent stale data
  6. Unauthorized Handling: 401 responses trigger secure logout

Offline Architecture​

Download System​

Llamafin's offline capability is powered by a sophisticated download system:

Download Types:

  • Direct Downloads: Original file format
  • Transcoded Downloads: Server-side conversion for compatibility
  • Chunked Downloads: Parallel chunk downloading for performance

Features:

  • Concurrent chunk downloads
  • Download resume on interruption
  • Smart download detection
  • Offline queue management
  • Storage path selection (internal/external)

Storage Layer​

  • IndexedDB: Primary storage for downloads and cached data
  • File System API: Native file access for offline media
  • Queued Operations: Storage calls queued until database ready
  • Version Migration: Database version tracking (v49)

Audio Architecture​

Web Audio API Integration​

Professional audio processing pipeline:

Audio File → Decoder → EQ (10-band) → Stereo Control → Loudness → Limiter → Analyser → Output

Audio Features:

  • 10-Band Equalizer: Precision frequency control
  • Stereo Panning: Left/right balance control
  • Stereo Width: Haas effect for spatial audio
  • Loudness Compensation: Consistent volume across tracks
  • Audio Limiter: Prevent distortion at high volumes
  • Analyser Node: Real-time frequency data for Visualisations

Streaming Support​

  • HLS.js: Adaptive bitrate streaming from Jellyfin
  • Gapless Playback: Seamless track transitions
  • Preview Mode: 30-second previews for browsing
  • Buffer Management: Intelligent pre-buffering

Real-Time Communication​

WebSocket Integration​

Llamafin maintains a real-time connection to your Jellyfin server:

What It Monitors:

  • Playback state changes
  • Library updates
  • User notifications
  • System events

Connection Management:

  • Automatic reconnection on failure
  • Offline operation when disconnected
  • Connection status tracking
  • Event buffering during outages

Performance Architecture​

optimisation Strategies​

StrategyImplementation
Lazy LoadingAll pages loaded on-demand
Change DetectionOnPush strategy prevents unnecessary checks
MemoizationSelectors cache computed results
Bundle Limits4mb initial bundle warning, 5mb hard limit
Component Styles16kb per-component style limit
Subscription ManagementAutomatic cleanup prevents memory leaks

Monitoring & Debugging​

Built-In Tools:

  • Device metrics tracking (CPU, memory, network)
  • Performance overlay (FPS, render time)
  • Audio debugging overlay
  • Storage inspection tools
  • Log viewer with filtering

Development Tools:

  • State change logging (dev mode)
  • Background state tracking
  • Angular DevTools support
  • Network speed testing

Internationalization​

Multi-Language Support​

  • Dynamic Language Switching: Change language without restart
  • Supported Languages: Multiple languages with translation scripts
  • Translation APIs: Google Translate and DeepL integration
  • Pluralization: Language-aware plural rules
  • Date/Number Formatting: Locale-aware formatting

Extensibility​

Plugin & Extension Points​

While Llamafin is a closed-source application, the architecture supports:

  • Custom Visualizers: Plug-in audio Visualisations
  • DJ Modes: Configurable auto-play algorithms
  • Sonic Analysis: Extensible audio fingerprinting
  • Server Plugins: Jellyfin server-side extensions

Build System​

Automated Build Pipeline​

Development:  npm start          # Hot-reload development server
Production: npm run build # Optimised production build
Mobile: npm run build-android / build-ios
Desktop: npm run package-win-x64 / package-mac / package-linux

Version Management​

  • Semantic Versioning: Major.Minor.Patch (2.0.0)
  • Automated Versioning: Scripts for version bumps
  • Database Versioning: Tracks IndexedDB schema (v49)
  • Environment Swapping: Dev/prod configuration replacement

Dependency Management​

Production Dependencies​

  • 75+ npm packages including Angular, Ionic, Capacitor, NgRx
  • 7 custom native libraries (crypto, device metrics, discovery, etc.)
  • Audio libraries: HLS.js, Butterchurn, fft.js, mux.js, jsmediatags
  • UI libraries: Font Awesome, Chart.js

Code Quality​

  • TypeScript Strict Mode: Zero tolerance for type errors
  • ESLint: Automated code quality checks
  • Template Type Checking: Strict template compilation
  • Component Suffix Rules: Enforced naming conventions

Architecture Benefits​

For Users​

✅ Reliability: Predictable state management prevents UI bugs ✅ Performance: Optimised rendering and lazy loading ✅ Offline Capability: Robust download and storage system ✅ Cross-Platform: Consistent experience everywhere ✅ Extensibility: New features can be added safely

For Technical Evaluators​

✅ Maintainability: Clean architecture with feature isolation ✅ Testability: Service layer abstraction enables mocking ✅ Scalability: Modular structure supports growth ✅ Type Safety: Strict TypeScript prevents runtime errors ✅ Debuggability: Complete state traceability


Technical Specifications​

SpecificationValue
FrameworkAngular 16.0.0
UI LibraryIonic 7.0.1
State ManagementNgRx 16.0.0
Mobile RuntimeCapacitor 5.2.1
Desktop RuntimeElectron 25.3.2
TypeScriptStrict mode enabled
Database Version49
Feature Modules33
State Slices45+
Route Definitions80+
Shared Components50+
HTTP Interceptors6
Supported PlatformsiOS, Android, Windows, macOS, Linux