How zigl3ur/jellyhub works
Based on our analysis of the file tree and README, JellyHub is a web application built with Next.js and React that aggregates media data from multiple Jellyfin servers into a single searchable interface. It’s structured as a full-stack Next.js application that uses Prisma as an ORM for Postgres along with Docker containerization and GitHub Actions for CI/CD.
Project Type and Purpose
• This is a full-stack web application that “indexes” media from various Jellyfin servers.
• Its primary function is to fetch media data from external Jellyfin server APIs and present a consolidated interface for searching and managing media.
• Docker is used for deployment, and the project utilizes a Postgres database (accessed via Prisma) to store configuration and possibly media indexing data.
Key Components
a. Frontend (Client-side):
• Next.js UI – Located in the “src/app” and “src/components” directories. It uses React to render pages (such as login, home, details, settings) and various UI components.
• User Interaction – The browser/client accesses the Next.js app; include labels such as “User Browser” or “Client”.
b. Backend / Server-side (Next.js App):
• API Routes and Server Components – Many files in “src/lib” (for authentication, API integrations to Jellyfin, prisma connection, etc.) indicate that parts of the Next.js app serve API endpoints.
• Middleware and Routing – There is a “src/middleware.ts” and structured directories under “src/app” that indicate server-side logic.
c. Database:
• Postgres – The Docker Compose file and Prisma schema (located in the “prisma” directory) show that Postgres is used as the underlying database.
• Prisma ORM – Represent this intermediate layer that handles database interactions.
d. External Jellyfin Servers:
e. Deployment / Containerization:
• Docker Containers – One container for the JellyHub application itself and another for the Postgres database. Docker Compose handles orchestration as defined in “docker-compose.yml”.
Relationships and Interactions
– The Next.js server reads/writes data (like indexing details, configurations) from/to Postgres.
– It also makes network calls to external Jellyfin APIs to fetch media data.
• Data flow such as login flows (authentication via JWT tokens) where the “auth” components mediate secure access. Highlight perhaps the “JWT_SECRET” configuration passing in environment variables.
Architectural Patterns and Design Principles
• Modular Architecting: The directory structure (with “src/components”, “src/hooks”, and “src/lib”) indicates a separation of concerns: UI, business logic (API calls, authentication), and configuration.
• Server-Side Rendering (SSR) and API routes: Emphasize Next.js’s hybrid rendering capabilities where pages are pre-rendered or rendered on demand.
• Containerization and Microservice Orientation: Even though this is a single application, it’s deployed in containers, supporting future scaling as separate services if needed.
Additional Details
• Mention that configuration and environment specifics (like JWT secrets, API endpoints, and DB connection strings) are set via environment variables as visible in both the Docker Compose file and the Docker CLI instructions.