New package - jam:offline - An easy way to give your Meteor app offline capabilities

jam:offline is an easy way to give your Meteor app offline capabilities and make it feel instant. Its key features are:

  • Offline access – Saves Minimongo data in IndexedDB for offline access and instant reloading when reconnected.
  • Automatic syncing – Syncs offline actions automatically once reconnected.
  • Cross-Tab syncing – Keeps changes in sync across multiple tabs while offline.
  • Seamless reconciliation – Reconciles data with the server when reconnected.

It’s customizable so you can configure to your liking.

There’s been a lot of previous discussion about ways to build offline-first or local-first apps with Meteor. jam:offline is designed to make this easy.

The Readme also includes instructions on how to add a service worker to cache your app’s static assets and take the next step by converting your app into a PWA.

If you end up giving it a go or have ideas on how to make it better, let me know!

24 Likes

Your packages are a breath of fresh air in the Meteor ecosystem. :rocket:

I like your automatic approach to offline persistence per collection configuration and with filters! This package could quickly become essential for many Meteor apps. Congrats!

By the way, is it compatible with Meteor 3.0?

5 Likes

Thank you for the kind words Nacho! I really appreciate it.

Yep, it’s ready to go for Meteor 3.0.

6 Likes

This package is just incredible :clap:

1 Like

Wow, somehow missed this a week ago. Really nice stuff. Making minimongo play nice with offline seems like a major win for many apps. Thanks for this!

2 Likes

Hi,

Thanks for the package.

By the way, does this package work with the mobile application? Is the minimongo data saved when the user closes the app?

1 Like

Minimongo data is persisted to IndexedDB which means it will work for any app that can use IndexedDB.

For mobile, this means if you’re using Cordova (which uses a web view) or it’s a PWA, it will persist the data as expected when the user closes the app. When they come back, it will first load the persisted data and then perform the server sync if needed.

For those interested in creating PWAs with Meteor, I published a starter kit here:

6 Likes

@jam does this package also support offline login (or more specifically app restarts, without logging out), or do you have any hints on how to implement this?

Thanks for the starter kit. I see you’re handling push events in there too. Given the main client app is sleeping - what service do you use to send those ? I’ve seen firebase mentioned plenty but wondering if there’s something else. I checked progressier out once but never got round to implementing anything.

@koenlav if the user is logged-in, goes offline, and refreshes the app, they can continue using the app. This package persists their user data in IndexedDB so they won’t be logged out automatically. This assumes that you’re also caching your app’s static assets with a service worker – you can take a look at the pwa-kit link above if you don’t already have one set up. Is that what you had in mind?

For native mobile push notifications, in the past I’ve used firebase and Apple’s APN, which was a pain :slightly_smiling_face:. Maybe others here have some good recommendations for alternatives. I looked at OneSignal too in the past but didn’t like their data privacy policy.

I think with a pure PWA you could probably just use web-push for all platforms (now that Apple in theory supports it). Though if you’re sending a lot of notifications, I’d imagine you’d want this running separately from your main app.

2 Likes

Thanks. I’ll have a look. So when people setup this kind of thing, do people typically stop sending notifications on the client side altogether (we subscribe to a notification pub at the moment and use a simple push library there) or you handover when you notice the client goes offline ?

Yeah, that’s exactly what I meant, thanks!

1 Like