javascriptstoragesavestateapplication-state

How to save a state of a site without implementing my own database backend?


Suppose there is a site (a javascript app) which users regularly use and they request the ability to save their state on the site, so they can continue from where they left off.

The site has no database backend, it's all a one page javascript app which has a pretty complicated state, so simply generating an url is not an option, because the state can be several kilobytes, so it's too big for an url.

Cookies are also not an option both because of the size and because I want the state to be portable, so when the user saves it he can use it to continue on an other machine too.

Since I don't want to complicate the site with a database backend and authentication I thought the site's state could be generated as a text which the user can copy and later can paste this text config to a text field which can be parsed from javascript to restore app state.

It can work, though it's somewhat cumbersome for the user (storing the text config somewhere and pasting it back later). Is there some other option to do this without adding db? (E.g. I thought about saving the text config (which has no confidential info) to some public paste site, though I don't know if there is one with a js api which supports anonymous uploads).

Are there other options?


Solution

  • Based on your comments, I think Firebase might be an option for you. It is a database, but not hosted locally. You can have your client-side javascript access it directly, without cluttering your own back-end.