|
I kind of disagree with OP about GraphQL adding too much complexity on the backend. Depending on what kind of queries you define, creating efficient resolvers that don't hit the database excessively can be complex, but in most cases I find GraphQL very easy to work with. I've used Django Rest Framework as well, and although I would agree there's a bit less overhead (though I'd argue not that much: you still should be defining serializers for models like you would be defining types in GraphQL, there are just a lot of nice little helper methods and conventions for DRF that make it a bit faster than setting up GraphQL with Django), one of the main selling points of GraphQL is the ability to use Apollo on the frontend. Because of Apollo's caching system, you don't really need to create any custom state management related to fetching and storing queries from the server. You might need state management for other purposes, and you'll still need to tell it to do things like update lists when deleting items/when a mutation might invalidate other cached query results, but it handles a lot right out of the box. The biggest headaches related to SPA state management I've run into before Apollo were always about fetching data efficiently and invalidating results from the server, which Apollo does really well. You don't need to worry about "am I fetching X somewhere else an extra time" or "did I remember to update Y in all the right places in the store when I fetched new data"; you can just declare the data you're component needs, and Apollo will either get it from the frontend cache, or if it can't find it there, the server. If your app was more about user input than ingesting information, I might recommend checking out pouchdb. I just started using it for an app that's almost entirely based on user input that I wanted to work during long stretches of being offline, and it's been working pretty well so far (although I don't feel I've done enough with it to really endorse it fully yet/I have yet to see how the project pans out). But since it sounds like your app is mostly about displaying information coming from the server to your users, and you want to avoid hitting the wire for data as much as possible, I think a combination of React Native and Apollo is probably a good fit. I'm sure there are other solutions, but it's the one I'm most comfortable with/what I'd probably jump to in your situation. |