DEV Community

ludy.dev
ludy.dev

Posted on • Originally published at puzzleboxs.com

Building a 10-in-1 Daily Puzzle Hub That Works Offline and Weighs Under 1MB

By seeding this pseudo-random number generator with the current date, we get consistent daily boards globally without a single API request.

True Offline Support with Workbox

To make the app work offline, I configured Vite's PWA plugin with a custom Workbox Service Worker strategy.

We aggressive-cache all essential game assets (HTML, CSS, JS, and local dictionary modules). Since the daily game configurations are generated programmatically via the local date seed, users can play the current day's puzzles in the middle of a flight or deep inside a subway tunnel without losing their progress. Game states and daily streaks are automatically serialized and synced to localStorage.

Check out the live build at https://puzzleboxs.com, try turning off your network connection, and let me know what you think of the performance and offline synchronization!

Top comments (0)