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.
High-Level Topology
Section titled “High-Level Topology” 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) │ └─────────────────────┘Where Things Run
Section titled “Where Things Run”Homelab (Primary)
Section titled “Homelab (Primary)”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
Section titled “Cloudflare”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.
Google Cloud Platform
Section titled “Google Cloud Platform”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.
Backblaze B2
Section titled “Backblaze B2”Cold storage for database backups, retained for long-term durability.
Why Hybrid?
Section titled “Why Hybrid?”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.
What Traffic Goes Where
Section titled “What Traffic Goes Where”| Destination | Path | Latency-Sensitive? |
|---|---|---|
| Overlay SSE stream | Cloudflare → Tunnel → Next.js → Redis | Yes |
| Track ingest from desktop | Cloudflare → Tunnel → Next.js → Redis | Yes |
| Track history / dashboard | Cloudflare → Tunnel → Next.js → Cloud SQL | No |
| Artwork image | Cloudflare CDN → R2 | No (cached) |
| Authentication | Cloudflare → Tunnel → Next.js → Cloud SQL | No |
Cost Envelope
Section titled “Cost Envelope”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.