This topic continues the offline discussion from the Meteor on Bun thread (Meteor on Bun: ESM bundle, native host, and initial benchmarks - #13 by dupontbertrand), so it gets its own place.
TL;DR
- Meteor 3.6 (currently in release candidate) ships meteor create --pwa: an installable Blaze app with a manifest, icons, a dependency-free service worker and an offline fallback page.
- It does not sync data offline. That is the next layer, and a working prototype exists: it keeps a copy of your published data on the device, queues Method calls while offline and replays them on reconnect.
- The plan is PWAs first, opt-in: at creation time, or by adding a dedicated package to an existing app.
- Before writing more code, I want your requirements: what has to work offline in your apps, and what must never happen.
Context
Offline is one of the most requested features, and the community already has good answers: jam:offline is documented in the Meteor docs, and the notes-offline example combines it with Workbox. What is missing is a batteries-included path in core, starting with a scaffold that works out of the box. I am working on PWAs, so offline data is the natural next step. It is also a hard topic: storage limits on the device, security of the data kept there, and how it plugs into DDP, Methods and Minimongo.
Already done: meteor create --pwa (Meteor 3.6, feat(cli): add 'meteor create --pwa' for an installable Blaze PWA by dupontbertrand · Pull Request #14473 · meteor/meteor · GitHub)
- Blaze app with a web app manifest, three icons (one maskable) and install support.
- A hand-written service worker with no dependencies. In production: network-first navigation with offline.html as fallback, stale-while-revalidate for hashed bundles, cache-first for images and fonts.
- In development the worker only precaches its static files, so hot code push never reuses a stale bundle.
- DDP traffic (/sockjs/ and /websocket) is never intercepted, and a path-prefixed ROOT_URL works unchanged.
- Covered by E2E tests and documented in the meteor create docs.
Already done: offline data prototype (not in a PR yet)
- The server stays the source of truth.
- Reads: the documents your publications already send are mirrored into IndexedDB. On the next start, Minimongo is filled from that copy before the connection is up, and Meteor’s normal reconnect brings it back in line with the server. The device only keeps what your publications send, so the server does no extra work to fill it.
- Writes: Methods you explicitly allow are applied locally while offline, stored in a durable queue in IndexedDB, and replayed on reconnect. The server Method is idempotent, so a replay never creates a duplicate. Everything not allowed keeps the normal behavior.
- One configuration call: which collections to keep, which Methods may run offline, and how each one writes locally.
- Validated on desktop (write offline, reload, reconnect: the write lands exactly once) and installed on a real phone.
- No change to Meteor core so far.
What I want to do
- Finish the engine: updates and removes (inserts only so far), and clearing the device copy when the signed-in user changes (first version written, not yet tested with real account switches).
- Replace the prototype’s interception of Method calls with a small, documented hook in the DDP client, so the engine does not depend on internals.
- Ship it opt-in for PWAs: as an option of meteor create --pwa, and as a package you add to an existing app.
- Outside PWAs: possible later, not in the coming weeks.
Where I need you
- What data must be available offline in your app, and roughly how much?
- Which writes must work offline, and how should a conflict be resolved when the server changed in between?
- Security: what may stay on a shared device, and what must disappear on logout?
- What do you use today (jam:offline, GroundDB, custom code), and what hurts?
- If you need this outside the browser (React Native, Capacitor), which storage do you use?
@waldgeist @xet7 your messages started this, so your input is especially welcome ![]()