#✅ - Local-first with sync engine using Amplify Gen2

8 messages · Page 1 of 1 (latest)

keen marsh
#

Hi, I know that DataStore is not supported by Gen2, but I've been wondering if someone using Gen2 created any local-first app with it, and what was the solution taken.

I've been trying out DataStore to check viability of using in a production app, but the experience so far has been that anything that goes beyond a "simple" usage, it gets complicated quickly and with little support for it. I've been debating myself if I should use Amplify Gen2 to take advantage of the easy to use GraphQL API and subscriptions but use an open source local database for syncing, like SQLite + Drizzle, TinyDB, etc.

If anyone has gone through this route and could share their findings, that would be awesome.

ashen citrus
#

cc @gloomy sail

gloomy sail
#

Hey @keen marsh are you building either a React or React Native app?

If so, check this out!

https://github.com/chrisbonifacio/Gen2Offline

we’re working on providing guidance on how to implement DataStore-like features using an alternative tool like TanStack Query in that sample app.

GitHub

This repo shows how to add Gen 2 with React Query. Contribute to chrisbonifacio/Gen2Offline development by creating an account on GitHub.

valid islandBOT
#

✅ - Local-first with sync engine using Amplify Gen2

valid islandBOT
# gloomy sail Hey <@281020665144934400> are you building either a React or React Native app? ...

Answer selected!


If so, check this out!

https://github.com/chrisbonifacio/Gen2Offline

we’re working on providing guidance on how to implement DataStore-like features using an alternative tool like TanStack Query in that sample app.```
Kudos to @gloomy sail!
[#1346934841308090469 message](/guild/705853757799399426/thread/1346934841308090469/p/1346934841308090469/#msg-1347348901199482901)
heady pagoda
#

I see, that's a simple use case as the storage system used is localStorage, which might not work well with a lot of data. But thanks for sharing, it confirm some of my ideas on what would need to done.

If anyone else has used some more complex local storage solution like SQLite or another performant one, I would still be glad to hear how was it.

I have some idea os what will need to be done, but there's always more things that will come up while actually doing, and that's what I'm trying to anticipate.

#

(I'm the author of the post, just using a different account haha)

gloomy sail
#

DataStore used IndexedDB for js/web and SQLite for react native/mobile.

you can implement your own persister as well, and there is a IDB example in the doc:

https://tanstack.com/query/latest/docs/framework/react/plugins/persistQueryClient#building-a-persister

This is set of utilities for interacting with "persisters" which save your queryClient for later use. Different persisters can be used to store your client and cache to many different storage layers....