HACKER Q&A
📣 Waterluvian

What's your favourite way to store/host <1KB of state on the Web?


I do a lot of web-based hobby/fun apps/games for fun. An issue I keep running into is preserving basic state (eg. progress, save data, etc.) It's always tiny: <1KB. I could use `localstorage` but I want to share that state across devices.

Because these are toys, I don't need security, backups, scale, or size. Which makes almost any choice I professionally know about feel like overkill. I do not want to have to worry about or maintain a web server.

I feel like I am looking for a service something like this:

1. Make an account and receive a token.

2. Embed the token in my game.

3. Use the token to make GET and POST to the service.

4. Don't abuse it or my token gets rescinded and now nobody can access their high scores or whatnot.


  👤 keepamovin Accepted Answer ✓
To glibly answer your question: favorite way? In the "usercloud" (as a cookie).

But more in depth, it's a good question!

You could get innovative and use localstorage combined with WebRTC to create a p2p storage "mesh". :)

Honestly tho I would use GitHub gists. They have an API. There's a token you can get. You could use whatever storage format you want (JSON anyone? Blah, why not just use malbolge).

Or if you're doing gists, why not go the whole nine gits? Depending on what your game runs on, you could just use git, to a shared repository, on GitHub.


👤 throwaway798214
Encode your game state to the URL itself and tell the user to bookmark that URL. User can then use browser sync, email or whatever to sync the bookmark to another computer to continue where they left off. No services, no tokens, no sharing data to some random company or person.

👤 ossm1db
I used a free redis instance. There are all sorts of free database and storage services out there. Cloudflare has some really cool free stuff.