You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a native app which works well with Realm DB. I use the realm DB as "fallback" when no network connection is available.
I've started rewriting the app with react-native. I wondered how could I achieve something similar with Relay, GraphQL and React-Native. I'm to use something an alternative for the local DB like lokijs.
Do I need to write a local GraphQL server on the device which connect to Realm?
I'm really not sure how to make this work and which architecture to go for, thank you in advance.
The text was updated successfully, but these errors were encountered:
Think of GraphQL as a "wrapper" for your database (e.g. Realm). In order to store GraphQL data, you'll need some kind of persistence layer for it. So yes, you'll need a GraphQL server.
Relay doesn't really have a "solution" for doing things like local storage. You could implement your own network layer that switches between a remote and local GraphQL server, if that works for you - maybe Realm can do something to help sync those systems back together, I'm not sure? But you'll need to also put a GraphQL server in front of the local Realm db - see graphql-js for that.
TL;DR: yes, you could probably do this, and you'll need a GraphQL server. No, it's not going to be easy. If you really want Realm and offline persistence, I'd probably recommend using something other than Relay for the data - I don't see these two paradigms playing super well together...
Right now you can do pretty much anything via a network layer, but depending on the complexity of your integration it may be a non-trivial amount of work.
We've extensively discussed making it easier to use Relay for this use case, but we're not actively working on it right now. We are, however, taking steps towards making Relay more modular (splitting the low-level core from the high-level React integration); this will make building arbitrary integrations more straightforward. We're definitely open to facilitating community contributions on these fronts if you are interested in helping out.
See #114 and #559 for more context on local data and the core split, respectively.
I have a native app which works well with Realm DB. I use the realm DB as "fallback" when no network connection is available.
I've started rewriting the app with react-native. I wondered how could I achieve something similar with Relay, GraphQL and React-Native. I'm to use something an alternative for the local DB like lokijs.
Do I need to write a local GraphQL server on the device which connect to Realm?
I'm really not sure how to make this work and which architecture to go for, thank you in advance.
The text was updated successfully, but these errors were encountered: