I tried using this, and while it did work out the result was less stellar than expected.
mobx-depot
could definitely be improved in order to be feasible. I have a few ideas on this,
however my team is not considering GraphQL for our own application stack for the future. If there is any interest in the project,
I would love to work on it and perhaps implement those changes.
Scaffold MobX-powered models, queries and mutations with your GraphQL schema.
- Strictly-typed
Model
,Query
andMutation
classes auto-generated via introspection - A
RootStore
to reconcile data from your API, preserving existing instances along the way - A place to add your own logic to models that won't get overwritten by code generation
- Reactivity powered by MobX
- A UI framework-agnostic solution, though first-class support for React is provided via hooks
- Apollo client
mst-gql
- ...
Depending on the structure of your schema, you could also consider local state management as a target. You could theoretically generate models using a schema without needing to interact with an external API at all.
- Redux
- Zustand
- The other 10,000+ libraries out there
Until this library is published on NPM with version >=0.1.0
, expect trouble. There are many "pre-release" issues
that still need to be tackled and tests to be written before I recommend usage. That being said, mobx-depot
may "just work" for you.
If you do run into any bugs, please create an issue!
If you're interested in contributing, hit me up on Twitter. I won't have any formal guidelines for contributing until after the first release, as I want to ensure my vision for the library is clear before I start accepting PRs. Though I'm totally up to review some PRs for bug fixes!
As is common in early development, there are limitations that will be addressed in the future:
- Only TypeScript supported
- GraphQL Subscriptions are not supported
Looking for the docs? View documentation