Using Supabase offline #357
Replies: 78 comments 155 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. |
|
Use case Ideal solution Considering alternatives (Merged from #448 ) |
|
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. |
|
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. |
|
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. |
|
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). |
|
If the graphql had all the features of hasura (and more), I think this would be a moot issue. J |
|
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 |
|
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. |
|
Raising hand in support 🙋♂️ |
|
+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. |
|
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 🙁. |
|
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. |
|
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 |
|
Anyone got experience if urql's offline support is good enough? https://formidable.com/open-source/urql/docs/graphcache/offline/ |
|
We are still looking for this features. |
|
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. |
|
@hamishjohnson may you kindly share those third party you are referring to? |
|
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/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 |
|
i came across https://pub.dev/packages/hydrated_bloc as another potential solution for flutter apps |
|
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. |
|
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. |
|
I think at least @dventimisupabase owes us an explanation for us to make informed decision. |
|
Seems like this announcement clears up strategy at least in the near term. |
|
hola buenas noches ,soy estudiante aun nose si alguien sabre como se puede hacer una app movil offline y a la vez que los datos que se guarden se puedan mostrar en un app web en tiempo real en cuanto la app movil se conecte a internet ,he tratado de buscar informacion pero no encuentro. |
|
lets be honest, this has been a 6-year disaster in the making.. |
|
Hi all, SQLite AI founder here. On the client side, you have SQLite, and everything syncs via CRDT with PostgreSQL and Supabase (no SQLite Cloud nodes are needed). You can learn more at https://github.com/sqliteai/sqlite-sync |
|
SQLite-Sync documentation for Supabase and PostgreSQL is the following: |
|
Hi everyone, I'm Marco, founder of SQLite AI. We've been working on SQLite-Sync, which lets applications use SQLite locally, including fully offline, and automatically synchronize changes with PostgreSQL when connectivity is available. Since offline support has been such a frequently requested feature in the Supabase community, we'd love to work directly with some of you who are actually building offline-first applications. We're offering 10 CloudSync Pro plans completely free for one year to the first 10 Supabase developers willing to test SQLite-Sync with: SQLite on the client/edge ↔ self-hosted Supabase/Postgres in the cloud. What we're looking for is not just users, we'd really value feedback about your use case, what works, what doesn't, and what we could improve to make SQLite + Supabase a great offline-first stack. If you'd like to participate:
We'll activate a free one-year Pro plan for the first 10 relevant projects. Happy to answer any technical questions here as well. |

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?
All reactions