Saves that vanish
Where does your progress go?
Garden Defense remembers your best wave, your seeds and the plants you've unlocked. Where does it keep them?
In local storage: a small storage area that the web browser keeps for each website, on that one device. The vibe-coded save is a single line:
localStorage.setItem('bestWave', 12);
When the game starts again, it reads the value back with localStorage.getItem('bestWave').
How local storage works
Local storage holds pairs of a key (a name, like bestWave) and a value (like 12), saved as text. Browsers give each website a few megabytes.
Prototypes use it because it's free, needs no server and no login, and works straight away. But it belongs to one website, in one browser, on one device. Nothing is sent anywhere else.
Quick check
Your friend plays Garden Defense in the browser on their phone, then switches to a tablet. Where is their progress?
- Only on the phone
- On both devices
- Saved online in their account
Show the answer
Only on the phone
Local storage stays on the device where you played. The tablet has its own empty storage, so your friend starts again from wave 1.
Ways a save disappears
- Clearing browsing dataClearing "cookies and site data" empties local storage too.
- A new deviceA new phone starts with empty storage. The old save stays behind.
- A different browserChrome and Firefox each keep their own storage, even on the same computer.
- Private windowsStorage in a private or incognito window is wiped when the window closes.
- Not played for a whileSome browsers, such as Safari, can clear storage for sites you haven't visited recently.
Player message
I reached wave 30 on the family laptop. Today I played on my phone and I'm back at wave 1! Did your update delete my save??
What most likely happened?
- The save is still in local storage on the laptop. The phone has its own, empty storage.
- The update deleted every player's save
- The phone is too slow to load wave 30
Show the answer
The save is still in local storage on the laptop. The phone has its own, empty storage.
Nothing was deleted. Local storage never leaves the device, so the phone started fresh. To the player it still feels like we lost their progress, and that's a real problem for the studio.
And cheaters love it
Local storage lives on the player's own device, so the player controls it. Desktop browsers have built-in developer tools (the F12 key opens them in most). One of their tabs lists the local storage of the site you're on, and any value can be changed by double-clicking it.
Type 99999999 over your score, reload the page, and the game believes it. No hacking skills needed.
Spot the cheat
1Key Value2bestWave 123seeds 3404highScore 999999995playMinutes 41
Which value was almost certainly edited by hand?
- bestWave: 12
- seeds: 340
- highScore: 99999999
Show the answer
highScore: 99999999
A player who reached wave 12 in 41 minutes can't have 99,999,999 points. The numbers don't fit together. A server can run checks like this, but the game on the player's device can be edited too.
Why it matters for a business
For a hobby, a lost save is sad. For a studio, it costs money.
- Fake scores ruin leaderboards, and honest players stop trying.
- If seeds can be bought with real money later, editing them means taking paid items for free.
- Lost progress turns into one-star reviews.
Game developers follow a rule: never trust the client. The client is the copy of the game running on the player's device. Anything important gets checked on a server, a computer the studio controls.
Quick check
If our game saves data on a player's device, the player can't change it.
- True
- False
Show the answer
False
It's their device, so they can change anything stored on it. That's why scores and purchases need to be checked on a server the player can't edit.
The fix: cloud saves
In Stage 4 we move saves to the cloud with Firebase. Players sign in, their progress lives in an online database, and it follows them to any device. Security rules on the server decide who can change what, so nobody can edit someone else's save, and the server can reject impossible scores.
Local storage still has a job: small things that don't matter if they're lost, like the sound volume.
Bolt says: That's the full disaster list: one computer, a giant file, copies instead of versions, and fragile saves. Time for the boss.
Fact-checked 9 October 2026
- MDN: Storage quotas and eviction criteria developer.mozilla.org
- MDN: Window.localStorage developer.mozilla.org
- WebKit: Full third-party cookie blocking and more (7-day storage cap) webkit.org
- Chrome DevTools: View and edit local storage developer.chrome.com
- Firebase: Cloud Firestore security rules firebase.google.com