All Projects β†’ obmarg β†’ Cynic

obmarg / Cynic

Licence: mpl-2.0
A bring your own types GraphQL client library for Rust

Programming Languages

rust
11053 projects
macros
77 projects

Projects that are alternatives of or similar to Cynic

Urql
The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
Stars: ✭ 6,604 (+9611.76%)
Mutual labels:  graphql, graphql-client
Fullstack Graphql
🌈 Simple Fullstack GraphQL Application. API built with Express + GraphQL + Sequelize (supports MySQL, Postgres, Sqlite and MSSQL). WebApp built with React + Redux to access the API. Written in ES6 using Babel + Webpack.
Stars: ✭ 955 (+1304.41%)
Mutual labels:  graphql, graphql-client
Gql
A GraphQL client in Python
Stars: ✭ 681 (+901.47%)
Mutual labels:  graphql, graphql-client
Pup
The Ultimate Boilerplate for Products.
Stars: ✭ 563 (+727.94%)
Mutual labels:  graphql, graphql-client
Android Okgraphql
Reactive GraphQl client for Android
Stars: ✭ 64 (-5.88%)
Mutual labels:  graphql, graphql-client
Apollo Fetch
🐢 Lightweight GraphQL client that supports middleware and afterware
Stars: ✭ 581 (+754.41%)
Mutual labels:  graphql, graphql-client
Kikstart Graphql Client
πŸš€ Small NodeJS Wrapper around apollo-client that provides easy access to running queries, mutations and subscriptions.
Stars: ✭ 27 (-60.29%)
Mutual labels:  graphql, graphql-client
Graphql Request
Minimal GraphQL client supporting Node and browsers for scripts or simple apps
Stars: ✭ 4,171 (+6033.82%)
Mutual labels:  graphql, graphql-client
Graphql Kotlin
Libraries for running GraphQL in Kotlin
Stars: ✭ 1,030 (+1414.71%)
Mutual labels:  graphql, graphql-client
Magiql
🌐 πŸ’« Simple and powerful GraphQL Client, love child of react-query ❀️ relay
Stars: ✭ 45 (-33.82%)
Mutual labels:  graphql, graphql-client
Example Storefront
Example Storefront is Reaction Commerce’s headless ecommerce storefront - Next.js, GraphQL, React. Built using Apollo Client and the commerce-focused React UI components provided in the Storefront Component Library (reactioncommerce/reaction-component-library). It connects with Reaction backend with the GraphQL API.
Stars: ✭ 471 (+592.65%)
Mutual labels:  graphql, graphql-client
Apollo Angular
A fully-featured, production ready caching GraphQL client for Angular and every GraphQL server 🎁
Stars: ✭ 1,058 (+1455.88%)
Mutual labels:  graphql, graphql-client
Villus
🏎 A tiny and fast GraphQL client for Vue.js
Stars: ✭ 378 (+455.88%)
Mutual labels:  graphql, graphql-client
Caliban
Functional GraphQL library for Scala
Stars: ✭ 581 (+754.41%)
Mutual labels:  graphql, graphql-client
Re Graph
A graphql client for clojurescript and clojure
Stars: ✭ 366 (+438.24%)
Mutual labels:  graphql, graphql-client
Aws Mobile Appsync Sdk Js
JavaScript library files for Offline, Sync, Sigv4. includes support for React Native
Stars: ✭ 806 (+1085.29%)
Mutual labels:  graphql, graphql-client
Altair
✨⚑️ A beautiful feature-rich GraphQL Client for all platforms.
Stars: ✭ 3,827 (+5527.94%)
Mutual labels:  graphql, graphql-client
Elm Graphql
A GraphQL library for Elm
Stars: ✭ 317 (+366.18%)
Mutual labels:  graphql, graphql-client
Graphql Client
A Ruby library for declaring, composing and executing GraphQL queries
Stars: ✭ 961 (+1313.24%)
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 (-27.94%)
Mutual labels:  graphql, graphql-client

Cynic

A bring your own types GraphQL client for Rust

Crate Info API Docs Discord Chat

Documentation | Examples | Changelog

Overview

Cynic is a GraphQL library for Rust. It's not the first but it takes a different approach from the existing libraries.

Existing libraries take a query first approach to GQL - you write a query using GraphQL and libraries use that to generate Rust structs for you using macros. This is really easy and great for getting going quickly. However, if you want to use structs that aren't quite what the macros output you're out of luck. Some more complex use cases like sharing structs among queries are also commonly not supported.

Cynic takes a different approach - it uses Rust structs to define queries and generates GraphQL from them. This gives you freedom to control the structs you'll be working with while still enjoying type safe queries, checked against the GraphQL schema. When it's built in derives don't do exactly what you want it provides lower level APIs to hook in and fetch the data you want in the format you want to work with it.

Of course writing out all the structs to represent a large GraphQL query can be quite challenging, and GraphQL has excellent tooling for building queries usually. Cynic provides querygen to help with this - you write a GraphQL query using the existing GQL tooling and it'll generate some cynic structs to make that query. You can use this as a starting point for your projects - either adding on to the rust structs directly, or re-using querygen as appropriate.

Features

Cynic is currently a work in progress, but the following features are supported:

  • Typesafe queries & mutations.
  • Defining custom scalars.
  • Building dynamic (but still type checked) queries at run time.
  • Query arguments including input objects
  • Interfaces & union types

The following features are not yet supported, though should be soon (if you want to help out with the project I'd be happy for someone else to try and implement these - if you open an issue I'd be happy to give pointers on how to go about implementing any of them)

  • Directives
  • GraphQL subscriptions.
  • Potentially other things (please open an issue if you find anything obviously missing)

Documentation

Cynic is documented in a few places:

  1. There's a guide to using cynic on cynic-rs.dev
  2. The reference documentation on docs.rs

Inspiration

  • graphql-client, the original Rust GraphQL client. This is a great library for using GraphQL from Rust. It wasn't quite what I wanted but it might be what you want.
  • The idea of encoding the GraphQL typesystem into a DSL was taken from elm-graphql.
  • Most of the JSON decoding APIs were taken from Json.Decode in Elm.
  • Deriving code from structs is a fairly common Rust pattern, though serde in particular provided inspiration for the derive APIs.
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].