Most active commenters
  • TekMol(6)
  • gavmor(4)

←back to thread

200 points dcu | 21 comments | | HN request time: 1.856s | source | bottom
1. TekMol ◴[] No.44456461[source]
Do we still need a back-end, now that Chrome supports the File System Access API on both desktop and mobile?

I have started writing web apps that simply store the user data as a file, and I am very pleased with this approach.

It works perfectly for Desktop and Android.

iOS does not allow for real Chrome everywhere (only in Europe, I think), so I also offer to store the data in the "Origin private file system" which all browsers support. Fortunately it has the same API, so implementing it was no additional work. Only downside is that it cannot put files in a user selected directory. So in that mode, I support a backup via an old-fashioned download link.

This way, users do not have to put their data into the cloud. It all stays on their own device.

replies(5): >>44456656 #>>44456687 #>>44457268 #>>44457361 #>>44460545 #
2. thomascountz ◴[] No.44456656[source]
TIL! I enjoy building cloudless apps and have been relying on localstorage for persistence with an "export" button. This is exactly what I've been looking for.

A lot of what I've read about local-first apps included solving for data syncing for collaborative features. I had no idea it could be this simple if all you need is local persistence.

3. gavmor ◴[] No.44456687[source]
What about those of us who use multiple devices, or multiple browsers? I've been using local storage for years and it's definitely hampering adoption, especially for multiplayer.
replies(1): >>44458427 #
4. nico ◴[] No.44457268[source]
> Do we still need a back-end, now that Chrome supports the File System Access API on both desktop and mobile?

Could this allow accessing a local db as well? Would love something that could allow an app to talk directly to a db that lives locally in my devices, and that the db could sync across the devices - that way I still get my data in all of my devices, but it always stays only in my devices

Of course this would be relatively straightforward to do with native applications, but it would be great to be able to do it with web applications that run on the browser

Btw, does Chrome sync local storage across devices when logged in?

replies(2): >>44457578 #>>44460208 #
5. gausswho ◴[] No.44457361[source]
At least on the Android front, I'd prefer the app allow me to write to my own storage target. The reason is because I already use Syncthing-Fork to monitor a parent Sync directory of stuff (Obsidian, OpenTracks, etc.) and send to my backup system. In effect it allows apps to be local first and potentially even without network access, but allow me to have automatic backups.

If there were something that formalized this a little more, developers could even make their apps in a... Bring Your Own Network... kinda way. Maybe there's already someone doing this?

replies(2): >>44458440 #>>44464705 #
6. porridgeraisin ◴[] No.44457578[source]
> Btw, does Chrome sync local storage across devices when logged in?

No, but extensions have an API to a storage which syncs itself across logged-in devices. So potentially you can have a setup where you create a website and an extension and the extension reads the website's localStorage and copies it to `chrome.storage.sync`.

Sounds like an interesting idea actually.

replies(1): >>44458046 #
7. nico ◴[] No.44458046{3}[source]
That's a clever solution

I've been playing with chrome extensions recently, and have made them directly talk to a local server with a db. So using extensions, it's relatively easy to to store data locally and potentially sync it across devices

I like the idea of leveraging chrome.storage.sync though, I wonder what the limitations are

replies(1): >>44458110 #
8. porridgeraisin ◴[] No.44458110{4}[source]
> I wonder what the limitations are

https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/Web...

says that there is a 100kb limit, and a 512 KV pair limit per extension.

Quite limiting, but if this pattern becomes popular I don't see why it can't be expanded to have the same limit as localStorage (5MB)

9. TekMol ◴[] No.44458427[source]
One approach might be to save the file to a shared drive like Google Drive?
replies(2): >>44458770 #>>44459548 #
10. TekMol ◴[] No.44458440[source]
What do you mean by "storage target"?

Since the File Access API lets web apps simply use the file system, I guess you could just write the file to a shared drive.

replies(1): >>44460472 #
11. gavmor ◴[] No.44458770{3}[source]
Not sure I trust Dropbox to merge data. What happens when I want to migrate my data structures to a new schema?
replies(1): >>44461485 #
12. keysdev ◴[] No.44459548{3}[source]
Syncthing pls. Pls try to use open source alternative whenever possible even though they are not as developed as the closed sourced one, it works better for the public.
13. stephenlf ◴[] No.44460208[source]
> Could this allow accessing a local db as well?

Like IndexDB? It’s a browser API for an internal key-value storage database.

> Btw, does Chrome sync local storage across devices when logged in?

Syncing across devices still requires some amount of traffic through Google’s servers, if I’m not mistaken. Maybe you could cook something up with WebRTC, but I can’t imagine you could make something seamless.

14. gausswho ◴[] No.44460472{3}[source]
I may have misunderstoood. Does that mean with this API on both desktop and phone I can point to an arbitrary drive on the system without restriction? If so, it does indeed do what I'd like.
replies(1): >>44461494 #
15. thekingshorses ◴[] No.44460545[source]
Any examples?
16. TekMol ◴[] No.44461485{4}[source]
As far as I know, Dropbox does not merge data.

I never tried it, but from the descriptions I have read, Dropbox detects conflicting file saves (if you save on two devices while they are offline) and stores them as "conflicting copies". So the user can handle the conflict.

As a developer, you would do this in the application. "Hey, you are trying to save your data but the data on disk is newer than when you loaded it ... Here are the differences and your options how to merge.".

replies(1): >>44461636 #
17. TekMol ◴[] No.44461494{4}[source]
That's basically how the File System Access API works, yes.

Technically probably not completely "without restriction". But for all practical purposes, it works just fine for me.

18. gavmor ◴[] No.44461636{5}[source]
> Hey, you are trying to save your data but the data on disk is newer than when you loaded it

You're suggesting an actual API-facilitated data sync via Dropbox? Sure, but at that point why? Unless the data also needs to be read by 3rd party applications, might as well host it myself.

replies(1): >>44461765 #
19. TekMol ◴[] No.44461765{6}[source]
Sure. You brought up Dropbox. Not me.
replies(1): >>44465230 #
20. tehbeard ◴[] No.44464705[source]
The closest I'm aware of is https://remotestorage.io/ , the protocol has been relatively static for a while but not widely adopted.
21. gavmor ◴[] No.44465230{7}[source]
s/Dropbox/Google Drive/