How teampiped/piped-backend works
Main Components
a. Core Service Components:
• API Server Layer (based on the handlers directory)
• Authentication System (auth handlers)
• Video Processing System (StreamHandlers)
• Database Layer (indicated by hibernate.cfg.xml and db changelog)
• External Service Integrations (NewPipeExtractor)
b. Key Features:
• Channel Management
• Playlist Handling
• Search Functionality
• Trending Content
• PubSub System
• User Management
• Federation Support
┌─ Client Layer ─────────────────────┐
• Frontend Clients (Vue.js) │
• ┬────────────────────┘
• ↓
┌─ API Gateway Layer ────────────────┐
• ServerLauncher │
• ┬────────────────────┘
• ↓
┌─ Handler Layer ───────────────────────────────────────┐
• ┌─────────────┐ ┌──────────┐ ┌────────────┐ │
• Public APIs │ │Auth APIs │ │Stream APIs │ │
• ┘ └──────────┘ └────────────┘ │
• ┬────────────────────────────────────────┘
• ↓
┌─ Service Layer ───────────────────────────────────────┐
• ┌──────────┐ ┌─────────┐ ┌────────────┐ ┌─────────┐ │
• Video │ │Channel │ │Playlist │ │Search │ │
• Services │ │Services │ │Services │ │Services │ │
• ┘ └─────────┘ └────────────┘ └─────────┘ │
• ┬────────────────────────────────────────┘
• ↓
┌─ Data Layer ─────────────────────────────────────────┐
• ┌──────────┐ ┌─────────────────┐ ┌───────────────┐ │
• Hibernate │ │Database │ │Cache │ │
• ORM │ │(Multiple DBs) │ │ │ │
• ┘ └─────────────────┘ └───────────────┘ │
• ┘
Important Relationships
• Frontend → API Gateway: REST/HTTP communication
• Handler Layer → Service Layer: Internal method calls
• Service Layer → Data Layer: Database operations
• Service Layer → External Services: NewPipeExtractor integration
• Authentication flow through the layers
Additional Elements
• Docker container boundaries (multiple Dockerfile variants exist)
• Database migration flows (shown by changelog directory)
• Federation support components
• External service dependencies
Technical Details
• Database support for multiple backends (PostgreSQL, CockroachDB, YugabyteDB)
• Authentication mechanisms
• Cache layers
• Background job processors (Multithreading.java)
Specific Implementation Notes
• Handler structure (/server/handlers/)
• Utility services (/utils/)
• Database models (/utils/obj/db/)
• Federation components (/utils/obj/federation/)
This architecture should emphasize the privacy-focused nature of the system and how it interfaces with YouTube's data while maintaining user privacy.