How sebastianaigner/reelchest works
Based on our review of the file tree and README, this project ("reelchest") is a web-based media manager that provides functionality for downloading/uploading media, generating and comparing perceptual hashes (DHash) to detect duplicate videos, basic tagging, and integration with external search and video-hosting adapters. It is a full-stack application that also extends to mobile platforms along with a dedicated Rust-based component (duplicates-agent-rs) for handling duplicate calculations.
Main Components
• Backend Server:
– Developed primarily in Kotlin using Ktor (evident from files like Application.kt, KtorPlugins.kt and the structured api/handlers).
– Contains sub-components for processing:
• API layer (multiple handlers under api/handlers)
• Media library management (library, downloader, storage)
• Duplicate detection (duplicatecalculator, phash, helpertools)
• Media processing integrations: ffmpeg, autoscrape, setup tasks.
• Other utilities: logging, networking, and hashing.
• Frontend Web UI:
– Built with a modern JavaScript/TypeScript stack (React) as seen in the frontend directory (e.g., App.tsx, views, components, styles).
– Uses Vite for development and has its own dev server on port 3000. It also includes a proxy that forwards API calls (under /api/) to the backend.
• Mobile Applications:
– Located in the “mobileapp” directory; this includes platform-specific projects for Android, iOS, and multiplatform shared code.
– Involves several modules such as androidApp, iosApp, mediaPlayer, webView, and windowManager.
• Additional Tools & External Agents:
– A Rust-based duplicates agent in "duplicates-agent-rs" which likely complements the backend's duplicate detection.
– Process module to manage external processes.
Relationships and Interactions
• The Frontend (web UI) and Mobile Apps interact with the Backend via REST API endpoints.
• The API layer in the backend routes requests to various handlers (e.g., for file uploads, downloads, tagging, duplicate checking, analytics).
• The media processing pipeline kicks in when media is uploaded or downloaded: components such as downloader, ffmpeg integration, and media library modules handle file operations and quality processing (e.g., thumbnail generation).
• The duplicate detection mechanism involves computing perceptual hashes (DHash), comparing media, and managing duplicate responses.
• The Rust duplicates agent could either work as an auxiliary service or be integrated in a microservice style separated from the primary backend.
• Data storage and file management are handled by a combination of filesystem-based storage (with dedicated directories in test_media_library) and likely a lightweight database (notice SQLite references).
Architectural Patterns and Design Principles Highlighted
• Separation of Concerns: The backend is modularized into packages (e.g., api, downloader, library, storage) which clearly delineate responsibilities.
• Microservice-like Components: Although the system is monolithic in codebase form, there is clear separation between backend, frontend, and mobile apps. The existence of the self-contained “duplicates-agent-rs” points to a componentized approach.
• API-first approach: Clear API endpoints with DTOs for data interchange (see backend/src/main/kotlin/api/dtos) and auto-generated API documentation (openapi dir).
• Utilization of external tools: Integration with ffmpeg for media processing, and dedicated modules for hashing and duplicate calculations.
Relevant Technologies, Frameworks, & Libraries
• Kotlin with Ktor for backend server capabilities.
• Gradle (KTS) for build and dependency management.
• JavaScript/TypeScript with React and Vite for the frontend.
• Mobile development with Kotlin Multiplatform (shared, Android, iOS, webView etc.).
• Rust for performance-critical duplicate calculations (duplicates-agent-rs).
• Ffmpeg for video processing.
• Docker (Dockerfile present for containerization) and CI/CD configurations (.github/workflows).