FastAPI relay setup

Install and run the Python FastAPI relay that polls upstream Arduino JSON and exposes a stable HTTPS feed for ProbeHarbor to pull.

Close-up of white Cat-5e Ethernet cables with RJ45 connectors
Probe JSON usually leaves the LAN over Ethernet or a nearby relay, not the public internet directly. Photo: DiscDepotDundee.co.uk. CC BY-SA 4.0

A small FastAPI service on a home server or VPS can poll the Arduino over HTTP on the LAN, then expose a stable HTTPS URL to the internet. That keeps TLS and authentication off the microcontroller while preserving the JSON your dashboard already understands. If the Uno should push instead of waiting for a pull, run sketches/relay/push_https_forward.py and the ethernet_dht22_ingest sample: see Python feeds.

Minimal architecture

  1. Scheduler or on-demand fetch hits http://arduino.local/... on the LAN.
  2. FastAPI route returns the latest cached body with correct Content-Type.
  3. Reverse proxy (Caddy, nginx) terminates TLS on a public hostname.

Configuration tips

  • Set reasonable timeouts: garage uplink is slower than datacenter RTT.
  • Log upstream errors separately from client 404s.
  • Version the relay when JSON schema changes.

Caching layer

Add Redis cache so Cloudflare Workers and the Astro site do not hammer your home IP on every page view. Security: relay security.