System design

How Hazelink stays smooth

When you unlock your PC from the phone, traffic spikes across relay and agent — here’s how Hazelink keeps control, files, and stats feeling instant.

The path at a glance

Your phone never talks to a random open port on the internet. It reaches your PC through the nearest good path — local network when you’re home, or the Hazelink relay when you’re away — while accounts and pairing live in Firebase.

Phone / Web LAN (nearby) Cloud relay PC agent Firebase Auth · pairing · heartbeat · billing

relay.hazelink.app · app.hazelink.app/pc/** · agent on 127.0.0.1:5000 (PC)

Six ways the stack stays online

Nearest path · like a CDN

LAN-first, then cloud relay

When you’re on the same Wi‑Fi, the phone tries your PC’s local agent address first. Away from home, traffic goes through the Hazelink relay so you don’t open ports on your router.

  • Faster when you’re nearby
  • Works from mobile data without LAN
Split services · like microservices

Independent pieces, one product

Hazelink is not one giant server. The PC agent, relay hub, Firebase Auth/Firestore, Cloud Functions (pairing, billing, wake), and Flutter clients each do one job. If billing is busy, remote control still runs.

  • Login, pairing, control, and payments stay separated
  • A hiccup in one area doesn’t take the whole app down
Elastic cloud · like auto scaling

Managed scale where it matters

Firebase Hosting and Cloud Functions scale up when many users pair or check out at once, then scale down when quiet. Your PC agent stays on your machine — we don’t rent a always-on box per user.

  • Handles launch spikes without slowing everyone
  • Your hardware does the heavy PC work
Close to the device · like caching

Local + presence cache

Games and apps catalogs, stats snapshots, and last-seen presence are cached so the home screen doesn’t wait on every network hop. The UI stays usable while the next refresh lands.

  • Library and stats feel snappy
  • Fewer round-trips for the same data
Recovery · like chaos readiness

Degraded mode, not a hard stop

We don’t treat one flaky ping as “PC dead.” If live stats or recent last-seen say you’re online, Hazelink still opens control. The agent and relay reconnect when the link drops.

  • Soft reachability instead of false “offline”
  • Prepared for real network blips
Adaptive path · like adaptive bitrate

Match the path to the link

Short timeouts on LAN, longer on relay. If one base URL answers “offline,” the client tries the next. Same idea as quality that adapts — here the route adapts so actions keep completing.

  • Prefer the working base URL
  • Smooth control even when the network wobbles

What this means for you

You install one helper on Windows, pair with a code, and the stack picks the best route. You don’t configure CDN edges or scale groups — that’s on us. Your job is keeping the agent running (or using Wake when the PC is asleep).

Read the app guide → Open the app