{"id":13822491,"url":"https://github.com/obmarg/cynic","last_synced_at":"2025-05-14T06:11:28.447Z","repository":{"id":37964040,"uuid":"231977974","full_name":"obmarg/cynic","owner":"obmarg","description":"A bring your own types GraphQL client library for Rust","archived":false,"fork":false,"pushed_at":"2025-04-10T06:33:49.000Z","size":5562,"stargazers_count":405,"open_issues_count":80,"forks_count":50,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-10T07:38:54.383Z","etag":null,"topics":["gql","graphql","graphql-client","graphql-library","graphql-query","macros","rust"],"latest_commit_sha":null,"homepage":"https://cynic-rs.dev","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/obmarg.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-05T21:25:38.000Z","updated_at":"2025-04-10T05:08:24.000Z","dependencies_parsed_at":"2023-10-01T15:00:02.262Z","dependency_job_id":"86d50f2a-49d5-4377-945f-558b1e380757","html_url":"https://github.com/obmarg/cynic","commit_stats":{"total_commits":914,"total_committers":35,"mean_commits":"26.114285714285714","dds":"0.21115973741794314","last_synced_commit":"61cae069a8328d0a33d35792fa6f981e95bdae5b"},"previous_names":[],"tags_count":103,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obmarg%2Fcynic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obmarg%2Fcynic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obmarg%2Fcynic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obmarg%2Fcynic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/obmarg","download_url":"https://codeload.github.com/obmarg/cynic/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248181030,"owners_count":21060883,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gql","graphql","graphql-client","graphql-library","graphql-query","macros","rust"],"created_at":"2024-08-04T08:02:02.532Z","updated_at":"2025-04-10T23:24:56.699Z","avatar_url":"https://github.com/obmarg.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/obmarg/cynic/raw/main/logo.png\" width=\"150\"/\u003e\n  \u003ch1\u003eCynic\u003c/h1\u003e\n\n  \u003cp\u003e\n    \u003cstrong\u003eA bring your own types GraphQL client for Rust\u003c/strong\u003e\n  \u003c/p\u003e\n\n  \u003cp\u003e\n    \u003ca href=\"https://crates.io/crates/cynic\"\u003e\u003cimg alt=\"Crate Info\" src=\"https://img.shields.io/crates/v/cynic.svg\"/\u003e\u003c/a\u003e\n    \u003ca href=\"https://docs.rs/cynic/\"\u003e\u003cimg alt=\"API Docs\" src=\"https://img.shields.io/badge/docs.rs-cynic-green\"/\u003e\u003c/a\u003e\n    \u003ca href=\"https://discord.gg/Y5xDmDP\"\u003e\u003cimg alt=\"Discord Chat\" src=\"https://img.shields.io/discord/754633560933269544\"/\u003e\u003c/a\u003e\n  \u003c/p\u003e\n\n  \u003ch4\u003e\n    \u003ca href=\"https://cynic-rs.dev\"\u003eDocumentation\u003c/a\u003e\n    \u003cspan\u003e | \u003c/span\u003e\n    \u003ca href=\"https://github.com/obmarg/cynic/tree/main/examples/examples\"\u003eExamples\u003c/a\u003e\n    \u003cspan\u003e | \u003c/span\u003e\n    \u003ca href=\"https://github.com/obmarg/cynic/blob/main/CHANGELOG.md\"\u003eChangelog\u003c/a\u003e\n  \u003c/h4\u003e\n\u003c/div\u003e\n\n# Overview\n\nCynic is a GraphQL library for Rust. It's not the first but it takes a\ndifferent approach from the existing libraries.\n\nExisting libraries take a query first approach to GQL - you write a query using\nGraphQL and libraries use that to generate Rust structs for you using macros.\nThis is really easy and great for getting going quickly. However, if you want\nto use structs that aren't quite what the macros output you're out of luck.\nSome more complex use cases like sharing structs among queries are also\ncommonly not supported.\n\nCynic takes a different approach - it uses Rust structs to define queries and\ngenerates GraphQL from them. This gives you freedom to control the structs\nyou'll be working with while still enjoying type safe queries, checked against\nthe GraphQL schema. When its built in `derives` don't do exactly what you\nwant it provides lower level APIs to hook in and fetch the data you want in the\nformat you want to work with it.\n\nOf course writing out all the structs to represent a large GraphQL query can be\nquite challenging, and GraphQL has excellent tooling for building queries\nusually. Cynic provides [`querygen`][1] to help with this - you write a\nGraphQL query using the existing GQL tooling and it'll generate some cynic\nstructs to make that query. You can use this as a starting point for your\nprojects - either adding on to the rust structs directly, or re-using\n`querygen` as appropriate.\n\n### Features\n\nCynic is currently a work in progress, but the following features are\nsupported:\n\n- Typesafe queries \u0026 mutations.\n- Defining custom scalars.\n- Building dynamic (but still type checked) queries at run time.\n- Query arguments including input objects\n- Interfaces \u0026 union types\n- Introspection via [`cynic-cli`][6] or [`cynic-introspection`][7]\n- GraphQL Subscriptions via [`graphql-ws-client`][8].\n- Field directives (`@skip`, `@include` and any custom directives that don't\n  require client support)\n\n### Documentation\n\nCynic is documented in a few places:\n\n1. There's a guide to using cynic on [cynic-rs.dev](https://cynic-rs.dev)\n2. The reference documentation on [docs.rs](https://docs.rs/cynic)\n\n### Inspiration\n\n- [graphql-client][2], the original Rust GraphQL client. This is a great\n  library for using GraphQL from Rust. It wasn't quite what I wanted but it\n  might be what you want.\n- The idea of encoding the GraphQL typesystem into a DSL was taken from\n  [elm-graphql][3].\n- Most of the JSON decoding APIs were taken from [Json.Decode in Elm][4].\n- Deriving code from structs is a fairly common Rust pattern, though [serde][5]\n  in particular provided inspiration for the derive APIs.\n\n[1]: https://generator.cynic-rs.dev\n[2]: https://github.com/graphql-rust/graphql-client\n[3]: https://github.com/dillonkearns/elm-graphql\n[4]: https://package.elm-lang.org/packages/elm/json/latest/Json.Decode\n[5]: https://serde.rs\n[6]: https://crates.io/crates/cynic-cli\n[7]: https://crates.io/crates/cynic-introspection\n[8]: https://github.com/obmarg/graphql-ws-client\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobmarg%2Fcynic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fobmarg%2Fcynic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobmarg%2Fcynic/lists"}