Storing a lot of data client-side in a LiveView app

What would be a good approach to this? The best way I could think of was to use localStorage with hooks to load the data on mount. This works but isn’t the ideal solution because:

  1. There is a brief flash of the app with the default state until the mount hook is executed
  2. localStorage is limited to only 5MB-10MB of data depending on the browser

It would be ideal if there were an Ecto adapter for IndexedDB, but I’m not sure if that’s even possible since it’s a browser API.

1 Like

Can you elaborate on your use case?

I have an app for reading webnovels and light novels. It’s a kind of a “singleplayer” app, meaning there is no interaction at all between users, so there is no database or authentication or anything like that. I’m scraping various sites on the server-side and serving that to the browser. I want to store data such as all previously read novels/chapters, the last chapter/novel read and the scroll position in it, read history, bookmarked novels/chapters, all sorts of user preferences, etc., so that the app is more than merely a frontend for some scraper. It’s not a lot a lot of data, but I can easily imagine it surpassing the 5MB/10MB limit of localStorage.