Module Overview
The library is structured around these core modules:Types Module
Thetypes module contains all data structures and type definitions used throughout the library:
- addon: Addon manifests, descriptors, and resource definitions
- api: API requests and responses for backend communication
- library: Library items and metadata
- profile: User profiles, authentication, and settings
- resource: Meta items, videos, and content resources
- streaming_server: Streaming server types and settings
- streams: Stream items and buckets
Addon Transport Module
Theaddon_transport module provides an abstraction layer for communicating with Stremio addons:
- AddonHTTPTransport: Handles HTTP/HTTPS addon communication
- UnsupportedTransport: Fallback for unsupported protocols
Runtime Module
The runtime module implements the Elm Architecture pattern and provides the execution environment:- Runtime: Manages state and effect execution (see Elm Architecture)
- Env trait: Platform abstraction for I/O operations (see Effects and Runtime)
- Msg system: Message-based communication between components
- Effects: Asynchronous operations and state updates
Models Module
The models module contains all stateful application logic:- ctx: Core application context including user profile and library
- catalog_with_filters: Catalog browsing with filtering
- meta_details: Detailed metadata for content items
- player: Video player state and logic
- streaming_server: Streaming server management
- library_with_filters: Library browsing and filtering
Design Principles
Separation of Concerns
Each module has a clear responsibility: types for data, transport for communication, runtime for execution, and models for business logic.
Platform Independence
The Env trait abstracts platform-specific operations, allowing the core to run on desktop, mobile, and web.
Testability
Pure functions and message-based communication make the code highly testable without mocking.
Type Safety
Rust’s type system prevents entire classes of bugs at compile time.
Module Dependencies
Thetypes module is the foundation, with all other modules depending on it. The runtime provides the execution environment for models, which use addon_transport to communicate with addons.
Next Steps
Elm Architecture
Learn about the Effect, Update, and Msg pattern
Models and State
Understand how stateful models work
Effects and Runtime
Explore the runtime and effect handling
