Why My First Offline‑First PWA Crashed on a 3G Phone and How I Fixed It with IndexedDB Over LocalStorage
AI-generated illustration It was a rainy Thursday in Dhaka. My client, a boutique tea shop in Mirpur, sent a frantic screenshot: ‘Orders are stuck at 0 % sync, customers see a blank cart after the network drops.’ The PWA I built for them was supposed to work even on the 3G networks that still dominate many neighbourhoods. Instead, after the first 5 minutes of offline use, the whole checkout flow froze. I stared at the error console and saw QuotaExceededError: DOM Exception 22 flashing like a warning light on a rickshaw. The Hidden Problem Most Indie Developers Miss When you first hear the term offline‑first , the mind jumps to localStorage . It’s easy, it’s synchronous, you can drop a string in a few lines and call it a day. But that convenience is a trap. In Bangladesh, data caps are tight, connections flicker, and users expect their carts to survive a whole afternoon of spotty 3G. localStorage caps at roughly 5 MB per origin, stores only strings, and blocks the main thread while r...