Skip to content

Cloud Architecture

Now Playing runs on a hybrid cloud architecture. The application services live on a homelab server for low-latency real-time operations, while durable storage, global edge delivery, and failover are handled by cloud providers.

Your DJ software
Now Playing Desktop
HTTPS / Socket.IO / SSE
┌───────────────────────────────────────────┐
│ Cloudflare Edge │
│ - DNS, SSL, DDoS protection │
│ - Load balancer (primary / failover) │
│ - CDN for overlay assets and artwork │
└────────────┬────────────────────┬─────────┘
│ │
Cloudflare Tunnel Direct HTTPS
│ │
▼ ▼
┌─────────────────────┐ ┌─────────────────────┐
│ Proxmox Homelab │ │ GCP Failover VM │
│ (Primary, "Blue") │ │ (Standby, "Green") │
│ │ │ │
│ Next.js + Python │ │ Same image, stopped│
│ Redis │ │ unless activated │
└─────────┬───────────┘ └─────────┬───────────┘
│ │
└────────────┬────────────┘
┌─────────────────────┐
│ GCP Managed Data │
│ - PostgreSQL │
│ - Redis (replica) │
└─────────────────────┘

The homelab server — a Proxmox host running an LXC container with a unified Docker image — hosts the application services:

  • Next.js web application (dashboard, APIs, overlay pages).
  • Track Service, Router Service, Overlay Service, Twitch Service, File Output Service, Mix Processor Service — Python microservices that deliver the real-time pipeline.
  • Redis — in-memory pub/sub, streams, and short-lived cache.

All of these services run in a single container supervised by s6-overlay, which gives each service its own independent supervision and restart logic.

Cloudflare sits at the edge:

  • DNS and SSL for app.nowplayingapp.com.
  • Load balancer that routes traffic between primary and failover pools based on health checks.
  • Tunnel that connects the homelab outbound — no port forwarding needed, and no public IP exposed.
  • CDN + R2 for artwork and static assets.

GCP hosts the data tier and the standby failover VM:

  • Cloud SQL (PostgreSQL) — durable storage for users, tracks, settings.
  • Managed Redis — persistent key-value data that survives deploys and failovers.
  • Failover VM — a standby Compute Engine instance running the same application image, stopped by default.

Cold storage for database backups, retained for long-term durability.

Pure cloud would be simpler operationally, but a few constraints push the architecture toward hybrid:

  • Latency. The real-time pipeline (track → enrichment → overlay) is measured in hundreds of milliseconds. Keeping services co-located with Redis on local hardware keeps round-trips tight.
  • Cost. Running Redis and the Python services on owned hardware avoids per-service cloud billing.
  • Durability. Putting PostgreSQL in GCP Cloud SQL gives managed durability and backups that a single-host homelab cannot match.

The blended design gets the best of both: low-latency hot paths on local hardware, durable data on managed services.

DestinationPathLatency-Sensitive?
Overlay SSE streamCloudflare → Tunnel → Next.js → RedisYes
Track ingest from desktopCloudflare → Tunnel → Next.js → RedisYes
Track history / dashboardCloudflare → Tunnel → Next.js → Cloud SQLNo
Artwork imageCloudflare CDN → R2No (cached)
AuthenticationCloudflare → Tunnel → Next.js → Cloud SQLNo

The full stack runs at a low monthly cost because the compute stays on the homelab. Cloud charges come mainly from Cloud SQL (small instance) and R2 (egress for artwork). A standby failover VM costs nothing while stopped; it only runs when the primary is down or during a deployment window.