{"repo":"robinbraemer/sveltekit-static-to-remote","free":true,"listed":false,"github":"https://github.com/robinbraemer/sveltekit-static-to-remote","clone":"git clone https://github.com/robinbraemer/sveltekit-static-to-remote.git","description":"📱🌐 Demo: Call SvelteKit remote functions from a static frontend to a separate backend deployment. Perfect for CDNs, mobile apps (Tauri/Capacitor), and serverless architectures.","language":"TypeScript","stars":65,"topics":["capacitor","cdn","mobile-apps","monorepo","pnpm","remote-functions","serverless","service-worker","static-site","sveltekit"],"license":null,"category":"deployment-docker-iac","readme_excerpt":"🚀 SvelteKit Static-to-Remote Call SvelteKit remote functions from a static frontend to a separate backend deployment https://github.com/user-attachments/assets/dae1146a-9391-4ab9-911e-b951b2fe7942 In this demo, the static frontend example is deployed on Surge CDN, while the backend is running locally and exposed through a Cloudflare tunnel. You can see that the remote functions are calling the backend URL instead of the frontend URL. --- ⚡ TLDR 🎯 Problem : SvelteKit remote functions only work within the same deployment, but you want static frontend + separate backend. 💡 Solution : Service worker magic! 1. Same file paths in both apps → identical endpoint hashes 2. Service worker intercepts / app/remote/[HASH]/call → redirects to backend 3. Backend CORS handles cross-origin requests securely 4. Result : Seamless remote function calls across deployments! ✨ Perfect for : Static sites • Mobile apps (Tauri/Capacitor) • CDN deployments • Serverless architectures --- 🚀 Quick Start 🧪 Test : Open → try the form, buttons, text converter → functions execute on backend! --- 🔧 How It Works The Secret : SvelteKit generates remote function hashes based on file paths , not code. 1. Same file paths ( src/lib/all.remote.ts ) in both apps → identical hashes 2. Service worker ( service-worker.ts ) intercepts / app/remote/[HASH]/call 3. Redirects to backend server with custom X-SvelteKit-Remote header 4. Backend CORS ( hooks.server.ts ) allows cross-origin calls 5. Backend recognizes hash →","default_branch":null,"files":null,"tree":[],"storefront":"/r/robinbraemer","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/robinbraemer/sveltekit-static-to-remote/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}