Tired of losing sales because the little API that powers your online booking form goes dark after a power outage? I felt the same when a storm knocked out the power at my house in Pompano Beach and my site started throwing errors. Here’s the no‑fluff setup I use so the API stays reachable without spending a dime on a full‑time server.

  1. Expose the API with a Cloudflare Tunnel – I install cloudflared on my Raspberry Pi, run cloudflared tunnel run my‑home‑api, and let Cloudflare give me a stable https://<random>.trycloudflare.com endpoint. The tunnel reconnects automatically when power returns, so the public URL never changes.

  2. Add a Netlify serverless function as a proxy – Netlify lets me create a tiny JavaScript function (netlify/functions/api-proxy.js). It receives the request from my site, forwards it to the Cloudflare URL, and returns the response. Because Netlify runs the function on their edge network, the call is fast and the public URL of the function (https://my‑site.netlify.app/.netlify/functions/api-proxy) never moves.

  3. Health‑check & auto‑restart – A simple cron job on the Pi hits https://my‑site.netlify.app/.netlify/functions/api-proxy/health. If it gets a non‑200 response, the script runs systemctl restart cloudflared. This keeps the tunnel alive even after a brief power hiccup.

That’s it – three tiny pieces, no extra hosting costs, and my booking form stays online even when the lights go out.

I build sites and automations for small businesses at dreamfuturestech.com.