How my 1.17 MB PWA updates itself without an app store (7-endpoint config fan-out + a strict service worker)
I build RKMovies, a small 4K media player that ships as a 1.17 MB Android APK and as a PWA on our own site. No Play Store means no update channel. So when we want to change a notice, a download link, or bump the version prompt, the app has to fetch config at runtime. Here is what we landed on in updater.js and sw.js . The config fan-out fetchConfig() fires 7 GET requests concurrently:…
RKMovies, a compact 4K media player, functions as both an Android APK and a PWA. Without an app store, updating its content is a challenge. To overcome this, updater.js and sw.js were developed. The fetchConfig() function sends seven concurrent GET requests to various sources, each with a 4-second timeout and no-store cache directive.
Responses must be valid JSON containing at least one of platforms, version, or notice. The seven endpoints ensure redundancy; if one fails, another will step in. The highest latest_version is chosen, preferring platform-specific versions over the top-level one. This version is stored in localStorage, with fallback to the cached version if all requests fail.
The service worker, sw.js, precaches an 8-file shell, replacing the old shell with the new one on the next load. Code assets are served only from exact cache matches, while other files fall back to the cached shell. This setup allows for 1.17 MB APK updates, changing download links, notices, and prompts without a store release. The whole process is dependency-free, and the config fetch is a simple GET of a static JSON file.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.