r/HTML • • Sep 24 '26

Question Simplest way to sync data across devices for a static HTML file app (no backend)?

I have a single self-contained .html file (vanilla JS, no frameworks), an inventory app for a small shop. It uses IndexedDB, so data is stuck on whichever device/browser it was opened in.

I need it to sync across a couple devices (phone + PC) for one user. Small data (few hundred JSON records + small compressed images).

It's something simple, I just wanted to know if it's possible for the data to be stored. By the way, I don't have much idea about programming, this arose as a way to manage this business, adapted to how it works.

0 Upvotes

10 comments sorted by

3

u/tato64 Sep 24 '26

I dont know how small is it, but are you sure this cant be done with a shared google sheets file?

2

u/defaultdinoo Sep 24 '26

You could use something like the free Firebase tier, but this might be too complicated if you don't have any programming experience. But yes, it's doable to some extent

1

u/MetroluxSolutionsInc Sep 25 '26

The best way to achieve this is to have a proper backend since you're talking about a WebApp. This also surfaces other issues, like data protection, backups, security, etc.

A self contained file with access only to local storage and no proper backend (or access to third party services, or maybe even the internet from what you're describing) can't achieve what you want.

If you're looking for a solution for this, we might have the software for you.

1

u/OptimusCrimee Sep 25 '26

You can’t. You need a backend for this.

-2

u/Cookielabs Sep 24 '26

Yes, totally possible, and your setup is actually a good fit for it.

IndexedDB lives only inside that one browser on that one device, so to sync you need a small online database that both your phone and PC talk to. For a few hundred records and small images, a free tier is more than enough.

Firebase Firestore is probably the easiest for your case. It loads straight into a single HTML file with a script tag, keeps a local copy so the app still works offline, and syncs automatically when the device is back online. That's basically what you have now, plus sync. Supabase is a good alternative, but it takes a bit more setup and has no built-in offline cache.

Rough plan:
Export a JSON backup of your current data before changing anything.

Create a free Firebase project and turn on login (Google sign-in is simplest) so only you can see the data.

Replace the IndexedDB read/write parts of the code with Firestore calls, with offline persistence enabled.

Keep the images as compressed base64 inside the records (each record can be up to 1 MB). This avoids Firebase Storage, which now needs a billing account.

Set the Firestore security rules so only your account can read and write. Don't skip this one.

Host the file for free (Firebase Hosting or Netlify) so both devices open the same URL. On the phone you can "Add to Home Screen" so it feels like an app.

Since you're not a programmer: paste your file into Claude or ChatGPT and ask it to "replace IndexedDB with Firebase Firestore, with offline persistence and Google login, keeping all existing features, and add an import for my JSON backup." Do it one step at a time and test after each change.

1

u/tonkotsu_fan Sep 25 '26

Not sure why you were downvoted, this is a sound idea.