Skip to content

Architecture Overview ​

The Usenet Media Stack is built on a foundation of professional software engineering principles, combining hot-swappable JBOD storage, universal hardware optimization, and a sophisticated CLI following modern design patterns.

Core Design Philosophy ​

Bell Labs Standards ​

The codebase follows principles taught by Stan Eisenstat at Yale:

  • Clarity over cleverness - Every function is documented, every error teaches
  • Professional standards - 80-character lines, comprehensive error handling
  • Quality architecture - Single responsibility, proper abstractions, testing

Modern CLI Design ​

Inspired by industry-leading tools:

  • Git: Subcommand + flags perfection (git commit -m "msg" --amend)
  • Docker: Object + action model (docker container run --rm -it)
  • Pyenv: Workflow-oriented with smart help (pyenv install 3.9.7)

System Architecture ​

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     Usenet Media Stack                     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  CLI Interface (usenet)                                     β”‚
β”‚  β”œβ”€ Pure subcommand routing                                 β”‚
β”‚  β”œβ”€ Three-tier help system                                  β”‚
β”‚  └─ Rich zsh/bash completions                               β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Component Management                                       β”‚
β”‚  β”œβ”€ Storage: Hot-swappable JBOD                            β”‚
β”‚  β”œβ”€ Hardware: Universal GPU optimization                    β”‚
β”‚  β”œβ”€ Services: 19-service orchestration                     β”‚
β”‚  └─ Backup: Configuration management                       β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Service Layer (19 Services)                               β”‚
β”‚  β”œβ”€ Media: Jellyfin, Overseerr, YACReader, Tdarr          β”‚
β”‚  β”œβ”€ Automation: Sonarr, Radarr, Readarr, Bazarr, etc.     β”‚
β”‚  β”œβ”€ Downloads: SABnzbd, Transmission                       β”‚
β”‚  └─ Management: Portainer, Netdata                         β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Container Orchestration (Docker Compose)                  β”‚
β”‚  β”œβ”€ Base: docker-compose.yml                               β”‚
β”‚  β”œβ”€ Hardware: docker-compose.optimized.yml                 β”‚
β”‚  └─ Storage: docker-compose.storage.yml (dynamic)          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Storage Layer                                              β”‚
β”‚  β”œβ”€ Hot-swappable JBOD drives                              β”‚
β”‚  β”œβ”€ Cross-platform exFAT support                           β”‚
β”‚  β”œβ”€ Cloud storage integration                               β”‚
β”‚  └─ Network storage (NFS/SMB)                              β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Hardware Layer                                             β”‚
β”‚  β”œβ”€ Universal GPU support (NVIDIA/AMD/Intel/Pi)            β”‚
β”‚  β”œβ”€ Automatic driver installation                          β”‚
β”‚  β”œβ”€ Performance profiling                                   β”‚
β”‚  └─ Real-time optimization                                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Component Architecture ​

CLI Design Pattern ​

bash
# Modern subcommand architecture
usenet <component> <action> [options]

# Examples:
usenet storage list           # Component: storage, Action: list
usenet hardware optimize     # Component: hardware, Action: optimize  
usenet services restart      # Component: services, Action: restart

Component Responsibilities ​

ComponentPurposeKey Features
StorageHot-swappable JBOD managementReal-time detection, API sync, exFAT support
HardwareGPU optimization & driversUniversal detection, auto-install, benchmarking
Services19-service orchestrationHealth monitoring, log access, API management
BackupConfiguration managementMetadata tracking, atomic operations, encryption
DeployOrchestrated deploymentPre-flight checks, profile selection, validation
ValidateSystem health checksAuto-fix, monitoring, troubleshooting

Data Flow Architecture ​

Media Automation Pipeline ​

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Request   β”‚    β”‚   Search    β”‚    β”‚  Download   β”‚    β”‚   Process   β”‚
β”‚ (Overseerr) │───▢│ (Prowlarr)  │───▢│ (SABnzbd)   │───▢│   (Tdarr)   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚                   β”‚                   β”‚                   β”‚
       β–Ό                   β–Ό                   β–Ό                   β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Organize   β”‚    β”‚   Quality   β”‚    β”‚   Storage   β”‚    β”‚   Serve     β”‚
β”‚ (Sonarr/    │───▢│ (Recyclarr) │───▢│   (JBOD)    │───▢│ (Jellyfin)  β”‚
β”‚  Radarr)    β”‚    β”‚             β”‚    β”‚             β”‚    β”‚             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Storage Integration Flow ​

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚    Drive    β”‚    β”‚  Discovery  β”‚    β”‚     API     β”‚
β”‚  Detection  │───▢│   & Pool    │───▢│    Sync     β”‚
β”‚             β”‚    β”‚ Management  β”‚    β”‚             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚                   β”‚                   β”‚
       β–Ό                   β–Ό                   β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Docker    β”‚    β”‚   Service   β”‚    β”‚   Health    β”‚
β”‚  Compose    │───▢│  Restart    │───▢│ Validation  β”‚
β”‚ Generation  β”‚    β”‚             β”‚    β”‚             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

File System Architecture ​

Project Structure ​

usenet-media-stack/
β”œβ”€β”€ usenet                  # Single entry point CLI
β”œβ”€β”€ lib/                    # Component implementations
β”‚   β”œβ”€β”€ commands/          # CLI command handlers
β”‚   β”‚   β”œβ”€β”€ storage.zsh    # Hot-swappable JBOD management
β”‚   β”‚   β”œβ”€β”€ hardware.zsh   # GPU optimization system
β”‚   β”‚   β”œβ”€β”€ backup.zsh     # Configuration backup/restore
β”‚   β”‚   β”œβ”€β”€ services.zsh   # 19-service management
β”‚   β”‚   β”œβ”€β”€ deploy.zsh     # Orchestrated deployment
β”‚   β”‚   └── validate.zsh   # System health validation
β”‚   β”œβ”€β”€ core/             # Shared utilities
β”‚   β”‚   β”œβ”€β”€ init.zsh      # Configuration loading
β”‚   β”‚   β”œβ”€β”€ common.zsh    # Utilities and logging
β”‚   β”‚   └── stan-quality.zsh # Code quality framework
β”‚   └── test/             # Testing framework
β”œβ”€β”€ config/               # Service configurations (19 services)
β”œβ”€β”€ completions/          # Rich CLI completions
β”œβ”€β”€ docker-compose.yml    # Base service definitions
β”œβ”€β”€ docker-compose.*.yml  # Generated optimizations
β”œβ”€β”€ .env                  # All credentials (gitignored)
└── docs/                # Professional documentation

Configuration Management ​

Configuration Sources (Priority Order):
1. Command-line flags    (--profile dedicated)
2. Environment variables (.env file)
3. Configuration files   (config/*.conf)
4. Intelligent defaults  (hardware-based)

Network Architecture ​

Service Exposure ​

External Access (Cloudflare Tunnel):
β”œβ”€β”€ jellyfin.example.com β†’ Jellyfin (8096)
β”œβ”€β”€ requests.example.com β†’ Overseerr (5055)
β”œβ”€β”€ comics.example.com β†’ YACReader (8082)
└── manage.example.com β†’ Portainer (9000)

Internal Network (Docker Bridge):
β”œβ”€β”€ Media Services     (8080-8099)
β”œβ”€β”€ Automation Stack   (8900-8999, 6700-6799)
β”œβ”€β”€ Management Tools   (9000-9999, 19999)
└── File Sharing      (445, 2049)

Security Model ​

  • Zero exposed ports - All access via Cloudflare Tunnel
  • API authentication - Unique keys for each service
  • Container isolation - Services in dedicated network
  • Credential management - Environment-based secrets

Hardware Optimization Architecture ​

Multi-Platform GPU Support ​

GPU Detection & Optimization:
β”œβ”€β”€ NVIDIA RTX Series
β”‚   β”œβ”€β”€ NVENC/NVDEC encoding
β”‚   β”œβ”€β”€ CUDA acceleration
β”‚   └── nvidia-docker2 integration
β”œβ”€β”€ AMD RDNA/GCN Series  
β”‚   β”œβ”€β”€ VAAPI acceleration
β”‚   β”œβ”€β”€ AMF encoding
β”‚   └── Mesa driver integration
β”œβ”€β”€ Intel Arc/Iris
β”‚   β”œβ”€β”€ QuickSync encoding
β”‚   β”œβ”€β”€ VA-API support
β”‚   └── Intel media drivers
└── Raspberry Pi
    β”œβ”€β”€ VideoCore GPU
    β”œβ”€β”€ Hardware decode
    └── GPU memory allocation

Performance Profiles ​

ProfileResourcesUse CaseTranscoding
Light25% CPU, 4GB RAMDevelopmentSoftware only
Balanced50% CPU, 8GB RAMHome serverHardware enabled
High75% CPU, 16GB RAMMedia serverOptimized
Dedicated100% CPU, All RAMApplianceMaximum

Storage Architecture ​

Hot-Swappable JBOD Design ​

Storage Pool Management:
β”œβ”€β”€ Drive Discovery
β”‚   β”œβ”€β”€ Local drives (HDD/SSD/NVMe)
β”‚   β”œβ”€β”€ USB/External (hot-pluggable)
β”‚   β”œβ”€β”€ Network storage (NFS/SMB)
β”‚   └── Cloud mounts (rclone)
β”œβ”€β”€ Pool Configuration
β”‚   β”œβ”€β”€ Interactive selection
β”‚   β”œβ”€β”€ Cross-platform compatibility
β”‚   β”œβ”€β”€ Permission management
β”‚   └── Mount point generation
└── Service Integration
    β”œβ”€β”€ Dynamic Docker Compose
    β”œβ”€β”€ API synchronization
    β”œβ”€β”€ Hot-swap workflows
    └── Zero-downtime updates

Cross-Platform Compatibility ​

  • ExFAT support - Works across Windows/macOS/Linux
  • Portable drives - Camping trips and travel
  • Cloud integration - Dropbox, OneDrive, Google Drive
  • Network storage - NAS and server integration

Service Integration Architecture ​

API Synchronization ​

Storage Change Event:
β”œβ”€β”€ Drive Detection
β”œβ”€β”€ Pool Update
β”œβ”€β”€ Docker Compose Generation
β”œβ”€β”€ Service API Updates
β”‚   β”œβ”€β”€ Sonarr: Root folders
β”‚   β”œβ”€β”€ Radarr: Movie libraries  
β”‚   β”œβ”€β”€ Jellyfin: Media libraries
β”‚   └── Tdarr: Processing paths
└── Health Validation

Service Dependencies ​

Dependency Graph:
β”œβ”€β”€ Core Services (Always first)
β”‚   β”œβ”€β”€ Prowlarr (indexer management)
β”‚   └── SABnzbd (download client)
β”œβ”€β”€ Automation Services
β”‚   β”œβ”€β”€ Sonarr (depends: Prowlarr, SABnzbd)
β”‚   β”œβ”€β”€ Radarr (depends: Prowlarr, SABnzbd)
β”‚   └── Bazarr (depends: Sonarr, Radarr)
β”œβ”€β”€ Media Services
β”‚   β”œβ”€β”€ Jellyfin (depends: storage availability)
β”‚   └── Tdarr (depends: Jellyfin, storage)
└── Management Services
    β”œβ”€β”€ Overseerr (depends: Sonarr, Radarr)
    └── Recyclarr (depends: Sonarr, Radarr)

Quality Assurance Architecture ​

Testing Framework ​

Quality Gates:
β”œβ”€β”€ Code Quality (Stan's Standards)
β”‚   β”œβ”€β”€ 80-character lines
β”‚   β”œβ”€β”€ Function contracts
β”‚   β”œβ”€β”€ Error handling
β”‚   └── Documentation
β”œβ”€β”€ Functionality Testing
β”‚   β”œβ”€β”€ Unit tests (component level)
β”‚   β”œβ”€β”€ Integration tests (workflow level)
β”‚   β”œβ”€β”€ System tests (full stack)
β”‚   └── Regression tests (change validation)
└── User Experience Testing
    β”œβ”€β”€ CLI usability
    β”œβ”€β”€ Error message clarity
    β”œβ”€β”€ Help system completeness
    └── Performance benchmarks

Validation System ​

  • Pre-deployment checks - System requirements, configuration
  • Runtime monitoring - Service health, resource usage
  • Auto-fix capabilities - Common issues resolution
  • Comprehensive reporting - JSON exports, troubleshooting

Extensibility Architecture ​

Adding New Services ​

bash
# Add service to docker-compose.yml
services:
  new-service:
    image: new-service:latest
    ports:
      - "8888:8080"
    volumes:
      - ./config/new-service:/config
    environment:
      - API_KEY=${NEW_SERVICE_API_KEY}

# Register with CLI system
usenet services add new-service --category custom

Custom Hardware Support ​

bash
# Add hardware detection logic
detect_custom_hardware() {
    # Custom GPU detection
    if lspci | grep -i "custom gpu"; then
        echo "Custom GPU detected"
        return 0
    fi
    return 1
}

# Register optimization profile
usenet hardware profile add custom-gpu \
  --transcoding-args "-hwaccel custom" \
  --quality-settings high

Built with ❀️ following Bell Labs standards. Dedicated to Stan Eisenstat.