GraphQL Awesome
- WebUI
- graphql/graphiqlGitHubgraphql/graphiqlgraphql/graphiql · Explorer · Demo · adopted by · Hasura · Gitlab GraphQL Explorer · GitHub GraphQL Explorer · https://github.com/graphql/graphiql/blob/main/examples/graphiql-cd...笔记:GraphiQL
graphql/graphql-playgroundGitHubgraphql/graphql-playground- graphql-kit/graphql-voyagerGitHubgraphql-kit/graphql-voyager
- interactive graph
- graphql-editor/graphql-editorGitHubgraphql-editor/graphql-editor
- Visual Editor & GraphQL IDE.
- Codegen
- dotansimha/graphql-code-generatorGitHubdotansimha/graphql-code-generatordotansimha/graphql-code-generator 是什么? · 基于 GraphQL 的代码生成工具 · 支持的前端框架 urql, apollo, react-query, react, vue, svelte · 支持的后端 Java Resolver, Kotlin, Java, Java Apollo Android笔记:graphql-code-generator
- 基于 GraphQL 生成各种客户端服务端代码
- 对 TypeScript 支持非常好
- anvilco/spectaqlGitHubanvilco/spectaql
- 文档生成
- glideapps/quicktypeGitHubglideapps/quicktype
- types and converters from JSON, Schema, and GraphQL
- graphql-editor/graphql-zeusGitHubgraphql-editor/graphql-zeus
- dotansimha/graphql-code-generatorGitHubdotansimha/graphql-code-generatordotansimha/graphql-code-generator 是什么? · 基于 GraphQL 的代码生成工具 · 支持的前端框架 urql, apollo, react-query, react, vue, svelte · 支持的后端 Java Resolver, Kotlin, Java, Java Apollo Android笔记:graphql-code-generator
- jensneuse/graphql-go-toolsGitHubjensneuse/graphql-go-tools
- 实现了 federation
- 可用于实现 graphql 服务应用
- B2o5T/graphql-eslintGitHubB2o5T/graphql-eslint
- GraphQL 语法检查
学习
- spec.graphql.org/October2021
- TAO: The power of the graph
- howtographqlGitHubhowtographql/howtographql
决策
- Code first or GraphQL Schema first
- Code - Code to Schema
- 可读性好,但是需要手动维护,可以复用现有代码
- Schema - Schema to Code
- 生成很多代码,可读性交较差,但是可以快速搭建原型
- Code - Code to Schema
- 动态Schema vs 静态Schema
- 动态
- 可以根据租户自定义 - 类似动态 CMS
- 可以根据角色自定义 - conditional schema
- 静态
- 可以手写
- 可以一次性生成
- 动态
- DB Schema first or Entity first
- DB Schema
- 更好的掌控数据库结构
- 更好的利用数据库特性
- Entity
- 可能考虑支持多数据库
- DB Schema
- Prototype 阶段 还是 Production 阶段
- Prototype
- DB -> GraphQL - 只是做简单的接口封装
- Production
- 要求 DB 设计合理
- DB Schema first
- 预留扩展
- Prototype
- 是否需要 类型安全
- 影响怎么做 schema builder
- 什么程度的 类型安全
- 全局
- 输入输出校验
- 一定程度增加 维护
- 一定程度增加 写代码 的难度
- 是否需要 subscriptions
- 要求感知 修改
- 是否需要 federation/gateway
- 是否需要 dataloader
- 是否需要 relay
- Node, Connection, clientMutationId
设计
- GraphQL 最佳实践
- 通过 HTTP 提供服务
- JSON+Gzip 返回
- 对接口进行版本控制 - 利用 deprecated 和 额外字段能
- 字段默认 null - 利用 非 null 设计更好的接口
- 分页使用 Connection - 通过 first, last, before, after 实现基于 cursor 分页
- 服务端批处理和缓存 - 避免 N+1 问题 - 利用 graphql/dataloaderGitHubgraphql/dataloader 处理
- Principled GraphQL
- One Graph
- Federated Implementation
- Track the Schema in a Registry
- Abstract, Demand-Oriented Schema
- Use an Agile Approach to Schema Development
- Iteratively Improve Performance
- Use Graph Metadata to Empower Developers
- Access and Demand Control
- Structured Logging
- Separate the GraphQL Layer from the Service Layer
- Gitlab GraphQL API 规范文档
Gateway
- apollo gateway
- 配合 Apollo Studio 体验会很好 - 但是一般不会使用 Apollo Studio
- federation 功能强
- 但推荐使用预先生成的 schema
- 逻辑相对复杂
- movio/brambleGitHubmovio/bramblemovio/bramble · MIT, Golang · GraphQL Gateway · 包含简单的 AdminUI · 暂不支持 subscription笔记:bramble
- Golang
- 比 apollo 简单但功能更弱
- 基于 service 合成 - 支持部分简单 directive
- 不支持 subscriptions
- Introducing Bramble: A Federated GraphQL Gateway Implemented In Go
- nautilus/gatewayGitHubnautilus/gateway
- MIT, Golang
- Introspect schema,自动合并 - 不需要 directive
- 不支持 subscriptions
- A Guide to GraphQL Schema Federation, Part 1
Library
- Golang
- graphql-go/graphqlGitHubgraphql-go/graphqlgraphql-go/graphql 是什么? · Golang GraphQL 解析、执行库 · Code First - 先 Go 代码,然后生成 GraphQL · 通过 struct 构建内容生成 graphql schema · 通过 struct 构建 resolver 和类型字段处理笔记:graphql
- 类似 graphql-js 接口
- 99designs/gqlgenGitHub99designs/gqlgen99designs/gqlgen 是什么? · 基于生成的 GraphQL 引擎 · Schema first - 需要 DSL 定义 GraphQL Schema · 类型安全 · 支持 Plugin - 修改配置, 生成代码 · 缺点 · 库代码质量一般笔记:gqlgen
- Golang, GraphQL Schema 生成 Resolver
- graph-gophers/graphql-goGitHubgraph-gophers/graphql-go
- 基于反射自动绑定
- graph-gophers/dataloaderGitHubgraph-gophers/dataloader
- Khan/genqlientGitHubKhan/genqlient
- type-safe Go GraphQL client
- graphql-go/graphqlGitHubgraphql-go/graphqlgraphql-go/graphql 是什么? · Golang GraphQL 解析、执行库 · Code First - 先 Go 代码,然后生成 GraphQL · 通过 struct 构建内容生成 graphql schema · 通过 struct 构建 resolver 和类型字段处理笔记:graphql
- Typescript
- SQL/GraphQL
- supabase/pg_graphqlGitHubsupabase/pg_graphql
- dosco/graphjinGitHubdosco/graphjin
- GraphQL to SQL compiler
- Java/JVM/Kotlin
- Netflix/dgs-frameworkGitHubNetflix/dgs-framework
- Spring Boot
- graphql-java/graphql-javaGitHubgraphql-java/graphql-java
- MIT, Java
- graphql-java-kickstart/graphql-spring-bootGitHubgraphql-java-kickstart/graphql-spring-boot
- MIT, Java
- spring-projects/spring-graphqlGitHubspring-projects/spring-graphql
- Apache-2.0, Java
- babyfish-ct/jimmerGitHubbabyfish-ct/jimmer
- ORM with GraphQL
- ExpediaGroup/graphql-kotlinGitHubExpediaGroup/graphql-kotlin
- Apache-2.0, Kotlin
- smallrye/smallrye-graphqlGitHubsmallrye/smallrye-graphql
- Implementation for MicroProfile GraphQL
- quarkus & smallrye
- Netflix/dgs-frameworkGitHubNetflix/dgs-framework
- Schema
- ardatan/graphql-toolsGitHubardatan/graphql-toolsardatan/graphql-tools · MIT, TS · npm: @graphql-tools/merge, @graphql-tools/schema笔记:graphql-tools
- @graphql-tools/schema
- sikanhe/gqtxGitHubsikanhe/gqtx
- graphql-modules笔记graphql-moduleshttps://github.com/Urigo/graphql-modules · 服务端 resolver 模块化 · NodeJS · https://the-guild.dev/graphql/modules/docs打开:/notes/service/api/graphql/modules
- graphql
- GraphQLSchema
- ardatan/graphql-toolsGitHubardatan/graphql-toolsardatan/graphql-tools · MIT, TS · npm: @graphql-tools/merge, @graphql-tools/schema笔记:graphql-tools
- Schema/TypeScript Code First
- MichalLytek/type-graphql笔记TypeGraphQLMichalLytek/type-graphql · MIT, Typescript · 注解/修饰器 方式 · 文件上传 #37 · relay · 需要自己实现 · https://github.com/calmonr/typegraphql-relay打开:/notes/service/api/graphql/type-graphql
- MIT, Typescript
- 注解/修饰器 方式
- hayes/pothos笔记pothoshayes/pothos · ISC, TS · GQL Type Safe Schema Builder · https://pothos-graphql.dev/docs/guide/app-layout · https://github.com/hayes/pothos/blob/main/examples/complex-app/src/bui...打开:/notes/service/api/graphql/pothos
- ISC, Typescript
- @pothos/core
- 强类型,类似 zod 方式构建 schema
- infer 推导类型
- ⚠️ 写起来有些繁琐
- graphql-nexus/nexusGitHubgraphql-nexus/nexus
- MIT, Typescript
- nexus
- ⚠️ 开发不活跃
- 通过代码生成,确保类型
- MichalLytek/type-graphql笔记TypeGraphQLMichalLytek/type-graphql · MIT, Typescript · 注解/修饰器 方式 · 文件上传 #37 · relay · 需要自己实现 · https://github.com/calmonr/typegraphql-relay打开:/notes/service/api/graphql/type-graphql
- IvanGoncharov/graphql-fakerGitHubIvanGoncharov/graphql-faker
- mock graphql
Server
Server, Federation, Gateway, Adapter
- NodeJS
- graphql-yoga笔记graphql-yogadotansimha/graphql-yoga · MIT, Typescript · 支持 NodeJS, Bun, Deno, Cloudflare Worker · 支持 Next.js, SvelteKit, uWebSockets, Fastify, NestJS打开:/notes/service/api/graphql/yoga
- 👍 适合各种场景,支持不同的 schema 构建方式
- 简单轻量
- [apollographql/apollo-server]
- graphile/postgraphileGitHubgraphile/postgraphile
- PostgreSQL -> GraphQL
- zalando-incubator/graphql-jitGitHubzalando-incubator/graphql-jit
- 优化 graphql 执行
- graphql-yoga笔记graphql-yogadotansimha/graphql-yoga · MIT, Typescript · 支持 NodeJS, Bun, Deno, Cloudflare Worker · 支持 Next.js, SvelteKit, uWebSockets, Fastify, NestJS打开:/notes/service/api/graphql/yoga
- Golang
- movio/brambleGitHubmovio/bramblemovio/bramble · MIT, Golang · GraphQL Gateway · 包含简单的 AdminUI · 暂不支持 subscription笔记:bramble
- 受 nautilus 启发
- nautilus/gatewayGitHubnautilus/gateway
- 开发不活跃
- urigo/graphql-meshGitHuburigo/graphql-mesh
- GraphQL Adapter
- 后端支持 GraphQL, JSON Schema, gRPC, Swagger, OpenAPI, SOAP, Postgres, Mongo, OData, Thrift, SQLite, MySQL, Neo4j
- REST,DB,RPC 映射为 GraphQL
- 收集 API 接口规范、生成 SDK、生成 GraphQL Schema、生成接口映射
- movio/brambleGitHubmovio/bramblemovio/bramble · MIT, Golang · GraphQL Gateway · 包含简单的 AdminUI · 暂不支持 subscription笔记:bramble
- google/rejoinerGitHubgoogle/rejoiner
- Generates a unified GraphQL schema from gRPC microservices and other Protobuf sources
- ent/entGitHubent/entent/ent 是什么? · 项目源自 facebook, 加入 LF · 支持 RESTful 接口 · 基于代码生成的 ORM · 支持 MySQL, MariaDB, PostgreSQL, SQLite, Gremlin · 创建和更新使用 setter/getter笔记:entgo
- Apollo Federation specificationLinkwww.apollographql.com/docs/federation/federation-specApollo Federation 定义了如何联合多个 GraphQL 服务的规则 · 使用 Federation 需要 GraphQL 服务支持,还需要运行额外的 Gateway · 参考 · 支持的库 · Apollo Federation specification笔记:Apollo Federation
- hasura/graphql-engineGitHubhasura/graphql-enginehasura/graphql-engine · Apache-2.0, MIT, Haskell · Working with schemaless data using GraphQL on Postgres · 配置 · / - 匿名角色笔记:Hasura
- dosco/graphjinGitHubdosco/graphjin
- Apache-2.0, Go
- parse-community/parse-serverGitHubparse-community/parse-server
- dgraph-io/dgraphGitHubdgraph-io/dgraph
- directus/directusGitHubdirectus/directusdirectus/directus 是什么? · GPL-3.0, NodeJS+Typescript+Vue · Headless CMS · Knex · DB -> GraphQL+REST · 数据库支持 PostgreSQL, MySQL, SQLite, OracleDB, CockroachDB, MariaDB, MS-SQL笔记:Directus
- reactioncommerce/reactionGitHubreactioncommerce/reaction
- spree/spreeGitHubspree/spree
- redwoodjs/redwoodGitHubredwoodjs/redwood
- VulcanJS/VulcanGitHubVulcanJS/Vulcan
- api-platform/api-platformGitHubapi-platform/api-platform
- semi-technologies/weaviateGitHubsemi-technologies/weaviate
- daptin/daptinGitHubdaptin/daptin
- Backend As A Service
- dosco/graphjinGitHubdosco/graphjin
- keystonejs/keystoneGitHubkeystonejs/keystonekeystonejs/keystone · MIT, TS · apollo, prisma, React, s3, @hapi/iron, express · 数据库 PostgreSQL、MySQL、SQLite · 生成项目,能植入自定义组件和代码笔记:keystone
DevTools
- GraphiQL笔记GraphiQLgraphql/graphiql · Explorer · Demo · adopted by · Hasura · Gitlab GraphQL Explorer · GitHub GraphQL Explorer · https://github.com/graphql/graphiql/blob/main/examples/graphiql-cd...打开:/notes/service/api/graphql/graphiql
Client
- graphql
- 164 kB, 41.9 kB
- @apollo/client笔记apollo/clientapollographql/apollo-client · MIT, TS · npm:@apollo/client · ApolloClient · 包含 cache 和 link · link - 通信层 · httpLink 最常用 · cache - 泛化缓存层打开:/notes/service/api/graphql/apollo/client
- 204kB,60kB
- 支持 batch - apollo-link-batch-http
- urql笔记URQLFormidableLabs/urql · 流处理实现基于 kitten/wonka · 优势 · 支持泛化缓存 · Schema 感知 · 开启后支持部分结果返回 - 请求的字段未被缓存但是是 nullable 则先返回 - 因为不影响语义打开:/notes/service/api/graphql/urql
- @urql/core+wonka
- 40kB,15kB
- graffle-js/graffleGitHubgraffle-js/graffle
- graphql-request -> graffle
- 58kB,16kB
- fetch + gql
- react-query+graphql-request
- subscription
- fetch
- GraphQL Yoga 支持
- graphql-sse
- 协议GitHub Fileenisdenjo/graphql-sse/PROTOCOL.md
- enisdenjo/graphql-wsGitHubenisdenjo/graphql-ws
- PROTOCOLGitHub Fileenisdenjo/graphql-ws/PROTOCOL.md
- 99designs/gqlgen#1430GitHub Issue99designs/gqlgen#1430 不支持 graph-transport-ws
- apollographql/subscriptions-transport-wsGitHubapollographql/subscriptions-transport-ws
- ⚠️ 不活跃,没怎么维护
- 推荐 graphql-ws
- 参考
- urql Subscriptions
- fetch
Public GraphQL
GitLab
- GraphQL Explorer
- 文档Linkdocs.gitlab.com/ee/api/graphqlWebUI · graphql/graphiql · graphql/graphql-playground · https://www.graphqlbin.com/v2/new · graphql-kit/graphql-voyager · interactive graph笔记:GraphQL Awesome
- GraphQL API 规范文档
- 全局 ID 格式
gid://gitlab/MyObject/123 - 前端 GraphQL 开发文档
# 生成 schema
bundle exec rake gitlab:graphql:schema:dumpGithub
参考
- chentsulin/awesome-graphqlGitHubchentsulin/awesome-graphql
- APIs-guru/graphql-apisGitHubAPIs-guru/graphql-apis
- 公共 GraphQL API 列表
关联信息
反向链接、本文链接的其他页面和外部资料。
站内链接
- apollo/client笔记 · @apollo/client
apollographql/apollo-client · MIT, TS · npm:@apollo/client · ApolloClient · 包含 cache 和 link · link - 通信层 · httpLink 最常用 · cache - 泛化缓存层
- GraphiQL笔记 · GraphiQL
graphql/graphiql · Explorer · Demo · adopted by · Hasura · Gitlab GraphQL Explorer · GitHub GraphQL Explorer · https://github.com/graphql/graphiql/blob/main/examples/graphiql-cd...
- graphql-modules笔记 · graphql-modules
https://github.com/Urigo/graphql-modules · 服务端 resolver 模块化 · NodeJS · https://the-guild.dev/graphql/modules/docs
- graphql-yoga笔记 · graphql-yoga
dotansimha/graphql-yoga · MIT, Typescript · 支持 NodeJS, Bun, Deno, Cloudflare Worker · 支持 Next.js, SvelteKit, uWebSockets, Fastify, NestJS
- pothos笔记 · hayes/pothos
hayes/pothos · ISC, TS · GQL Type Safe Schema Builder · https://pothos-graphql.dev/docs/guide/app-layout · https://github.com/hayes/pothos/blob/main/examples/complex-app/src/bui...
- TypeGraphQL笔记 · MichalLytek/type-graphql
MichalLytek/type-graphql · MIT, Typescript · 注解/修饰器 方式 · 文件上传 #37 · relay · 需要自己实现 · https://github.com/calmonr/typegraphql-relay
- URQL笔记 · urql
FormidableLabs/urql · 流处理实现基于 kitten/wonka · 优势 · 支持泛化缓存 · Schema 感知 · 开启后支持部分结果返回 - 请求的字段未被缓存但是是 nullable 则先返回 - 因为不影响语义
References
GitHub57 条
- dosco/graphjingithub.com/dosco/graphjin
- movio/bramblegithub.com/movio/bramble
- nautilus/gatewaygithub.com/nautilus/gateway
- 99designs/gqlgengithub.com/99designs/gqlgen
- 99designs/gqlgen#1430github.com/99designs/gqlgen/issues/1430
- anvilco/spectaqlgithub.com/anvilco/spectaql
- api-platform/api-platformgithub.com/api-platform/api-platform
- APIs-guru/graphql-apisgithub.com/APIs-guru/graphql-apis
- apollographql/subscriptions-transport-wsgithub.com/apollographql/subscriptions-transport-ws
- ardatan/graphql-toolsgithub.com/ardatan/graphql-tools
- B2o5T/graphql-eslintgithub.com/B2o5T/graphql-eslint
- babyfish-ct/jimmergithub.com/babyfish-ct/jimmer
- chentsulin/awesome-graphqlgithub.com/chentsulin/awesome-graphql
- daptin/daptingithub.com/daptin/daptin
- dgraph-io/dgraphgithub.com/dgraph-io/dgraph
- directus/directusgithub.com/directus/directus
- dotansimha/graphql-code-generatorgithub.com/dotansimha/graphql-code-generator
- enisdenjo/graphql-sse/PROTOCOL.mdgithub.com/enisdenjo/graphql-sse/blob/master/PROTOCOL.md
- enisdenjo/graphql-wsgithub.com/enisdenjo/graphql-ws
- enisdenjo/graphql-ws/PROTOCOL.mdgithub.com/enisdenjo/graphql-ws/blob/master/PROTOCOL.md
- ent/entgithub.com/ent/ent
- ExpediaGroup/graphql-kotlingithub.com/ExpediaGroup/graphql-kotlin
- glideapps/quicktypegithub.com/glideapps/quicktype
- google/rejoinergithub.com/google/rejoiner
- graffle-js/grafflegithub.com/graffle-js/graffle
- graph-gophers/dataloadergithub.com/graph-gophers/dataloader
- graph-gophers/graphql-gogithub.com/graph-gophers/graphql-go
- graphile/postgraphilegithub.com/graphile/postgraphile
- graphql-editor/graphql-editorgithub.com/graphql-editor/graphql-editor
- graphql-editor/graphql-zeusgithub.com/graphql-editor/graphql-zeus
- graphql-go/graphqlgithub.com/graphql-go/graphql
- graphql-java-kickstart/graphql-spring-bootgithub.com/graphql-java-kickstart/graphql-spring-boot
- graphql-java/graphql-javagithub.com/graphql-java/graphql-java
- graphql-kit/graphql-voyagergithub.com/graphql-kit/graphql-voyager
- graphql-nexus/nexusgithub.com/graphql-nexus/nexus
- graphql/dataloadergithub.com/graphql/dataloader
- graphql/graphiqlgithub.com/graphql/graphiql
- graphql/graphql-playgroundgithub.com/graphql/graphql-playground
- hasura/graphql-enginegithub.com/hasura/graphql-engine
- howtographql/howtographqlgithub.com/howtographql/howtographql
- IvanGoncharov/graphql-fakergithub.com/IvanGoncharov/graphql-faker
- jensneuse/graphql-go-toolsgithub.com/jensneuse/graphql-go-tools
- keystonejs/keystonegithub.com/keystonejs/keystone
- Khan/genqlientgithub.com/Khan/genqlient
- Netflix/dgs-frameworkgithub.com/Netflix/dgs-framework
- parse-community/parse-servergithub.com/parse-community/parse-server
- reactioncommerce/reactiongithub.com/reactioncommerce/reaction
- redwoodjs/redwoodgithub.com/redwoodjs/redwood
- semi-technologies/weaviategithub.com/semi-technologies/weaviate
- sikanhe/gqtxgithub.com/sikanhe/gqtx
- smallrye/smallrye-graphqlgithub.com/smallrye/smallrye-graphql
- spree/spreegithub.com/spree/spree
- spring-projects/spring-graphqlgithub.com/spring-projects/spring-graphql
- supabase/pg_graphqlgithub.com/supabase/pg_graphql
- urigo/graphql-meshgithub.com/urigo/graphql-mesh
- VulcanJS/Vulcangithub.com/VulcanJS/Vulcan
- zalando-incubator/graphql-jitgithub.com/zalando-incubator/graphql-jit
其他外链17 条
- docs.gitlab.com/ee/development/api_graphql_styleguide.htmldocs.gitlab.com/ee/development/api_graphql_styleguide.html
- commerce.nearform.com/open-source/urql/docs/advanced/subscriptionscommerce.nearform.com/open-source/urql/docs/advanced/subscriptions
- developer.github.com/v4/explorerdeveloper.github.com/v4/explorer
- docs.github.com/public/schema.docs.graphqldocs.github.com/public/schema.docs.graphql
- docs.gitlab.com/ee/api/graphqldocs.gitlab.com/ee/api/graphql
- docs.gitlab.com/ee/development/fe_guide/graphql.htmldocs.gitlab.com/ee/development/fe_guide/graphql.html
- engineering.fb.com/2013/06/25/core-data/tao-the-power-of-the-graphengineering.fb.com/2013/06/25/core-data/tao-the-power-of-the-graph
- gitlab.com/-/graphql-explorergitlab.com/-/graphql-explorer
- graphql.org/codegraphql.org/code
- graphql.org/learn/best-practicesgraphql.org/learn/best-practices
- itnext.io/a-guide-to-graphql-schema-federation-part-1-995b639ac035itnext.io/a-guide-to-graphql-schema-federation-part-1-995b639ac035
- movio.co/blog/building-a-new-api-platform-for-moviomovio.co/blog/building-a-new-api-platform-for-movio
- principledgraphql.comprincipledgraphql.com/
- quarkus.io/guides/smallrye-graphqlquarkus.io/guides/smallrye-graphql
- spec.graphql.org/October2021spec.graphql.org/October2021
- www.apollographql.com/docs/federation/federation-specwww.apollographql.com/docs/federation/federation-spec
- www.graphqlbin.com/v2/newwww.graphqlbin.com/v2/new