All Projects → FormidableLabs → Reason Urql

FormidableLabs / Reason Urql

Licence: mit
Reason bindings for Formidable's Universal React Query Library, urql.

Programming Languages

bucklescript
41 projects

Projects that are alternatives of or similar to Reason Urql

Qlens
QLens is an electron app which dynamically generates GraphQL Schemas and Mongo Schema visualization. QLens significantly cuts development time by automating the formation of their GraphQL schemas based on information fetched from their non-relational database.
Stars: ✭ 110 (-45.81%)
Mutual labels:  graphql, graphql-client
Python Graphql Client
Simple GraphQL client for Python 2.7+
Stars: ✭ 133 (-34.48%)
Mutual labels:  graphql, graphql-client
Graphql Hooks
🎣 Minimal hooks-first GraphQL client
Stars: ✭ 1,610 (+693.1%)
Mutual labels:  graphql, graphql-client
Angular1 Apollo
AngularJS integration for the Apollo Client
Stars: ✭ 108 (-46.8%)
Mutual labels:  graphql, graphql-client
Gqlify
[NOT MAINTAINED]An API integration framework using GraphQL
Stars: ✭ 182 (-10.34%)
Mutual labels:  graphql, graphql-client
Gest
👨‍💻 A sensible GraphQL testing tool - test your GraphQL schema locally and in the cloud
Stars: ✭ 109 (-46.31%)
Mutual labels:  graphql, graphql-client
Client Side Graphql
Stars: ✭ 119 (-41.38%)
Mutual labels:  graphql, graphql-client
Locksmith
Want to use GraphQL with Clojure/script but don't want keBab or snake_keys everywhere? Use locksmith to change all the keys!
Stars: ✭ 59 (-70.94%)
Mutual labels:  graphql, graphql-client
Modelizr
Generate GraphQL queries from models that can be mocked and normalized.
Stars: ✭ 175 (-13.79%)
Mutual labels:  graphql, graphql-client
Reason Apollo Hooks
Deprecated in favor of https://github.com/reasonml-community/graphql-ppx
Stars: ✭ 140 (-31.03%)
Mutual labels:  graphql, reasonml
Nuxt Graphql Request
Easy Minimal GraphQL client integration with Nuxt.js.
Stars: ✭ 85 (-58.13%)
Mutual labels:  graphql, graphql-client
Graphql Ppx
GraphQL language primitives for ReScript/ReasonML written in ReasonML
Stars: ✭ 185 (-8.87%)
Mutual labels:  graphql, reasonml
Cynic
A bring your own types GraphQL client library for Rust
Stars: ✭ 68 (-66.5%)
Mutual labels:  graphql, graphql-client
Apollo Link
🔗 Interface for fetching and modifying control flow of GraphQL requests
Stars: ✭ 1,434 (+606.4%)
Mutual labels:  graphql, graphql-client
Android Okgraphql
Reactive GraphQl client for Android
Stars: ✭ 64 (-68.47%)
Mutual labels:  graphql, graphql-client
Graphql Stack
A visual explanation of how the various tools in the GraphQL ecosystem fit together.
Stars: ✭ 117 (-42.36%)
Mutual labels:  graphql, graphql-client
Graphql Query Test Mock
Easily mock GraphQL queries in your Relay Modern / Apollo / any-other-GraphQL-client tests.
Stars: ✭ 49 (-75.86%)
Mutual labels:  graphql, graphql-client
Apollo Angular
A fully-featured, production ready caching GraphQL client for Angular and every GraphQL server 🎁
Stars: ✭ 1,058 (+421.18%)
Mutual labels:  graphql, graphql-client
Reason Graphql
GraphQL server in pure Reason (Bucklescript)
Stars: ✭ 137 (-32.51%)
Mutual labels:  graphql, reasonml
Hotchocolate
Welcome to the home of the Hot Chocolate GraphQL server for .NET, the Strawberry Shake GraphQL client for .NET and Banana Cake Pop the awesome Monaco based GraphQL IDE.
Stars: ✭ 3,009 (+1382.27%)
Mutual labels:  graphql, graphql-client

reason-urql

npm All Contributors Build Status Maintenance Status

Reason bindings for Formidable's Universal React Query Library, urql.

✨Features

  • ⚛️ A fully featured GraphQL client for ReasonReact.
  • ✅ Compile time type and schema validation.
  • ⚙️ Customizable behavior via exchanges.
  • 🎣 Support for useQuery, useMutation, useSubscription, and useClient hooks!
  • ⚡ Support for server-side rendering with Next.js.

reason-urql is a GraphQL client for ReasonReact, allowing you to hook up your ReasonReact components to queries, mutations, and subscriptions. It provides bindings to urql that allow you to use the API in Reason, with the benefits of a sound type system, blazing fast compilation, and opportunities for guided customization.

📋 Documentation

💾 Installation

1. Install reason-urql alongside its peerDependencies and devDependencies.

yarn add reason-urql urql graphql
yarn add gentype --dev

We try to keep our bindings as close to latest urql as possible. However, urql tends to make releases a bit ahead of reason-urql. To get a compatible version, we recommend always staying strictly within this project's peerDependency range for urql.

The gentype devDependency is a requirement introduced by urql's use of wonka. wonka's source uses @genType declarations, so when the BuckleScript / ReScript compiler attempts to compile wonka in your project, it'll need a local copy of gentype to use.

1a. Important note for users of bs-platform>=8.0.0.

If using bs-platform>=8.0.0 you'll need to use yarn resolutions to specify a specific version of wonka to resolve. urql has an explicit dependency on latest wonka v4, which is incompatible with bs-platform>=8.0.0. See this issue for more details.

In your package.json, add the following:

"resolutions": {
  "wonka": "5.0.0-rc.1"
}

If you're using npm, you may need to stay on [email protected] until urql takes a dependency on wonka>=5.0.0.

2. Add @reasonml-community/graphql-ppx.

To get the most out of compile time type checks for your GraphQL queries, mutations, and subscriptions, we use @reasonml-community/graphql-ppx. Add this to your project's devDependencies.

yarn add @reasonml-community/graphql-ppx --dev

3. Update bsconfig.json.

Add reason-urql, wonka, and @reasonml-community/graphql-ppx to your bs-dependencies and @reasonml-community/graphql-ppx/ppx to your ppx_flags in bsconfig.json.

{
  "bs-dependencies": [
    "reason-urql",
    "wonka",
    "@reasonml-community/graphql-ppx"
  ],
  "ppx-flags": ["@reasonml-community/graphql-ppx/ppx"]
}

4. Send an introspection query to your API.

Finally, you'll need to send an introspection query to your GraphQl API, using a tool like graphql-cli. You should generate a file called graphql_schema.json at the root of your project that graphql-ppx can use to type check your queries. You should check this file into version control and keep it updated as your API changes.

For additional help, head here.

npx get-graphql-schema ENDPOINT_URL -j > graphql_schema.json

Simply re-run this script at anytime to regenerate the graphql_schema.json file according to your latest backend schema.

💻 Example Projects

reason-urql has a nice set of examples showing how to use the hooks and client APIs to get the most out of GraphQL and Reason in your app – check them out in the /examples folder. To run any of the examples, follow these steps.

# 1. Navigate into the example of choice.
cd examples/1-execute-query-mutation

# 2. Install dependencies.
yarn

# 3. In one terminal, compile the source in watch mode.
yarn start

# 4. In another terminal, start the demo app server.
yarn start:demo

The example will start up at http://localhost:3000. Edit the example freely to watch changes take effect.

Editing reason-urql source files

If developing on the main reason-urql source files (i.e. anything in /src/) and you want to test the changes in one of the examples, you'll need to do the following:

# Save your changes to source, then take the following steps.

# 1. Clean any artifacts from previous builds.
yarn clean

# 2. Rebuild the source.
yarn build

# 3. Clean example build and reinstall dependencies.
cd examples/2-query
yarn clean
yarn

Since we are linking the examples' dependency on reason-urql to the src directory, it's important to clean builds between changes to prevent any stale or erroneous artifacts.

Getting Involved

Please help out by opening an issue or filing a PR.

Contributors

This project follows the all contributors spec. Thanks to these wonderful folks for contributing (Emoji Key):


Parker Ziegler

💻 📖 👀 🤔

Khoa Nguyen

💻 📖

Phil Plückthun

🤔

Kara Stubbs

💻 ⚠️ 💡

Marcos Felipe Pimenta Rodrigues

📖

Gustavo Aguiar

💻 💡

Avery Morin

🤔 💻 💡 📖

Alain Armand

💻 💡

Robin Weser

📖

Cem Turan

📖

Huy Nguyen

📖

Sean Grove

💻 💡 🤔 📖

Tomasz Cichocinski

💻 🐛

Jovi De Croock

💻

Corentin Leruth

📖 💻

Joel Jeddeloh

💻

hui.liu

📖

Kévin Combriat

💻 🐛 🤔

Amirali Esmaeili

💻 💡

Alexander Varwijk

💻

Maintenance Status

Experimental: This project is quite new. We're not sure what our ongoing maintenance plan for this project will be. Bug reports, feature requests and pull requests are welcome. If you like this project, let us know!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].