How antonychr/orus-media-server works
Project type and purpose
• Orus is a full-stack media server:
• A Go-based backend binary that watches local media folders, syncs metadata via OMDB, stores info in SQLite, and exposes HTTP (REST + SSE) APIs.
• A React/Vite frontend (GUI) that runs in the browser, calling those APIs to display and manage media.
File structure
• Top level:
• main.go & internal/: Go application entry point + clean-architecture layers (delivery/controllers, domain/models/services/repos, infrastructure implementations).
• config/: TOML loading and tests.
• scripts/: Dev/build helpers.
• gui/: React+TypeScript app with src/components, data_fetching, providers, pages, layouts.
• utils/: shared Go helpers.
• Build & CI: .github/workflows, Makefile, go.mod, package.json under gui.
Read README for additional insights
• HTTP backend on PORT (default :3002), media & subtitle directories, SQLite DB, SSE for logs.
• Frontend dev on Vite :5173, production config page under /config.
• OMDB external API integration for metadata.
Main components
a. Client / Browser (React GUI)
b. Backend Service (Go binary)
• HTTP API layer (controllers in internal/delivery)
• Domain layer (services, models, repository interfaces)
• Infrastructure layer (SQLite repositories, file‐system watcher, OMDB provider, SSE log manager)
c. Local Resources
• File System: media/ and subtitles/ directories
• SQLite database file (database.db)
• Config (config.toml)
d. External Service: OMDB REST API
Relationships and interactions
• Browser ↔ HTTP API over REST endpoints (e.g. GET /titles, POST /subtitles)
• Browser ← SSE stream (server_logs_controller)
• Backend ↔ SQLite (CRUD via repository implementations)
• Backend ↔ File System watchers (media_event_handler → domain services → repositories)
• Backend → External OMDB API (fetch metadata when needed)
• Config values flow into all backend components (port, API_KEY, paths)
Architectural patterns & design principles
• Clean / Hexagonal architecture:
• Delivery layer depends on domain interfaces, not implementations.
• Domain services orchestrate business logic.
• Infrastructure implements repository and provider interfaces.
• Single‐responsibility: each package has one concern (config, delivery, domain, infrastructure).
• Observer pattern for file‐system events, SSE for real‐time logs.
Technologies & frameworks
• Backend: Go 1.20+, net/http (controllers & middlewares), SQLite, TOML config, OMDB REST.
• Frontend: React + TypeScript, Vite, Tailwind CSS, Context API for alerts & data, custom hooks, i18n, localStorage.
• CI/CD: GitHub Actions, Makefile, shell scripts.