Using Supabase offline #357
Replies: 73 comments 149 replies
-
June 2023 updateThis is getting a lot of attention still so I'll add a more color. In our opinion the right way to do offline would be to have a full, timestamped history of every single event that happened in your database. That way, when a client goes offline we can have the client say "give me every update between XX and YY timestamps". This is similar to how Watermelon works, but Watermelon requires you to implement an "updated_at" column in every table. How can we achieve this without you needing to add this column to every table? We'd need to store the Write Ahead Log for your database, and then expose it via an endpoint. As you can imagine, this is a lot of data and there are no good off-the-shelf tools to do this (we need something like wal-g but it needs to store uncompressed data). We also need to figure out how this approach works with RLS which adds some complexity. For now, please continue to use these tools:
Sept 2022 updatefor now the best solutions that already work with supabase are:
2021 updateHey @skoshy this isn't possible right now, but we're working on it! It will take a while unfortunately - conflict resolution is quite difficult to solve. |
Beta Was this translation helpful? Give feedback.
-
|
Use case Ideal solution Considering alternatives (Merged from #448 ) |
Beta Was this translation helpful? Give feedback.
-
|
Is this at all possible, since the data authority is Postgres and unavailable on an offline client? I imagine that something could be implemented in the data-wrapper to cache changes that haven't been persisted yet and serve those changes back. Optimistic updates (sort of like what Apollo Cache does with its' internal state management). The problem with that is if Postgres rejects the changes when it's back online, then the user flow is interrupted and we have no good way of communicating this failed write back to the client. I'd love to hear how the Supabase team imagines this could be solved. |
Beta Was this translation helpful? Give feedback.
-
|
As a mobile app developer (Flutter) offline syncing is the biggest thing missing from Supabase. Our app needs to work offline, and Firestore just handled this for us automatically. We're looking into a custom solution with sqflite for the offline database. Hopefully that works out, otherwise we'll just have to settle for being chained to Google. |
Beta Was this translation helpful? Give feedback.
-
|
I think it's much better if your local (offline) db is as close to your cloud data model as possible, in this case, SQL. Then use a common abstraction (supabase api) to query the same way offline as online. SQLite and sqlite.js are good options. For web its a little more tricky but things like absurd-sql look interesting. For web, Supabase would probably need to rewrite a bunch of the Postgres stuff too. |
Beta Was this translation helpful? Give feedback.
-
|
A solution designed around the "local state, transparent sync" strategy would be killer. Aside from addressing the offline problem, imagine how much code you would have NOT to write, and how much more responsive the application would be: no network queries and mutations, just modify a local object, and the UI updates immediately while data gets synchronized in the background. Perhaps the most interesting offering that I've seen in this space is Replicache (not open source though). |
Beta Was this translation helpful? Give feedback.
-
|
If the graphql had all the features of hasura (and more), I think this would be a moot issue. J |
Beta Was this translation helpful? Give feedback.
-
|
Is there any update on this? I agree that it's a dealbreaker feature for many, not only for true offline support but for saving devs the local data caching headache. Is offline support with the JS SDK underway? Or will the GraphQL extension fill that need (with something like urql or Apollo providing clientside caching)? This is something that comes out of the box with Firebase and I think it's an almost essential feature for most production apps using Supabase |
Beta Was this translation helpful? Give feedback.
-
|
I am looking for this as well. Another important thing for me: server side encryption! The host of the backend should not be able to read user data. |
Beta Was this translation helpful? Give feedback.
-
|
Raising hand in support 🙋♂️ |
Beta Was this translation helpful? Give feedback.
-
|
+1 from me also. I was thinking of migrating to supabase but even with firebase I get negative feedback about the internet being required for authentication for my mobile app. I will not be able to use supabase until this is supported. |
Beta Was this translation helpful? Give feedback.
-
|
A good option would be to use supabase's pg_graphql extension to do the work with rxdb graphql replication. Unfortunately the extension doesn't support subscriptions yet 🙁. |
Beta Was this translation helpful? Give feedback.
-
|
Can we get a rough estimate of how long this will take? Like 2 months or 12 months? For me, and as it seems a lot of other developers, this will determine whether we use Supabase or stick with an offline-supporting BaaS like Firebase. With a rough deadline we could consider if we can let our users wait for an offline support feature or whether this is not an option. I am currently using Supabase in my prototype and I am absolutely loving it so far; but no offline support is unfortunately a deal-breaker. |
Beta Was this translation helpful? Give feedback.
-
|
Any bet there will be a massive influx of users from firebase to supabase if this feature come alive. Supabase is great already but offline caching/syncing is a must and is the only thing stopping most of us from transitioning. Is it still on the roadmap? Got an ETA @kiwicopple ? Cheers |
Beta Was this translation helpful? Give feedback.
-
|
Anyone got experience if urql's offline support is good enough? https://formidable.com/open-source/urql/docs/graphcache/offline/ |
Beta Was this translation helpful? Give feedback.
-
|
I also started looking into InstantDB, but it feel it could be a feature that can be baked into a larger ecosystem, like Supabase. |
Beta Was this translation helpful? Give feedback.
-
|
I considered using https://dexie.org/ for the offline experience, but in the end I decided to go back to Firebase. I'm prototyping and time to market is very important to me. |
Beta Was this translation helpful? Give feedback.
-
|
I'm currently in the process of using watermelonDB as an offline-first solution alongside my supabase backend. The biggest pain point for me had been the amount of boilerplate needed to get the client side schemas and models in sync with my backend. My dream would be for supabase to support an offline mode out of the box and to be able to autogenerate the schemas and models on the client. |
Beta Was this translation helpful? Give feedback.
-
|
let's go supabase! this is the most obvious missing link to truly make the claim as a real firebase alternative |
Beta Was this translation helpful? Give feedback.
-
|
Yes, first party offline support in supabase would be great. Meanwhile did you try electric-sql?
|
Beta Was this translation helpful? Give feedback.
-
|
We are still looking for this features. |
Beta Was this translation helpful? Give feedback.
-
|
I subscribed to this topic back when there weren't any third party options for flutter. Now, I think there's plenty of good options and I no longer think it's important that Supabase builds the feature themselves, for fear of the overhead and how complicated it will make the client sdk. I think time would be better spent just making sure that integrations with the various third parties and os libraries are really well documented and very easy to setup on every given platform. |
Beta Was this translation helpful? Give feedback.
-
|
@hamishjohnson may you kindly share those third party you are referring to? |
Beta Was this translation helpful? Give feedback.
-
|
i read someone from supabase say "keep your eyes" open in a comment at one point. they have been open for a long time and i don't see anything. brick and powersync have picked up the slack where they shouldn't have to. imagine if firebase had a 3rd party doing this? this is the responsibility of the platform and they will sherlock these once they figure it out. https://pub.dev/packages/brick_offline_first_with_supabase https://pub.dev/packages/powersync and these don't deal with files either.... it's a huge shortcoming of supabase for truly helping people get to market with little fuss |
Beta Was this translation helpful? Give feedback.
-
|
i came across https://pub.dev/packages/hydrated_bloc as another potential solution for flutter apps |
Beta Was this translation helpful? Give feedback.
-
|
I know there are third party options, but this should be a feature of Supabase SDKs for iOS, Android and multiplatform. It was the main reason we were working with MongoDB App Services and Realm. Having it without requiring a third party makes everything easier. |
Beta Was this translation helpful? Give feedback.
-
|
I am personally following the local development guide, but instead of using Docker I choose to use Podman instead. I followed Podman introduction and tutorials and you will need to setup Podman first. The I have yet to test all of the possible Supabase features on local development, but so far so good. I am doing all of this on a Fedora linux computer. Cheers. |
Beta Was this translation helpful? Give feedback.
-
|
I think at least @dventimisupabase owes us an explanation for us to make informed decision. |
Beta Was this translation helpful? Give feedback.
-
|
Hey guys @kiwicopple suggested several tools: Legend-State: https://supabase.link/local-first-expo-legend-state Has anyone here worked with any of these? For context: I’m building with Expo + React Native, but I think this is an important topic overall since these tools don’t have huge adoption yet, even though they could become the backbone of apps in production. |
Beta Was this translation helpful? Give feedback.
-
|
Seems like this announcement clears up strategy at least in the near term. |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Update: we will explore this but continue to use the tools listed
Hi! Is it possible to use Supabase offline at the moment? And have it automatically persist changes when an Internet connection is established?
Beta Was this translation helpful? Give feedback.
All reactions