GraphQL LogoGraphQL

Code

using GraphQL

Because GraphQL is a communication pattern, there are many tools to help you get started working which support GraphQL in all sorts of languages.

Language Support

Sort By:

JavaScript

Server

GraphQL.js

Last Release4 months ago
Stars20k
LicenseMIT License

The reference implementation of the GraphQL specification, designed for running GraphQL in a Node.js environment.

To run a GraphQL.js hello world script from the command line:

npm install graphql

Then run node hello.js with this code in hello.js:

var { graphql, buildSchema } = require("graphql")
var schema = buildSchema(`
type Query {
hello: String
}
`)
var rootValue = { hello: () => "Hello world!" }
var source = "{ hello }"
graphql({ schema, source, rootValue }).then(response => {
console.log(response)
})

Apollo Server

Last Release1 month ago
Stars14k
LicenseMIT License

A GraphQL server from Apollo that works with any Node.js HTTP framework

To run a hello world server with Apollo Server:

npm install @apollo/server graphql

Then run node server.js with this code in server.js:

import { ApolloServer } from "@apollo/server"
import { startStandaloneServer } from "@apollo/server/standalone"
const server = new ApolloServer({
typeDefs,
resolvers,
})
const { url } = await startStandaloneServer(server)
console.log(`🚀 Server ready at ${url}`)

Apollo Server has a built in standalone HTTP server and middleware for Express, and has an framework integration API that supports all Node.js HTTP server frameworks and serverless environments via community integrations.

Apollo Server has a plugin API, integration with Apollo Studio, and performance and security features such as caching, automatic persisted queries, and CSRF prevention.

graphql-yoga

Last Release16 hours ago
Stars8k
LicenseMIT License

GraphQL Yoga is a batteries-included cross-platform GraphQL over HTTP spec-compliant GraphQL Server using Envelop and GraphQL Tools.

  • Built around the Fetch API Request & Response objects
  • GraphQL over HTTP compliant
  • Extensible GraphQL Engine powered by Envelop
  • GraphQL Subscriptions over HTTP
  • Handle file uploads with GraphQL
  • Integrates with AWS Lambda, Cloudflare Workers, Deno, Express, Next.js, SvelteKit, and more.

To run a hello world server with graphql-yoga:

npm install graphql-yoga graphql

Then create a server using the createServer import:

import { createServer } from "http"
import { createSchema, createYoga } from "graphql-yoga"
createServer(
createYoga({
schema: createSchema({
typeDefs: /* GraphQL */ `
type Query {
hello: String
}
`,
resolvers: {
Query: {
hello: () => "Hello Hello Hello",
},
},
}),
})
).listen(4000, () => {
console.info("GraphQL Yoga is listening on http://localhost:4000/graphql")
})

Depending on your deployment target, you may need to use an additional library. See the documentation for further details.

Mercurius

Last Release1 month ago
Stars2k
LicenseMIT License

Mercurius is a flexible and extendible GraphQL adapter for Fastify, a blazing-fast web framework with the least overhead and a powerful plugin architecture.

To run an hello world script with mercurius:

npm install fastify mercurius

Then run node app.js with this code in app.js:

const Fastify = require("fastify")
const mercurius = require("mercurius")
const schema = `
type Query {
hello(name: String): String!
}
`
const resolvers = {
Query: {
hello: async (_, { name }) => `hello ${name || "world"}`,
},
}
const app = Fastify()
app.register(mercurius, {
schema,
resolvers,
})
app.listen(3000)
// Call IT!
// curl 'http://localhost:3000/graphql' \
// -H 'content-type: application/json' \
// --data-raw '{"query":"{ hello(name:\"Marcurius\") }" }'

GraphQL-WS

Last Release1 month ago
Stars2k
LicenseMIT License

Coherent, zero-dependency, lazy, simple, GraphQL over WebSocket Protocol compliant server and client.

GraphQL-SSE

Last Release1 month ago
Stars351
LicenseMIT License

Zero-dependency, HTTP/1 safe, simple, GraphQL over Server-Sent Events Protocol server and client.

GraphQL-HTTP

Last Release5 months ago
Stars262
LicenseMIT License

Simple, pluggable, zero-dependency, GraphQL over HTTP spec compliant server, client and audit suite.

GraphQL Helix

Last Release1 year ago
Stars1k
LicenseMIT License

A collection of utility functions for building your own GraphQL HTTP server. You can check out Building a GraphQL server with GraphQL Helix on DEV for a detailed tutorial on getting started.

To run a hello world server with GraphQL Helix:

npm install graphql graphql-helix express

Then run node server.js with this code in server.js:

const express = require('express')
const {
GraphQLObjectType,
GraphQLSchema,
GraphQLString
} = require('graphql');
const {
getGraphQLParameters,
processRequest,
renderGraphiQL,
shouldRenderGraphiQL
} = require('graphql-helix');
const schema = new GraphQLSchema({
query: new GraphQLObjectType({
name: 'Query',
fields: {
hello: {
type: GraphQLString,
resolve: () => 'Hello world!',
},
},
}),
});
const app = express();
app.use(express.json());
app.use('/graphql', async (req, res) => {
const request = {
body: req.body,
headers: req.headers,
method: req.method,
query: req.query,
};
if (shouldRenderGraphiQL(request)) {
res.send(renderGraphiQL());
} else {
const { operationName, query, variables } = getGraphQLParameters(request);
const result = await processRequest({
operationName,
query,
variables,
request,
schema,
});
if (result.type === 'RESPONSE') {
result.headers.forEach(({ name, value }) => res.setHeader(name, value));
res.status(result.status);
res.json(result.payload);
} else {
// graphql-helix also supports subscriptions and incremental delivery (i.e. @defer and @stream directives)
// out of the box. See the repo for more complete examples that also implement those features.
}
}
});
app.listen(4000, () =>
console.log('Now browse to http://localhost:4000/graphql');
)

This example uses Express, but GraphQL Helix is framework- and runtime-agnostic -- it can run in Node, Deno and the browser. GraphQL Helix provides you with a handful of utility functions to build your own HTTP server but leaves the ultimate implementation details up to you.

GraphQLBox server

Stars23
LicenseMIT License

An extensible GraphQL server with modules for caching, request parsing, debugging, subscriptions and more...

The example below installs and initializes the GraphQLBox server with a persisted cache and debugging enabled.

npm install @graphql-box/core @graphql-box/server @graphql-box/client @graphql-box/request-parser @graphql-box/cache-manager @graphql-box/debug-manager @graphql-box/execute @graphql-box/helpers @cachemap/core @cachemap/reaper @cachemap/redis @cachemap/constants @cachemap/types
import Cachemap from "@cachemap/core"
import redis from "@cachemap/redis"
import reaper from "@cachemap/reaper"
import CacheManager from "@graphql-box/cache-manager"
import Client from "@graphql-box/client"
import DebugManager from "@graphql-box/debug-manager"
import Execute from "@graphql-box/execute"
import RequestParser from "@graphql-box/request-parser"
import Server from "@graphql-box/server"
import { makeExecutableSchema } from "@graphql-tools/schema"
import { performance } from "perf_hooks"
import { schemaResolvers, schemaTypeDefs } from "./schema"
import logger from "./logger"
const schema = makeExecutableSchema({
typeDefs: schemaTypeDefs,
resolvers: schemaResolvers,
})
const server = new Server({
client: new Client({
cacheManager: new CacheManager({
cache: new Cachemap({
name: "server-cache",
reaper: reaper({ interval: 300000 }),
store: redis(/* configure */),
}),
cascadeCacheControl: true,
typeCacheDirectives: {
// Add any type specific cache control directives in the format:
// TypeName: "public, max-age=3",
},
}),
debugManager: new DebugManager({
environment: "server",
log: (...args) => {
logger.log(...args)
},
name: "SERVER",
performance,
}),
requestManager: new Execute({ schema }),
requestParser: new RequestParser({ schema }),
}),
})
// Meanwhile... somewhere else in your code
app.use("api/graphql", graphqlServer.request())

Client

Apollo Client

Last Release3 days ago
Stars19k
LicenseMIT License

A powerful JavaScript GraphQL client, designed to work well with React, React Native, Angular 2, or just plain JavaScript.

urql

Last Release2 days ago
Stars8k
LicenseMIT License

A highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.

urql is a GraphQL client that exposes a set of helpers for several frameworks. It's built to be highly customisable and versatile so you can take it from getting started with your first GraphQL project all the way to building complex apps and experimenting with GraphQL clients.

  • Currently supports React, React Native, Preact, Svelte, and Vue, and is supported by GraphQL Code Generator.
  • Logical yet simple default behaviour and document caching, and normalized caching via @urql/exchange-graphcache
  • Fully customizable behaviour via "exchanges" (addon packages)

Relay

Last Release1 week ago
Stars18k
LicenseMIT License

Facebook's framework for building React applications that talk to a GraphQL backend.

Relay is a JavaScript framework for building data-driven React applications.

  • Declarative: Never again communicate with your data store using an imperative API. Simply declare your data requirements using GraphQL and let Relay figure out how and when to fetch your data.
  • Colocation: Queries live next to the views that rely on them, so you can easily reason about your app. Relay aggregates queries into efficient network requests to fetch only what you need.
  • Mutations: Relay lets you mutate data on the client and server using GraphQL mutations, and offers automatic data consistency, optimistic updates, and error handling.

See how to use Relay in your own project.

GraphQL Request

Last Release3 years ago
Stars6k
LicenseMIT License

A simple and flexible JavaScript GraphQL client that works in all JavaScript environments (the browser, Node.js, and React Native) - basically a lightweight wrapper around fetch.

AWS Amplify

Last Release1 week ago
Stars9k
LicenseApache License 2.0

A JavaScript library for application development using cloud services, which supports GraphQL backend and React components for working with GraphQL data.

graphqurl

Stars3k
LicenseApache License 2.0

curl for GraphQL with autocomplete, subscriptions and GraphiQL. Also a dead-simple universal javascript GraphQL client.

GraphQL-WS

Last Release1 month ago
Stars2k
LicenseMIT License

Coherent, zero-dependency, lazy, simple, GraphQL over WebSocket Protocol compliant server and client.

graphql-hooks

Last Release2 weeks ago
Stars2k
LicenseOther

Minimal React hooks-first GraphQL client with a tiny bundle, SSR support and caching

  • 🥇 First-class hooks API
  • ⚖️ Tiny bundle: only 7.6kB (2.8 gzipped)
  • 📄 Full SSR support: see graphql-hooks-ssr
  • 🔌 Plugin Caching: see graphql-hooks-memcache
  • 🔥 No more render props hell
  • ⏳ Handle loading and error states with ease

Quickstart#

npm install graphql-hooks

First you'll need to create a client and wrap your app with the provider:

import { GraphQLClient, ClientContext } from "graphql-hooks"
const client = new GraphQLClient({
url: "/graphql",
})
function App() {
return (
<ClientContext.Provider value={client}>
{/* children */}
</ClientContext.Provider>
)
}

Now in your child components you can make use of useQuery:

import { useQuery } from "graphql-hooks"
const HOMEPAGE_QUERY = `query HomePage($limit: Int) {
users(limit: $limit) {
id
name
}
}`
function MyComponent() {
const { loading, error, data } = useQuery(HOMEPAGE_QUERY, {
variables: {
limit: 10,
},
})
if (loading) return "Loading..."
if (error) return "Something Bad Happened"
return (
<ul>
{data.users.map(({ id, name }) => (
<li key={id}>{name}</li>
))}
</ul>
)
}

Lokka

Stars2k
LicenseMIT License

A simple JavaScript GraphQL client that works in all JavaScript environments (the browser, Node.js, and React Native).

nanogql

Stars422
LicenseMIT License

Tiny GraphQL client library using template strings.

GraphQL-SSE

Last Release1 month ago
Stars351
LicenseMIT License

Zero-dependency, HTTP/1 safe, simple, GraphQL over Server-Sent Events Protocol server and client.

GraphQL-HTTP

Last Release5 months ago
Stars262
LicenseMIT License

Simple, pluggable, zero-dependency, GraphQL over HTTP spec compliant server, client and audit suite.

graphql-ts-client

Last Release1 month ago
Stars142
LicenseMIT License

GraphQL client for TypeScript, automatically infers the type of the returned data according to the strongly typed query request

GraphQLBox client

Stars23
LicenseMIT License

An extensible GraphQL client with modules for react, caching, request parsing, web workers, websockets and more...

The example below installs and initializes the GraphQLBox client with a persisted cache and debugging enabled.

npm install @graphql-box/core @graphql-box/client @graphql-box/request-parser @graphql-box/cache-manager @graphql-box/debug-manager @graphql-box/fetch-manager @graphql-box/helpers @cachemap/core @cachemap/reaper @cachemap/indexed-db @cachemap/constants @cachemap/types
import Cachemap from "@cachemap/core"
import indexedDB from "@cachemap/indexed-db"
import reaper from "@cachemap/reaper"
import CacheManager from "@graphql-box/cache-manager"
import Client from "@graphql-box/client"
import DebugManager from "@graphql-box/debug-manager"
import FetchManager from "@graphql-box/fetch-manager"
import RequestParser from "@graphql-box/request-parser"
import introspection from "./introspection-query"
const requestManager = new FetchManager({
apiUrl: "/api/graphql",
batchRequests: true,
logUrl: "/log/graphql",
})
const client = new Client({
cacheManager: new CacheManager({
cache: new Cachemap({
name: "client-cache",
reaper: reaper({ interval: 300000 }),
store: indexedDB(/* configure */),
}),
cascadeCacheControl: true,
typeCacheDirectives: {
// Add any type specific cache control directives in the format:
// TypeName: "public, max-age=3",
},
}),
debugManager: new DebugManager({
environment: "client",
log: (message, data, logLevel) => {
requestManager.log(message, data, logLevel)
},
name: "CLIENT",
performance: self.performance,
}),
requestManager,
requestParser: new RequestParser({ introspection }),
})
// Meanwhile... somewhere else in your code
const { data, errors } = await client.request(queryOrMutation)

Grafoo

Last Release5 years ago
Stars274
LicenseMIT License

An all purpose GraphQL client with view layer integrations for multiple frameworks in just 1.6kb.

gq-loader

Stars59
LicenseUnknown

A simple JavaScript GraphQL client,Let the *.gql file be used as a module through webpack loader.

Tools

SpectaQL

Stars1k
LicenseMIT License

SpectaQL generates static HTML documentation from a GraphQL schema.

SpectaQL is a Node.js library that generates static documentation for a GraphQL schema using a variety of options:

  • From a live endpoint using the introspection query.
  • From a file containing an introspection query result.
  • From a file, files or glob leading to the schema definitions in SDL.

Out of the box, SpectaQL generates a single 3-column HTML page and lets you choose between a couple built-in themes. A main goal of the project is to be easily and extremely customizable--it is themeable and just about everything can be overridden or customized.

npm install --dev spectaql
# OR
yarn add -D spectaql
# Then generate your docs
npm run spectaql my-config.yml
# OR
yarn spectaql my-config.yml

Postgraphile

Last Release4 months ago
Stars12k
LicenseOther

builds a powerful, extensible and performant GraphQL API from a PostgreSQL schema in seconds; saving you weeks if not months of development time.

GraphQL Code Generator

Last Release6 months ago
Stars11k
LicenseMIT License

GraphQL code generator with flexible support for custom plugins and templates like Typescript (frontend and backend), React Hooks, resolvers signatures and more.

GraphQL Tools

Last Release1 week ago
Stars5k
LicenseMIT License

A set of utils for faster development of GraphQL tools (Schema and documents loading, Schema merging and more).

GraphiQL

Last Release3 days ago
Stars16k
LicenseMIT License

An interactive in-browser GraphQL IDE.

GraphQLShield

Last Release1 year ago
Stars4k
LicenseMIT License

A GraphQL tool to ease the creation of permission layer.

GraphQL Shield helps you create a permission layer for your application. Using an intuitive rule-API, you'll gain the power of the shield engine on every request and reduce the load time of every request with smart caching. This way you can make sure your application will remain quick, and no internal data will be exposed.

import { rule, shield, and, or, not } from "graphql-shield"
// Rules
const isAuthenticated = rule({ cache: "contextual" })(
async (parent, args, ctx, info) => {
return ctx.user !== null
}
)
const isAdmin = rule({ cache: "contextual" })(
async (parent, args, ctx, info) => {
return ctx.user.role === "admin"
}
)
const isEditor = rule({ cache: "contextual" })(
async (parent, args, ctx, info) => {
return ctx.user.role === "editor"
}
)
// Permissions
const permissions = shield({
Query: {
frontPage: not(isAuthenticated),
fruits: and(isAuthenticated, or(isAdmin, isEditor)),
customers: and(isAuthenticated, isAdmin),
},
Mutation: {
addFruitToBasket: isAuthenticated,
},
Fruit: isAuthenticated,
Customer: isAdmin,
})
// Server
const server = new GraphQLServer({
typeDefs,
resolvers,
middlewares: [permissions],
context: req => ({
...req,
user: getUser(req),
}),
})

GraphQL Scalars

Last Release3 months ago
Stars2k
LicenseMIT License

A library of custom GraphQL scalar types for creating precise, type-safe GraphQL schemas.

GraphQL Modules

Last Release3 months ago
Stars1k
LicenseMIT License

GraphQL Modules lets you separate your backend implementation to small, reusable, easy-to-implement and easy-to-test pieces.

GraphQLMiddleware

Last Release6 months ago
Stars1k
LicenseMIT License

Split up your GraphQL resolvers in middleware functions.

GraphQL Middleware is a schema wrapper which allows you to manage additional functionality across multiple resolvers efficiently.

Features#

💡 Easy to use: An intuitive, yet familiar API that you will pick up in a second. 💪 Powerful: Allows complete control over your resolvers (Before, After). 🌈 Compatible: Works with any GraphQL Schema.

Example#

const { ApolloServer } = require("apollo-server")
const { makeExecutableSchema } = require("@graphql-tools/schema")
const typeDefs = `
type Query {
hello(name: String): String
bye(name: String): String
}
`
const resolvers = {
Query: {
hello: (root, args, context, info) => {
console.log(`3. resolver: hello`)
return `Hello ${args.name ? args.name : "world"}!`
},
bye: (root, args, context, info) => {
console.log(`3. resolver: bye`)
return `Bye ${args.name ? args.name : "world"}!`
},
},
}
const logInput = async (resolve, root, args, context, info) => {
console.log(`1. logInput: ${JSON.stringify(args)}`)
const result = await resolve(root, args, context, info)
console.log(`5. logInput`)
return result
}
const logResult = async (resolve, root, args, context, info) => {
console.log(`2. logResult`)
const result = await resolve(root, args, context, info)
console.log(`4. logResult: ${JSON.stringify(result)}`)
return result
}
const schema = makeExecutableSchema({ typeDefs, resolvers })
const schemaWithMiddleware = applyMiddleware(schema, logInput, logResult)
const server = new ApolloServer({
schema: schemaWithMiddleware,
})
await server.listen({ port: 8008 })

GraphQL Mesh

Last Release2 weeks ago
Stars3k
LicenseMIT License

GraphQL Mesh allows you to use GraphQL query language to access data in remote APIs that don't run GraphQL (and also ones that do run GraphQL). It can be used as a gateway to other services, or run as a local GraphQL schema that aggregates data from remote APIs.

SOFA

Last Release1 month ago
Stars1k
LicenseMIT License

Generate REST API from your GraphQL API.

GraphQL Live Query

Last Release1 year ago
Stars428
LicenseMIT License

Real-Time with GraphQL for any GraphQL schema or transport.

An interface for building GraphQL language services for IDEs (diagnostics, autocomplete etc).

GraphQL Inspector

Last Release2 months ago
Stars2k
LicenseMIT License

Compare schemas, validate documents, find breaking changes, find similar types, schema coverage, and more.

GraphQL Config

Last Release3 months ago
Stars1k
LicenseMIT License

One configuration for all your GraphQL tools (supported by most tools, editors & IDEs).

GraphQL-ESLint

Last Release5 months ago
Stars1k
LicenseMIT License

GraphQL-ESLint integrates GraphQL AST in the ESLint core (as a parser).

GraphQL-HTTP

Last Release5 months ago
Stars262
LicenseMIT License

Simple, pluggable, zero-dependency, GraphQL over HTTP spec compliant server, client and audit suite.

Microfiber

Stars28
LicenseMIT License

A library to query and manipulate GraphQL Introspection Query results.

Microfiber is a JavaScript library that allows:

  • Digging through your Introspection Query Results for a specific Query, Mutation, Type, Field, Argument or Subscription.
  • Removing a specific Query, Mutation, Type, Field/InputField, Argument or Subscription from your Introspection Query Results.
  • Removing Queries, Mutations, Fields/InputFields or Arguments that refer to Type that does not exist in - or has been removed from - your Introspection Query Results.
npm install microfiber
# OR
yarn add microfiber

Then in JS:

import { Microfiber } from 'microfiber'
const introspectionQueryResults = {...}
const microfiber = new Microfiber(introspectionQueryResults)
// ...do some things to your schema with `microfiber`
const cleanedIntrospectonQueryResults = microfiber.getResponse()

GraphQL CLI

Last Release3 years ago
Stars2k
LicenseMIT License

A command line tool for common GraphQL development workflows.

GiraphQL

Last Release1 week ago
Stars2k
LicenseISC License

A plugin based schema builder for creating code-first GraphQL schemas in typescript

GiraphQL makes writing type-safe schemas simple, and works without a code generator, build process, or extensive manual type definitions.

import { ApolloServer } from "apollo-server"
import SchemaBuilder from "@giraphql/core"
const builder = new SchemaBuilder({})
builder.queryType({
fields: t => ({
hello: t.string({
args: {
name: t.arg.string({}),
},
resolve: (parent, { name }) => `hello, ${name || "World"}`,
}),
}),
})
new ApolloServer({
schema: builder.toSchema({}),
}).listen(3000)

Brangr

Last Release8 months ago
Stars1
LicenseMozilla Public License 2.0

Browse Any Graph - A user-friendly viewer for any GraphQL service

Brangr - Browse Any Graph

  • Brangr is a simple, unique tool that any web server can host to provide a user-friendly browser/viewer for any GraphQL service (or many).

  • Brangr formats GraphQL results attractively, via a selection of user-configurable layouts. It lets users extract the generated HTML, and its source JSON. It provides a clever schema browser. It has built-in docs.

  • Brangr enables sites hosting it to present users with a collection of pre-fab GraphQL requests, which they can edit if desired, and let them create their own requests. And it allows sites to define custom CSS styling for all aspects of the formatted results.

  • Try it at the public Brangr site.

Example

query {
heroes(_layout:{type:table}) { # _layout arg not sent to service
first
last
}
}

Brangr renders the above query as follows (though not in a quote block):

heroes...
First Last
ArthurDent
Ford Prefect
ZaphodBeeblebrox

Server

graphql-go

Last Release9 months ago
Stars10k
LicenseMIT License

An implementation of GraphQL for Go / Golang.

99designs/gqlgen

Last Release2 weeks ago
Stars9k
LicenseMIT License

Go generate based graphql server library.

graph-gophers/graphql-go

Last Release1 year ago
Stars5k
LicenseBSD 2-Clause "Simplified" License

GraphQL server with a focus on ease of use.

samsarahq/thunder

Stars2k
LicenseMIT License

A GraphQL implementation with easy schema building, live queries, and batching.

graphql-go-tools

Last Release3 months ago
Stars1k
LicenseMIT License

A collection of tools for building GraphQL Servers, Gateways, Proxy Servers and Middleware in Go.

graphql-go-tools implements all basic blocks for building GraphQL Servers, Gateways and Proxy Servers. From lexing, parsing, validation, normalization, all the way up to query planning and execution.

It can also be understood as a GraphQL Compiler, with the ability to add your own backends. Just by implementing a few interfaces, you're able to teach the compiler how to talk GraphQL to any backend.

The following backends are already implemented: GraphQL, with support for Apollo Federation / Supergraph. Databases: PostgreSQL, MySQL, SQLite, CockroachDB, MongoDB, SQLServer, OpenAPI / REST and Kafka.

To get a sense on how to implement a new backend, check out the Static Data Source, as it's the simplest one.

It's used in production by many enterprises for multiple years now, battle tested and actively maintained.

graphql-relay-go

Stars419
LicenseMIT License

A Go/Golang library to help construct a graphql-go server supporting react-relay.

appointy/jaal

Last Release3 years ago
Stars74
LicenseMIT License

Develop spec compliant GraphQL servers in Go.

EGGQL

Stars28
LicenseMIT License

Easy to use, complete Go implementation of GraphQL. Simple and schema-less.

The purpose of Eggql is to make it as simple as possible to create a GraphQL server. You don't need to create GraphQL schema (though you can view the schema that is created if interested). It is currently in beta release but is a complete implementation of a GraphQL server apart from subscriptions.

Just to be clear it supports all of these GraphQL features: arguments (including defaults), objects/lists/enums/input/interface/union types, aliases, fragments, variables, directives, mutations, inline fragments, descriptions, introspection and custom scalars.

Tests (jMeter) show that it is as fast or faster than other Go implementations for simple queries. We're working on enhancements for performance including caching, data-loader, complexity-limits, etc.

To run an eggql hello world server just build and run this Go program:

package main
import "github.com/andrewwphillips/eggql"
func main() {
http.Handle("/graphql", eggql.New(struct{ Message string }{Message: "hello, world"}))
http.ListenAndServe(":80", nil)
}

This creates a root Query object with a single message field. To test it send a query with curl:

$ curl -XPOST -d '{"query": "{ message }"}' localhost:80/graphql

and you will get this response:

{
"data": {
"message": "hello, world"
}
}

Client

genqlient

Last Release9 months ago
Stars1k
LicenseMIT License

A truly type-safe Go GraphQL client.

genqlient is a Go library to easily generate type-safe code to query a GraphQL API. It takes advantage of the fact that both GraphQL and Go are typed languages to ensure at compile-time that your code is making a valid GraphQL query and using the result correctly, all with a minimum of boilerplate.

genqlient provides:

  • Compile-time validation of GraphQL queries: never ship an invalid GraphQL query again!
  • Type-safe response objects: genqlient generates the right type for each query, so you know the response will unmarshal correctly and never need to use interface{}.
  • Production-readiness: genqlient is used in production at Khan Academy, where it supports millions of learners and teachers around the world.

machinebox/graphql

Last Release5 years ago
Stars1k
LicenseApache License 2.0

An elegant low-level HTTP client for GraphQL.

graphql

Stars1k
LicenseMIT License

A GraphQL client implementation in Go.

go-graphql-client

Last Release1 day ago
Stars362
LicenseMIT License

A GraphQL Go client with Mutation, Query and Subscription support.

Tools

graphjin

Last Release1 month ago
Stars3k
LicenseApache License 2.0

An instant GraphQL to SQL compiler. Use as a standalone service or a Go library. Formerly super-graph.

PHP

Server

API Platform

Last Release3 days ago
Stars8k
LicenseMIT License

API Platform is a fully-featured, flexible and extensible API framework built on top of Symfony.

The following class is enough to create both a Relay-compatible GraphQL server and a hypermedia API supporting modern REST formats (JSON-LD, JSONAPI...):

<?php
namespace AppEntity;
use ApiPlatformCoreAnnotationApiResource;
use DoctrineORMMapping as ORM;
/**
* Greet someone!
*
* @ApiResource
* @ORMEntity
*/
class Greeting
{
/**
* @ORMId
* @ORMColumn(type="guid")
*/
public $id;
/**
* @var string Your nice message
*
* @ORMColumn
*/
public $hello;
}

Other API Platform features include data validation, authentication, authorization, deprecations, cache and GraphiQL integration.

graphql-php

Last Release1 week ago
Stars5k
LicenseMIT License

A PHP port of GraphQL reference implementation

WPGraphQL

Last Release1 week ago
Stars4k
LicenseGNU General Public License v3.0

A free, open-source WordPress plugin that provides an extendable GraphQL schema and API for any WordPress site

Lighthouse

Last Release3 days ago
Stars3k
LicenseMIT License

A GraphQL server for Laravel

Siler

Last Release3 years ago
Stars1k
LicenseMIT License

Siler is a PHP library powered with high-level abstractions to work with GraphQL.

To run a Siler hello world script:

type Query {
hello: String
}
<?php
declare(strict_types=1);
require_once '/path/to/vendor/autoload.php';
use SilerDiactoros;
use SilerGraphql;
use SilerHttp;
$typeDefs = file_get_contents(__DIR__.'/schema.graphql');
$resolvers = [
'Query' => [
'hello' => 'world',
],
];
$schema = Graphqlschema($typeDefs, $resolvers);
echo "Server running at http://127.0.0.1:8080";
Httpserver(Graphqlpsr7($schema), function (Throwable $err) {
var_dump($err);
return Diactorosjson([
'error' => true,
'message' => $err->getMessage(),
]);
})()->run();

It also provides functionality for the construction of a WebSocket Subscriptions Server based on how Apollo works.

GraphQLBundle

Last Release6 months ago
Stars1k
LicenseMIT License

A GraphQL server for Symfony

GraphQLite

Last Release7 months ago
Stars1k
LicenseMIT License

GraphQLite is a library that offers an annotations-based syntax for GraphQL schema definition.

It is framework agnostic with bindings available for Symfony and Laravel. This code declares a "product" query and a "Product" Type:

class ProductController
{
/**
* @Query()
*/
public function product(string $id): Product
{
// Some code that looks for a product and returns it.
}
}
/**
* @Type()
*/
class Product
{
/**
* @Field()
*/
public function getName(): string
{
return $this->name;
}
// ...
}

Other GraphQLite features include validation, security, error handling, loading via data-loader pattern...

Railt

Last Release4 years ago
Stars357
LicenseMIT License

A PHP GraphQL Framework.

Gato GraphQL

Last Release6 days ago
Stars348
LicenseGNU General Public License v2.0

Interact with all your data in WordPress

graphql-relay-php

Last Release2 years ago
Stars271
LicenseBSD 3-Clause "New" or "Revised" License

A library to help construct a graphql-php server supporting react-relay.

GraPHPinator

Last Release2 months ago
Stars38
LicenseMIT License

A GraphQL implementation for modern PHP. Includes features from latest draft, middleware directives and modules with extra functionality.

GraPHPinator is feature complete PHP implementation of GraphQL server. Its job is transformation of query string into resolved Json result for a given Schema.

  • Aims to be compliant with the latest draft of GraphQL specification.
  • Fully typesafe, and therefore minimum required PHP version is 8.0. Sacrafices a tiny bit of convenience for huge amount of clarity and safety - no random configuration arrays, no mixed types, no variable function arguments - this library doesnt try to save you from verbosity, but makes sure you always know what you've got.
  • Code first.
  • Flexible. Easy to extend with extra functionality using Modules or middleware Directives.
  • Includes some opt-in extensions which are out of scope of official specs:
  • Project is composed from multiple smaller packages, which may be used standalone:
    • Tokenizer - Lexical analyzer of GraphQL document.
    • Parser - Syntactic analyzer of GraphQL document.

serge

Stars5
LicenseGNU General Public License v3.0

Use GraphQL to define your Domain Model for CQRS/ES and let serge generate code to handle GraphQL requests.

Java / Kotlin

Server

graphql-java

Last Release3 months ago
Stars6k
LicenseMIT License

A Java library for building GraphQL APIs.

See the Getting Started tutorial on the GraphQL Java website.

Code that executes a hello world GraphQL query with graphql-java:

import graphql.ExecutionResult;
import graphql.GraphQL;
import graphql.schema.GraphQLSchema;
import graphql.schema.StaticDataFetcher;
import graphql.schema.idl.RuntimeWiring;
import graphql.schema.idl.SchemaGenerator;
import graphql.schema.idl.SchemaParser;
import graphql.schema.idl.TypeDefinitionRegistry;
import static graphql.schema.idl.RuntimeWiring.newRuntimeWiring;
public class HelloWorld {
public static void main(String[] args) {
String schema = "type Query{hello: String}";
SchemaParser schemaParser = new SchemaParser();
TypeDefinitionRegistry typeDefinitionRegistry = schemaParser.parse(schema);
RuntimeWiring runtimeWiring = newRuntimeWiring()
.type("Query", builder -> builder.dataFetcher("hello", new StaticDataFetcher("world")))
.build();
SchemaGenerator schemaGenerator = new SchemaGenerator();
GraphQLSchema graphQLSchema = schemaGenerator.makeExecutableSchema(typeDefinitionRegistry, runtimeWiring);
GraphQL build = GraphQL.newGraphQL(graphQLSchema).build();
ExecutionResult executionResult = build.execute("{hello}");
System.out.println(executionResult.getData().toString());
// Prints: {hello=world}
}
}

See the graphql-java docs for further information.

Domain Graph Service (DGS) Framework

Last Release3 days ago
Stars3k
LicenseApache License 2.0

The DGS Framework (Domain Graph Service) is a GraphQL server framework for Spring Boot, developed by Netflix.

The DGS Framework (Domain Graph Service) is a GraphQL server framework for Spring Boot, developed by Netflix.

Features include:

  • Annotation based Spring Boot programming model
  • Test framework for writing query tests as unit tests
  • Gradle Code Generation plugin to create types from schema
  • Easy integration with GraphQL Federation
  • Integration with Spring Security
  • GraphQL subscriptions (WebSockets and SSE)
  • File uploads
  • Error handling
  • Many extension points

See DGS Framework Getting Started for how to get started.

graphql-kotlin

Last Release1 week ago
Stars2k
LicenseApache License 2.0

A set of libraries for running GraphQL client and server in Kotlin.

GraphQL Kotlin follows a code first approach for generating your GraphQL schemas. Given the similarities between Kotlin and GraphQL, such as the ability to define nullable/non-nullable types, a schema can be generated from Kotlin code without any separate schema specification. To create a reactive GraphQL web server add following dependency to your Gradle build file:

// build.gradle.kts
implementation("com.expediagroup", "graphql-kotlin-spring-server", latestVersion)

We also need to provide a list of supported packages that can be scanned for exposing your schema objects through reflections. Add following configuration to your application.yml file:

graphql:
packages:
- "com.your.package"

With the above configuration we can now create our schema. In order to expose your queries, mutations and/or subscriptions in the GraphQL schema you simply need to implement corresponding marker interface and they will be automatically picked up by graphql-kotlin-spring-server auto-configuration library.

@Component
class HelloWorldQuery : Query {
fun helloWorld() = "Hello World!!!"
}

This will result in a reactive GraphQL web application with following schema:

type Query {
helloWorld: String!
}

See graphql-kotlin docs for additial details.

GraphQL Spring Boot

Last Release1 month ago
Stars2k
LicenseMIT License

GraphQL Spring Boot from GraphQL Java Kickstart

The GraphQL Spring Boot turns any Spring Boot application into a GraphQL Server

Started includes features such as:

See GraphQL Java Kickstart Getting Started for how to get started.

Spring for GraphQL

Last Release2 months ago
Stars1k
LicenseApache License 2.0

Spring for GraphQL provides support for Spring applications built on GraphQL Java.

Spring for GraphQL provides support for Spring applications built on GraphQL Java. See the official Spring guide for how to build a GraphQL service in 15 minutes.

  • It is a joint collaboration between the GraphQL Java team and Spring engineering.
  • Our shared philosophy is to provide as little opinion as we can while focusing on comprehensive support for a wide range of use cases.
  • It aims to be the foundation for all Spring, GraphQL applications.

Features:

  • Server handling of GraphQL requests over HTTP, WebSocket, and RSocket.
  • An annotation-based programming model where @Controller components use annotations to declare handler methods with flexible method signatures to fetch the data for specific GraphQL fields. For example:
@Controller
public class GreetingController {
@QueryMapping
public String hello() {
return "Hello, world!";
}
}
  • Client support for executing GraphQL requests over HTTP, WebSocket, and RSocket.
  • Dedicated support for testing GraphQL requests over HTTP, WebSocket, and RSocket, as well as for testing directly against a server.

To get started, check the Spring GraphQL starter on https://start.spring.io and the samples in this repository.

Jimmer

Last Release3 weeks ago
Stars1k
LicenseApache License 2.0

A revolutionary ORM framework for both java and kotlin, it also provides specialized API for rapid development of Spring GraphQL-based applications.

Introduce#

  1. SpringBoot has introduced Spring GraphQL since 2.7. Jimmer provides specialized API for rapid development of Spring GraphQL-based applications.

  2. Support two APIs: Java API & kotlin API.

  3. Powerful and GraphQL friendly caching support.

  4. Faster than other popular ORM solutions, please see the bechmark: https://babyfish-ct.github.io/jimmer/docs/benchmark/

  5. More powerful than other popular ORM solutions.

    Three aspects should be considered in ORM design:

    a. Query. b. Update. c. Cache.

    Each aspect is aimed at object trees with arbitrary depth rather than simple objects. This distinctive design brings convenience unmatched by other popular solutions.

Links#

KGraphQL

Last Release1 year ago
Stars288
LicenseMIT License

KGraphQL is a Kotlin implementation of GraphQL. It provides a rich DSL to set up the GraphQL schema.

Here's an example on how to create a simple schema based on a kotlin data class plus a property resolver that gets applied onto your class.

data class Article(val id: Int, val text: String)
fun main() {
val schema = KGraphQL.schema {
query("article") {
resolver { id: Int?, text: String ->
Article(id ?: -1, text)
}
}
type<Article> {
property<String>("fullText") {
resolver { article: Article ->
"${article.id}: ${article.text}"
}
}
}
}
schema.execute("""
{
article(id: 5, text: "Hello World") {
id
fullText
}
}
""").let(::println)
}

KGraphQL is using coroutines behind the scenes to provide great asynchronous performance.

See KGraphQL docs for more in depth usage.

Ktor Plugin#

KGraphQL has a Ktor plugin which gives you a fully functional GraphQL server with a single install function call. Example below shows how to set up a GraphQL server within Ktor and it will give you a GraphQL Playground out of the box by entering localhost:8080/graphql.

fun Application.module() {
install(GraphQL) {
playground = true
schema {
query("hello") {
resolver { -> "World!" }
}
}
}
}

You can follow the Ktor tutorial to set up a KGraphQL server with ktor from scratch up.

graphql-calculator

Last Release2 years ago
Stars102
LicenseApache License 2.0

A lightweight graphql calculation engine.

GraphQL Calculator is a lightweight graphql calculation engine, which is used to alter execution behavior of graphql query.

Here are some examples on how to use GraphQL Calculator on graphql query.

query basicMapValue($userIds: [Int]) {
userInfoList(userIds: $userIds) {
id
age
firstName
lastName
fullName: stringHolder @map(mapper: "firstName + lastName")
}
}
query filterUserByAge($userId: [Int]) {
userInfoList(userIds: $userId) @filter(predicate: "age>=18") {
userId
age
firstName
lastName
}
}
query parseFetchedValueToAnotherFieldArgumentMap($itemIds: [Int]) {
itemList(itemIds: $itemIds) {
# save sellerId as List<Long> with unique name "sellerIdList"
sellerId @fetchSource(name: "sellerIdList")
name
saleAmount
salePrice
}
userInfoList(userIds: 1)
# transform the argument of "userInfoList" named "userIds" according to expression "sellerIdList" and expression argument,
# which mean replace userIds value by source named "sellerIdList"
@argumentTransform(
argumentName: "userIds"
operateType: MAP
expression: "sellerIdList"
dependencySources: ["sellerIdList"]
) {
userId
name
age
}
}

See graphql-calculator README for more information.

MicroProfile GraphQL

Last Release1 year ago
Stars93
LicenseApache License 2.0

MP GraphQL is a code-first specification for building GraphQL applications. It uses annotations and design patterns similar to JAX-RS to enable rapid development.

MicroProfile GraphQL is a GraphQL server and client specification for building GraphQL applications. It's unique annotation-based API approach enables rapid application development. Applications coded to the MP GraphQL APIs are portable, and can be deployed into Java server runtimes such as Open Liberty, Quarkus, Helidon and Wildfly. This means that your applications can make use of other Jakarta and MicroProfile technologies.

MP GraphQL features include:

  • Annotation-based APIs
  • Integration with Jakarta CDI
  • Type-safe and dynamic client APIs
  • Exception handling
  • Easy integration with Jakarta and MicroProfile technologies

Want to get started? Check out these resouces:

Or these videos:

Client

Apollo Kotlin

Last Release1 month ago
Stars4k
LicenseMIT License

A strongly-typed, caching GraphQL client for the JVM, Android, and Kotlin multiplatform.

Apollo Kotlin (formerly known as Apollo Android) is a GraphQL client with support for Android, Java8+, iOS and Kotlin multiplatform in general. It features:

  • Java and Kotlin Multiplatform code generation
  • Queries, Mutations and Subscriptions
  • Reflection-free parsing
  • Normalized cache
  • Custom scalar types
  • HTTP cache
  • Auto Persisted Queries
  • Query batching
  • File uploads
  • Espresso IdlingResource
  • Fake models for tests
  • AppSync and graphql-ws websockets
  • GraphQL AST parser

graphql-kotlin

Last Release1 week ago
Stars2k
LicenseApache License 2.0

A set of libraries for running GraphQL client and server in Kotlin.

GraphQL Kotlin provides a set of lightweight type-safe GraphQL HTTP clients. The library provides Ktor HTTP client and Spring WebClient based reference implementations as well as allows for custom implementations using other engines. Jackson and kotlinx-serialization type-safe data models are generated at build time by the provided Gradle and Maven plugins.

To generate Jackson models that will be used with GraphQL Kotlin Spring WebClient, add following to your Gradle build file:

// build.gradle.kts
import com.expediagroup.graphql.plugin.gradle.graphql
plugins {
id("com.expediagroup.graphql") version $latestGraphQLKotlinVersion
}
dependencies {
implementation("com.expediagroup:graphql-kotlin-spring-client:$latestGraphQLKotlinVersion")
}
graphql {
client {
// target GraphQL endpoint
endpoint = "http://localhost:8080/graphql"
// package for generated client code
packageName = "com.example.generated"
}
}

By default, GraphQL Kotlin plugins will look for query files under src/main/resources. Given HelloWorldQuery.graphql sample query:

query HelloWorldQuery {
helloWorld
}

Plugin will generate classes that are simple POJOs implementing GraphQLClientRequest interface and represent a GraphQL request.

package com.example.generated
import com.expediagroup.graphql.client.types.GraphQLClientRequest
import kotlin.String
import kotlin.reflect.KClass
const val HELLO_WORLD_QUERY: String = "query HelloWorldQuery {\n helloWorld\n}"
class HelloWorldQuery: GraphQLClientRequest<HelloWorldQuery.Result> {
override val query: String = HELLO_WORLD_QUERY
override val operationName: String = "HelloWorldQuery"
override fun responseType(): KClass<HelloWorldQuery.Result> = HelloWorldQuery.Result::class
data class Result(
val helloWorld: String
}
}

We can then execute our queries using target client.

package com.example.client
import com.expediagroup.graphql.client.spring.GraphQLWebClient
import com.expediagroup.graphql.generated.HelloWorldQuery
import kotlinx.coroutines.runBlocking
fun main() {
val client = GraphQLWebClient(url = "http://localhost:8080/graphql")
runBlocking {
val helloWorldQuery = HelloWorldQuery()
val result = client.execute(helloWorldQuery)
println("hello world query result: ${result.data?.helloWorld}")
}
}

See graphql-kotlin client docs for additional details.

Nodes

Last Release4 years ago
Stars305
LicenseApache License 2.0

A GraphQL JVM Client designed for constructing queries from standard model definitions. By American Express.

Tools

GraphQL Java Generator

Stars49
LicenseMIT License

GraphQL Java Generator is a tool that generates Java code to speed up development for Client and Server of GraphQL APIs

  • GraphQL Java client: it generates the Java classes that call the GraphQL endpoint, and the POJO that will contain the data returned by the server. The GraphQL endpoint can then be queried by using a simple call to a Java method (see sample below)
  • GraphQL Java server: it is based on graphql-java (listed here above). It generates all the boilerplate code. You'll only have to implement what's specific to your server, which are the joins between the GraphQL types. GraphQL Java Generator is available as a Maven Plugin. A Gradle plugin is coming soon. Please note that GraphQL Java Generator is an accelerator: the generated code doesn’t depend on any library specific to GraphQL Java Generator. So, it helps you to start building application based on graphql-java. Once the code is generated, you can decide to manually edit it as any standard java application, and get rid of GraphQL Java Generator. Of course you can, and should, according to us :), continue using GraphQL Java Generator when your projet evolves.

C# / .NET

Server

graphql-dotnet

Last Release1 month ago
Stars6k
LicenseMIT License

GraphQL for .NET

using System;
using System.Threading.Tasks;
using GraphQL;
using GraphQL.Types;
using GraphQL.SystemTextJson; // First add PackageReference to GraphQL.SystemTextJson
public class Program
{
public static async Task Main(string[] args)
{
var schema = Schema.For(@"
type Query {
hello: String
}
");
var json = await schema.ExecuteAsync(_ =>
{
_.Query = "{ hello }";
_.Root = new { Hello = "Hello World!" };
});
Console.WriteLine(json);
}
}

Hot Chocolate

Last Release1 week ago
Stars5k
LicenseMIT License

Hot Chocolate is an open-source GraphQL Server for .NET

Hot Chocolate takes the complexity away from building a fully-fledged GraphQL server and lets you focus on delivering the next big thing.

using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
WebHost
.CreateDefaultBuilder(args)
.ConfigureServices(services =>
services
.AddGraphQLServer()
.AddQueryType<Query>())
.Configure(builder =>
builder
.UseRouting()
.UseEndpoints(e => e.MapGraphQL()))
.Build()
.Run();
public class Query
{
public Hero GetHero() => new Hero();
}
public class Hero
{
public string Name => "Luke Skywalker";
}

graphql-net

Stars1k
LicenseMIT License

Convert GraphQL to IQueryable

Entity GraphQL

Last Release1 week ago
Stars369
LicenseMIT License

A GraphQL library for .NET Core. Easily expose you data model as a GraphQL API or bring together multiple data sources into a single GraphQL schema.

// expose an exisiting data model with ASP.NET & EF Core
public class Startup {
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<DemoContext>();
// Auto build a schema from DemoContext. Alternatively you can build one from scratch
services.AddGraphQLSchema<DemoContext>(options =>
{
// modify the schema (add/remove fields or types), add other services
});
}
public void Configure(IApplicationBuilder app, DemoContext db)
{
app.UseRouting();
app.UseEndpoints(endpoints =>
{
// defaults to /graphql endpoint
endpoints.MapGraphQL<DemoContext>();
});
}
}

NGraphQL

Stars37
LicenseMIT License

A set of packages for implementing high-performant GraphQL servers in .NET. Faithful implementation of official 2018 Specification. Features batched execution support (aka Data Loader); support for custom scalars; HTTP server based on ASP.NET Core; parsed query cache; modular API construction (equivalent of schema stiching); full introspection support; runtime metrics and quotas.

Client

Strawberry Shake

Last Release1 week ago
Stars5k
LicenseMIT License

Strawberry Shake is a open-source reactive GraphQL client for .NET

Strawberry Shake removes the complexity of state management and lets you interact with local and remote data through GraphQL.

You can use Strawberry Shake to:

  • Generate a C# client from your GraphQL queries.
  • Interact with local and remote data through GraphQL.
  • Use reactive APIs to interact with your state.
client.GetHero
.Watch(ExecutionStrategy.CacheFirst)
.Subscribe(result =>
{
Console.WriteLine(result.Data.Name);
})

GraphQL.Client

Last Release2 months ago
Stars1k
LicenseMIT License

A GraphQL Client for .NET.

ZeroQL

Last Release13 hours ago
Stars227
LicenseMIT License

ZeroQL is a open-source GraphQL client for C#

The ZeroQL is a high-performance C#-friendly GraphQL client. It supports Linq-like syntax, and doesn't require Reflection.Emit or expressions. As a result, at runtime provides performance very close to a raw HTTP call.

You can use ZeroQL to:

  • Generate a C# client from GraphQL schema.
  • Generate and execute graphql queries from your C# code.
  • Don't require writing GraphQL manually.
  • Supports .Net Core, .Net Framework, Xamarin, Unity apps.
var userId = 10;
var response = await qlClient.Query(q => q
.User(userId, o => new
{
o.Id,
o.FirstName,
o.LastName
}));

graphql-net-client

Stars94
LicenseMIT License

Basic example GraphQL client for .NET.

SAHB.GraphQLClient

Last Release3 years ago
Stars43
LicenseMIT License

GraphQL client which supports generating queries from C# classes

Python

Server

Graphene

Last Release6 months ago
Stars8k
LicenseMIT License

A Python library for building GraphQL APIs.

To run a Graphene hello world script:

pip install graphene

Then run python hello.py with this code in hello.py:

import graphene
class Query(graphene.ObjectType):
hello = graphene.String(name=graphene.String(default_value="World"))
def resolve_hello(self, info, name):
return 'Hello ' + name
schema = graphene.Schema(query=Query)
result = schema.execute('{ hello }')
print(result.data['hello']) # "Hello World"

There are also nice bindings for Relay, Django, SQLAlchemy, and Google App Engine.

Strawberry

Last Release1 week ago
Stars4k
LicenseMIT License

Strawberry is a Python library for implementing code first GraphQL servers using modern Python features like type hints.

Here's an example of a Strawberry hello world, first install the library:

pip install strawberry-graphql

Create an app.py file with this content:

import strawberry
@strawberry.type
class Query:
@strawberry.field
def hello(self, name: str = "World") -> str:
return f"Hello {name}"
schema = strawberry.Schema(query=Query)

Then run strawberry server app and you will have a basic schema server running on http://localhost:8000/.

Strawberry also has views for ASGI, Flask and Django and provides utilities like dataloaders and tracing.

Ariadne

Last Release4 days ago
Stars2k
LicenseBSD 3-Clause "New" or "Revised" License

Ariadne is a Python library for implementing GraphQL servers using schema-first approach. It supports both synchronous and asynchronous query execution, ships with batteries included for common GraphQL server problems like query cost validation or performance tracing and has simple API that is easy to extend or replace.

Ariadne can be installed with pip:

$ pip install ariadne

Minimal "Hello world" server example:

from ariadne import ObjectType, gql, make_executable_schema
from ariadne.asgi import GraphQL
type_defs = gql(
"""
type Query {
hello: String!
}
"""
)
query_type = ObjectType("Query")
@query_type.field("hello")
def resolve_hello(*_):
return "Hello world!"
schema = make_executable_schema(type_defs, query_type)
app = GraphQL(schema, debug=True)

Run the server with uvicorn:

$ pip install uvicorn
$ uvicorn example:app

Tartiflette

Last Release2 years ago
Stars1k
LicenseMIT License

A Python 3.6+ (asyncio) library for building GraphQL APIs.

To run a tartiflette hello world script:

pip install tartiflette

Then run python hello.py with this code in hello.py:

import asyncio
from tartiflette import Engine, Resolver
@Resolver("Query.hello")
async def resolver_hello(parent, args, ctx, info):
return "hello " + args["name"]
async def run():
tftt_engine = Engine("""
type Query {
hello(name: String): String
}
""")
result = await tftt_engine.execute(
query='query { hello(name: "Chuck") }'
)
print(result)
# {'data': {'hello': 'hello Chuck'}}
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(run())

There is also a nice HTTP wrapper.

Django Graphbox

Last Release3 weeks ago
Stars9
LicenseMIT License

Package for easy building a GraphQL API with basic CRUD operations for Django models.

A Quickstart for Django Graphbox:

  1. Install the package:
pip install django-graphbox
  1. Create a new Django project:
django-admin startproject myproject
  1. Create a new Django app:
cd myproject
python manage.py startapp myapp
  1. Define your Django models in myapp/models.py:
from django.db import models
class MyModel(models.Model):
name = models.CharField(max_length=100)
  1. Create and run migrations:
python manage.py makemigrations
python manage.py migrate
  1. Configure and Build your GraphQL Schema in myapp/schema.py:
from django_graphbox.builder import SchemaBuilder
from myapp.models import MyModel
builder = SchemaBuilder()
builder.add_model(MyModel)
query_class = builder.build_schema_query()
mutation_class = builder.build_schema_mutation()
  1. Create a main Schema in myproject/schema.py (In this main schema you can add your own queries and mutations):
import graphene
from myapp.schema import query_class, mutation_class
class Query(query_class, graphene.ObjectType):
pass
class Mutation(mutation_class, graphene.ObjectType):
pass
schema = graphene.Schema(query=Query, mutation=Mutation)
  1. Add the GraphQL view to your myproject/urls.py:
from django.urls import path
from graphene_file_upload.django import FileUploadGraphQLView
from django.views.decorators.csrf import csrf_exempt
from myproject.schema import schema
urlpatterns = [
path('graphql/', csrf_exempt(FileUploadGraphQLView.as_view(graphiql=True, schema=schema))),
]
  1. Run the server:
python manage.py runserver
  1. Open the GraphiQL interface at http://localhost:8000/graphql/ and start querying your API!

You can find advanced examples with authentication, filters, validations and more on github or pypi.

Client

GQL

Last Release1 month ago
Stars1k
LicenseMIT License

A GraphQL client in Python.

sgqlc

Stars487
LicenseISC License

A simple Python GraphQL client. Supports generating code generation for types defined in a GraphQL schema.

Ariadne Codegen

Last Release2 months ago
Stars175
LicenseBSD 3-Clause "New" or "Revised" License

Generate fully typed Python GraphQL client from any schema and queries.

Install Ariadne Codegen:

$ pip install ariadne-codegen

Create queries.graphql file:

mutation CreateToken($username: String!, $password: String!) {
createToken(username: $username, password: $password) {
token
errors {
field
message
}
}
}

Add [ariadne-codegen] section to your pyproject.toml:

[ariadne-codegen]
queries_path = "queries.graphql"
remote_schema_url = "http://example.com/graphql/"

Generate client:

$ ariadne-codegen

And use it in your Python projects:

from graphql_client import Client
with Client("http://example.com/graphql/") as client:
result = client.create_token(username="Admin", password="Example123)
if result.errors:
error = result.errors[0]
raise ValidationError({error.field: error.message})
auth_token = result.token

Simple GraphQL client for Python 2.7+.

Qlient

Last Release1 year ago
Stars44
LicenseMIT License

A fast and modern graphql client designed with simplicity in mind.

Here's an example of a qlient hello world.

first install the library:

pip install qlient

Create a swapi_client_example.py file with this content:

from qlient.http import HTTPClient, GraphQLResponse
client = HTTPClient("https://swapi-graphql.netlify.app/.netlify/functions/index")
res: GraphQLResponse = client.query.film(
# swapi graphql input fields
id="ZmlsbXM6MQ==",
# qlient specific
_fields=["id", "title", "episodeID"]
)
print(res.request.query) # query film($id: ID) { film(id: $id) { id title episodeID } }
print(res.request.variables) # {'id': 'ZmlsbXM6MQ=='}
print(res.data) # {'film': {'id': 'ZmlsbXM6MQ==', 'title': 'A New Hope', 'episodeID': 4}}

Close the file and run it using python:

python swapi_client_example.py

graphql-query

Last Release1 month ago
Stars40
LicenseMIT License

Complete GraphQL query string generation for python.

graphql_query is complete GraphQL query string builder for python. With graphql_query you can The documentation for graphql_query can be found at https://denisart.github.io/graphql-query/.

$ pip install graphql_query

Code for the simple query

{
hero {
name
}
}

it is

from graphql_query import Operation, Query
hero = Query(name="hero", fields=["name"])
operation = Operation(type="query", queries=[hero])
print(operation.render())
"""
query {
hero {
name
}
}
"""

For generation of the following query

query Hero($episode: Episode, $withFriends: Boolean!) {
hero(episode: $episode) {
name
friends @include(if: $withFriends) {
name
}
}
}

we have

from graphql_query import Argument, Directive, Field, Operation, Query, Variable
episode = Variable(name="episode", type="Episode")
withFriends = Variable(name="withFriends", type="Boolean!")
arg_episode = Argument(name="episode", value=episode)
arg_if = Argument(name="if", value=withFriends)
hero = Query(
name="hero",
arguments=[arg_episode],
fields=[
"name",
Field(
name="friends",
fields=["name"],
directives=[Directive(name="include", arguments=[arg_if])]
)
]
)
operation = Operation(
type="query",
name="Hero",
variables=[episode, withFriends],
queries=[hero]
)
print(operation.render())
"""
query Hero(
$episode: Episode
$withFriends: Boolean!
) {
hero(
episode: $episode
) {
name
friends @include(
if: $withFriends
) {
name
}
}
}
"""

Server

graphql-rust/juniper

Last Release1 month ago
Stars5k
LicenseOther

GraphQL server library for Rust

Async-graphql

Last Release1 year ago
Stars3k
LicenseApache License 2.0

Async-graphql is a high-performance server-side library that supports all GraphQL specifications.

use async_graphql::*;
struct Query;
#[Object]
impl Query {
/// Returns the sum of a and b
async fn add(&self, a: i32, b: i32) -> i32 {
a + b
}
}

Client

cynic

Last Release1 week ago
Stars318
LicenseMozilla Public License 2.0

A bring your own types GraphQL client for Rust

A client library for rust that generates queries from types you provide, verifying that the types match the shape of your schema.

It provides a generator to bootstrap types from existing GraphQL queries.

Usage example:

#[derive(cynic::QueryFragment, Debug)]
#[cynic(
schema_path = "../schemas/starwars.schema.graphql",
query_module = "query_dsl",
graphql_type = "Root",
argument_struct = "FilmArguments"
)]
struct FilmDirectorQuery {
#[arguments(id = &args.id)]
film: Option<Film>,
}
#[derive(cynic::QueryFragment, Debug)]
#[cynic(
schema_path = "../schemas/starwars.schema.graphql",
query_module = "query_dsl",
graphql_type = "Film"
)]
struct Film {
title: Option<String>,
director: Option<String>,
}
#[derive(cynic::FragmentArguments)]
struct FilmArguments {
id: Option<cynic::Id>,
}
fn main() {
use cynic::{QueryBuilder, http::ReqwestBlockingExt};
let query = FilmDirectorQuery::build(&FilmArguments {
id: Some("ZmlsbXM6MQ==".into()),
})
reqwest::blocking::Client::new()
.post("https://swapi-graphql.netlify.com/.netlify/functions/index")
.run_graphql(query)
.unwrap()
}
mod query_dsl {
cynic::query_dsl!("../schemas/starwars.schema.graphql");
}

gql_client

Stars47
LicenseMIT License

Minimal GraphQL client for Rust

Usage example

use gql_client::Client;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let endpoint = "https://graphqlzero.almansi.me/api";
let query = r#"
query AllPostsQuery {
posts {
data {
id
}
}
}
"#;
let client = Client::new(endpoint);
let data: AllPosts = client.query::<AllPosts>(query).await.unwrap();
println!("{:?}" data);
Ok(())
}

Ruby

Server

graphql-ruby

Last Release2 years ago
Stars5k
LicenseMIT License

A Ruby library for building GraphQL APIs.

To run a hello world script with graphql-ruby:

gem install graphql

Then run ruby hello.rb with this code in hello.rb:

require 'graphql'
class QueryType < GraphQL::Schema::Object
field :hello, String
def hello
"Hello world!"
end
end
class Schema < GraphQL::Schema
query QueryType
end
puts Schema.execute('{ hello }').to_json

There are also nice bindings for Relay and Rails.

Agoo

gemagoo
Stars1k
LicenseMIT License

A high performance web server with support for GraphQL. Agoo strives for a simple, easy to use API for GraphQL.

require 'agoo'
class Query
def hello
'hello'
end
end
class Schema
attr_reader :query
def initialize
@query = Query.new()
end
end
Agoo::Server.init(6464, 'root', thread_count: 1, graphql: '/graphql')
Agoo::Server.start()
Agoo::GraphQL.schema(Schema.new) {
Agoo::GraphQL.load(%^type Query { hello: String }^)
}
sleep
# To run this GraphQL example type the following then go to a browser and enter
# a URL of localhost:6464/graphql?query={hello}
#
# ruby hello.rb

Rails GraphQL

Last Release1 day ago
Stars156
LicenseMIT License

A Fresh new GraphQL server for Rails applications, with a focus on natural and Ruby-like DSL

require 'rails-graphql'
class GraphQL::AppSchema < GraphQL::Schema
query_fields do
field(:hello).resolve { 'Hello World!' }
end
end
puts GraphQL::AppSchema.execute('{ hello }')

Less is more! Please check it out the docs.

Swift / Objective-C

Server

Graphiti

Last Release2 months ago
Stars1k
LicenseMIT License

Swift library for building GraphQL schemas/types fast, safely and easily.

GraphZahl

Last Release2 years ago
Stars143
LicenseMIT License

Swift library for writing Declarative, Type-Safe GraphQL APIs with Zero Boilerplate.

Client

Apollo iOS

Last Release2 days ago
Stars4k
LicenseMIT License

A GraphQL client for iOS that returns results as query-specific Swift types, and integrates with Xcode to show your Swift source and GraphQL side by side, with inline validation errors.

SwiftGraphQL

Last Release3 weeks ago
Stars1k
LicenseMIT License

A GraphQL client that lets you forget about GraphQL.

SwiftGraphQL is a Swift code generator and a lightweight GraphQL client. It lets you create queries using Swift, and guarantees that every query you create is valid.

The library is centered around three core principles:

🚀 If your project compiles, your queries work. 🦉 Use Swift in favour of GraphQL wherever possible. 🌳 Your application model should be independent of your schema.

Here's a short preview of the SwiftGraphQL code

import SwiftGraphQL
// Define a Swift model.
struct Human: Identifiable {
let id: String
let name: String
let homePlanet: String?
}
// Create a selection.
let human = Selection.Human {
Human(
id: try $0.id(),
name: try $0.name(),
homePlanet: try $0.homePlanet()
)
}
// Construct a query.
let query = Selection.Query {
try $0.humans(human.list)
}
// Perform the query.
send(query, to: "http://swift-graphql.heroku.com") { result in
if let data = try? result.get() {
print(data) // [Human]
}
}

Graphaello

Last Release2 years ago
Stars494
LicenseMIT License

A Tool for Writing Declarative, Type-Safe and Data-Driven Applications in SwiftUI using GraphQL and Apollo

GraphQL iOS

Stars62
LicenseMIT License

An Objective-C GraphQL client for iOS.

GraphQLite iOS

Last Release4 months ago
Stars5
LicenseMIT License

GraphQLite iOS SDK is a toolkit to work with GraphQL servers easily. It also provides several other features to make life easier during iOS application development.

Elixir

Server

absinthe

Last Release2 years ago
Stars4k
LicenseOther

GraphQL implementation for Elixir.

graphql-elixir

Last Release7 years ago
Stars1k
LicenseOther

An Elixir implementation of Facebook's GraphQL.

Client

Neuron

Stars322
LicenseOther

A GraphQL client for Elixir

common_graphql_client

Last Release3 years ago
Stars43
LicenseMIT License

Elixir GraphQL Client with HTTP and WebSocket support

Scala

Server

Sangria

Last Release3 days ago
Stars2k
LicenseApache License 2.0

A Scala GraphQL library that supports Relay.

An example of a hello world GraphQL schema and query with sangria:

import sangria.schema._
import sangria.execution._
import sangria.macros._
val QueryType = ObjectType("Query", fields[Unit, Unit](
Field("hello", StringType, resolve = _ ⇒ "Hello world!")
))
val schema = Schema(QueryType)
val query = graphql"{ hello }"
Executor.execute(schema, query) map println

Caliban

Last Release2 weeks ago
Stars1k
LicenseApache License 2.0

Caliban is a functional library for building GraphQL servers and clients in Scala. It offers minimal boilerplate and excellent interoperability.

An example of a simple GraphQL schema and query with caliban:

import caliban._
import caliban.schema.Schema.auto._
// schema
case class Query(hello: String)
// resolver
val resolver = RootResolver(Query("Hello world!"))
val api = graphQL(resolver)
for {
interpreter <- api.interpreter
result <- interpreter.execute("{ hello }")
} yield result

Client

Caliban

Last Release2 weeks ago
Stars1k
LicenseApache License 2.0

Caliban is a functional library for building GraphQL servers and clients in Scala. It offers with client code generation and type-safe queries.

An example of defining a GraphQL query and running it with caliban:

// define your query using Scala
val query: SelectionBuilder[RootQuery, List[CharacterView]] =
Query.characters {
(Character.name ~ Character.nicknames ~ Character.origin)
.mapN(CharacterView)
}
import sttp.client3._
// run the query and get the result already parsed into a case class
val result = query.toRequest(uri"http://someUrl").send(HttpClientSyncBackend()).body

Flutter

Client

graphql

Last Release1 month ago
Stars3k
LicenseMIT License

A GraphQL client implementation in Flutter.

Ferry

Stars1k
LicenseMIT License

Ferry is a simple, powerful GraphQL Client for Flutter and Dart.

Clojure

Server

lacinia

Stars2k
LicenseOther

A full implementation of the GraphQL specification that aims to maintain external compliance with the specification.

graphql-clj

Stars282
LicenseEclipse Public License 1.0

A Clojure library that provides a GraphQL implementation.

Code that executes a hello world GraphQL query with graphql-clj:

(def schema "type QueryRoot {
hello: String
}")
(defn resolver-fn [type-name field-name]
(get-in {"QueryRoot" {"hello" (fn [context parent & rest]
"Hello world!")}}
[type-name field-name]))
(require '[graphql-clj.executor :as executor])
(executor/execute nil schema resolver-fn "{ hello }")

alumbra

Last Release6 years ago
Stars148
LicenseMIT License

A set of reusable GraphQL components for Clojure conforming to the data structures given in alumbra.spec.

(require '[alumbra.core :as alumbra]
'[claro.data :as data])
(def schema
"type Person { name: String!, friends: [Person!]! }
type QueryRoot { person(id: ID!): Person, me: Person! }
schema { query: QueryRoot }")
(defrecord Person [id]
data/Resolvable
(resolve! [_ _]
{:name (str "Person #" id)
:friends (map ->Person (range (inc id) (+ id 3)))}))
(def QueryRoot
{:person (map->Person {})
:me (map->Person {:id 0})})
(def app
(alumbra/handler
{:schema schema
:query QueryRoot}))
(defonce my-graphql-server
(aleph.http/start-server #'app {:port 3000}))
$ curl -XPOST "http://0:3000" -H'Content-Type: application/json' -d'{
"query": "{ me { name, friends { name } } }"
}'
{"data":{"me":{"name":"Person #0","friends":[{"name":"Person #1"},{"name":"Person #2"}]}}}

Client

regraph

Last Release1 year ago
Stars454
LicenseUnknown

A GraphQL client implemented in Clojurescript with support for websockets.

Haskell

Server

Morpheus GraphQL

Last Release9 months ago
Stars396
LicenseMIT License

A Haskell library for building GraphQL APIs.

Hello world example with morpheus-graphql:

# schema.gql
"""
A supernatural being considered divine and sacred
"""
type Deity {
name: String!
power: String @deprecated(reason: "no more supported")
}
type Query {
deity(name: String! = "Morpheus"): Deity!
}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
module API (api) where
import Data.ByteString.Lazy.Char8 (ByteString)
import Data.Morpheus (interpreter)
import Data.Morpheus.Document (importGQLDocument)
import Data.Morpheus.Types (RootResolver (..), Undefined (..))
import Data.Text (Text)
importGQLDocument "schema.gql"
rootResolver :: RootResolver IO () Query Undefined Undefined
rootResolver =
RootResolver
{ queryResolver = Query {deity},
mutationResolver = Undefined,
subscriptionResolver = Undefined
}
where
deity DeityArgs {name} =
pure
Deity
{ name = pure name,
power = pure (Just "Shapeshifting")
}
api :: ByteString -> IO ByteString
api = interpreter rootResolver

See morpheus-graphql-examples for more sophisticated APIs.

Mu-Haskell with Mu-GraphQL

Last Release3 years ago
Stars324
LicenseApache License 2.0

A Haskell library for building microservices (gRPC, HTTP) and GraphQL APIs.

Example implementation of a GraphQL server with type-level representation of the schema auto-generated:

{-# LANGUAGE DataKinds #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PartialTypeSignatures #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
-- imports omitted for brevity...
graphql "Library" "library.graphql" -- all the magic happens here! 🪄🎩
-- ... a bit more code...
libraryServer :: SqlBackend -> ServerT ObjectMapping i Library ServerErrorIO _
libraryServer conn =
resolver
( object @"Book"
( field @"id" bookId,
field @"title" bookTitle,
field @"author" bookAuthor,
field @"imageUrl" bookImage
),
object @"Author"
( field @"id" authorId,
field @"name" authorName,
field @"books" authorBooks
),
object @"Query"
( method @"authors" allAuthors,
method @"books" allBooks
),
object @"Mutation"
( method @"newAuthor" newAuthor,
method @"newBook" newBook
),
object @"Subscription"
(method @"allBooks" allBooksConduit)
)
where
bookId :: Entity Book -> ServerErrorIO Integer
bookId (Entity (BookKey k) _) = pure $ toInteger k
-- ... more resolvers...

See our docs for more information about how to build your own GraphQL server and the library example for a more end-to-end example that includes a client written in Elm!

graphql-w-persistent

Stars10
LicenseUnknown

Complete set of library tools to abstract relational database schemas with SQL, query with GraphQL, and return GraphQL results

One time setup: build schema, deploy as microservice or within server, query SQL database with GraphQL!

Client

morpheus-graphql-client

Last Release9 months ago
Stars396
LicenseMIT License

A strongly-typed GraphQL client implementation in Haksell.

C / C++

Tools

libgraphqlparser

Last Release6 years ago
Stars1k
LicenseMIT License

A GraphQL query language parser in C++ with C and C++ APIs.

Elm

Client

dillonkearns/elm-graphql

Stars1k
LicenseBSD 3-Clause "New" or "Revised" License

Library and command-line code generator to create type-safe Elm code for a GraphQL endpoint.

OCaml / Reason

Server

ocaml-graphql-server

Last Release1 year ago
Stars1k
LicenseMIT License

GraphQL server library for OCaml and Reason

Erlang

Server

graphql-erlang

Last Release5 years ago
Stars312
LicenseOther

GraphQL implementation in Erlang.

Ballerina

Server

ballerina-graphql

Last Release4 months ago
Stars143
LicenseApache License 2.0

The Ballerina Standard Library Package for write GraphQL services.

To run a ballerina-graphql hello world server:

  • Download and install Ballerina Language
  • Then run bal run graphql_service.bal to run the service, with this code in the graphql_service.bal file:
import ballerina/graphql;
service /graphql on new graphql:Listener(9090) {
resource function get hello() returns string {
return "Hello, world!";
}
}

Features#

  • Built with Ballerina service and listener model, which are first-class citizens in Ballerina
  • Supports subscriptions over websocket (No additional libraries needed)
  • Supports file upload
  • Built-in GraphiQL client

Client

ballerina-graphql

Last Release4 months ago
Stars143
LicenseApache License 2.0

The Ballerina Standard Library Package for consume GraphQL services.

To run a ballerina-graphql client:

  • Download and install Ballerina Language
  • Then run bal run graphql_client.bal to run the service, with this code in the graphql_client.bal file:
import ballerina/graphql;
import ballerina/io;
type Response record {
record { string hello; } data;
};
public function main() returns error? {
graphql:Client helloClient = check new ("localhost:9090/graphql");
string document = "{ hello }";
Response response = check helloClient->execute(document);
io:println(response.data.hello);
}

Features#

  • Dependently-typed response retrieval with Ballerina type inferring
  • Custom client generation support

Julia

Client

Diana.jl

Last Release1 year ago
Stars112
LicenseMIT License

A Julia GraphQL server implementation.

GraphQLClient.jl

Last Release1 year ago
Stars45
LicenseOther

A Julia GraphQL client for seamless integration with a GraphQL server

  • Querying, mutating and subscribing without manual writing of query strings (unless you want to!)
  • Deserializing responses directly into Julia types
  • Construction of Julia types from GraphQL objects
  • Using introspection to help with querying

Quickstart#

Install with Julia's package manager

using Pkg; Pkg.add("GraphQLClient")
using GraphQLClient

Connect to a server

client = Client("https://countries.trevorblades.com")

Build a Julia type from a GraphQL object

Country = GraphQLClient.introspect_object(client, "Country")

And query the server, deserializing the response into this new type

response = query(client, "countries", Vector{Country}, output_fields="name")

Alternatively write the query string manually

query_string = """
{
countries{
name
}
}"""
response = GraphQLClient.execute(client, query_string)

R

Server

ghql

Last Release3 years ago
Stars141
LicenseOther

General purpose GraphQL R client

Groovy

Server

gorm-graphql

Last Release1 month ago
Stars80
LicenseApache License 2.0

An automatic GraphQL schema generator for GORM

Core Library - The GORM GraphQL library provides functionality to generate a GraphQL schema based on your GORM entities. In addition to mapping domain classes to a GraphQL schema, the core library also provides default implementations of "data fetchers" to query, update, and delete data through executions of the schema.

Grails Plugin - In a addition to the Core Library, the GORM GraphQL Grails Plugin:

  • Provides a controller to receive and respond to GraphQL requests through HTTP, based on their guidelines.

  • Generates the schema at startup with spring bean configuration to make it easy to extend.

  • Includes a GraphiQL browser enabled by default in development. The browser is accessible at /graphql/browser.

  • Overrides the default data binder to use the data binding provided by Grails

  • Provides a trait to make integration testing of your GraphQL endpoints easier

See the documentation for more information.

GQL

Last Release1 year ago
Stars47
LicenseApache License 2.0

GQL is a Groove library for GraphQL

Perl

Server

graphql-perl

Stars70
LicenseUnknown

A Perl port of GraphQL reference implementation

D

Server

graphqld

Last Release1 month ago
Stars34
LicenseGNU Lesser General Public License v3.0

A GraphQL implementaiton for the D Programming Language.

Gateways / Supergraphs

WunderGraph

Last Release3 weeks ago
Stars2k
LicenseApache License 2.0

WunderGraph is an open-source GraphQL Gateway that is able to compose Apollo Federation, GraphQL, REST APIs, Databases, Kafka and more.

WunderGraph composes all your APIs into a single unified GraphQL API and allows you to expose your Graph as a secure and type-safe JSON-RPC API.

To get started with WunderGraph, you can use create-wundergraph-app to bootstrap a new project:

npx create-wundergraph-app my-project -E nextjs-swr

On the client side, WunderGraph's JSON-RPC API integrates very well with frameworks like Next.js, SWR and React Query, while one the backend, we're able to leverage the power of "Server-Side-Only GraphQL". Handle authentication, authorization, validation, joins and more right in the Query Layer.

mutation (
$name: String! @fromClaim(name: NAME)
$email: String! @fromClaim(name: EMAIL)
$message: String! @jsonSchema(pattern: "^[a-zA-Z 0-9]+$")
) {
createOnepost(
data: {
message: $message
user: {
connectOrCreate: {
where: { email: $email }
create: { email: $email, name: $name }
}
}
}
) {
id
message
user {
id
name
}
}
}

The Query above requires the user to be authenticated, injects the user's name and email from the JWT token and validates the message against a JSON Schema.

Here's another example showcasing how we can use Server-Side GraphQL with WunderGraph's unique join capabilities, composing data from two different APIs into a single GraphQL response.

query (
$continent: String!
# the @internal directive removes the $capital variable from the public API
# this means, the user can't set it manually
# this variable is our JOIN key
$capital: String! @internal
) {
countries_countries(filter: { continent: { eq: $continent } }) {
code
name
# using the @export directive, we can export the value of the field `capital` into the JOIN key ($capital)
capital @export(as: "capital")
# the _join field returns the type Query!
# it exists on every object type so you can everywhere in your Query documents
_join {
# once we're inside the _join field, we can use the $capital variable to join the weather API
weather_getCityByName(name: $capital) {
weather {
temperature {
max
}
summary {
title
description
}
}
}
}
}
}

The full example can be found on GitHub.

General

quicktype

Stars11k
LicenseApache License 2.0

Generate types for GraphQL queries in TypeScript, Swift, golang, C#, C++, and more.

GraphQL Code Generator

Last Release6 months ago
Stars11k
LicenseMIT License

GraphQL code generator with flexible support for custom plugins and templates like Typescript (frontend and backend), React Hooks, resolvers signatures and more.

Schemathesis

Last Release1 week ago
Stars2k
LicenseMIT License

A modern API testing tool for web applications built with Open API and GraphQL specifications.

Run Schemathesis via Docker against your GraphQL endpoint:

docker run schemathesis/schemathesis \
run https://your.app.com/graphql

Schemathesis will generate queries matching your GraphQL schema and catch server crashes automatically. Generated queries have arbitrary depth and may contain any subset of GraphQL types defined in the input schema. They expose edge cases in your code that are unlikely to be found otherwise.

Note that you can write your app in any programming language; the tool will communicate with it over HTTP.

For example, running the command above against https://bahnql.herokuapp.com/graphql uncovers that running the { search(searchTerm: "") { stations { name } } } query leads to a server error:

{
"errors": [
{
"message": "Cannot read property 'city' of undefined",
"locations": [
{
"line": 1,
"column": 28
}
],
"path": [
"search",
"stations"
]
}
],
"data": null
}

Microcks

Stars1k
LicenseApache License 2.0

Open source Kubernetes-native tool for API Mocking and Testing

Microcks is a platform for turning your API and microservices assets - GraphQL schemas, OpenAPI specs, AsyncAPI specs, gRPC protobuf, Postman collections, SoapUI projects_ - into live simulations in seconds.

It also reuses these assets for running compliance and non-regression tests against your API implementation. We provide integrations with Jenkins, GitHub Actions, Tekton and many others through a simple CLI.

gqt

Stars453
LicenseMIT License

Build and execute GraphQL queries in the terminal.

Run gqt against your GraphQL endpoint. Build your query in an intuitive TUI and execute it. The response from the server is written to standard output.

gqt -e https://your.app.com/graphql

GraphQL Armor

Last Release1 month ago
Stars446
LicenseMIT License

The missing GraphQL security layer for Apollo GraphQL and Yoga / Envelop servers.

Services#

Webiny allows you to quickly build GraphQL APIs on top of AWS Lambda and DynamoDB with built-in scaffolds. Webiny also includes a ready-made headless GraphQL CMS for a no-code experience.

Typetta is an open-source ORM written in TypeScript that aims to allow seamless access to data in a typed fashion to all main SQL databases (MySQL, PostgreSQL, Microsoft SQL Server, SQLLite3, CockroachDB, MariaDB, Oracle & Amazon Redshift) and also to the NoSQL database MongoDB.

Tyk is a lightweight Open Source API Management Gateway that has built a Full API Life-Cycle Management around GraphQL with its own GraphQL engine that is written in Golang. Tyk supports schema stitching of multiple GraphQL and/or REST APIs through Universal Data Graph (UDG) as well as GraphQL Federation and GraphQL Subscription.

Create a serverless GraphQL API based on your data sources (REST & Databases), Third-Party APIs, or any combination. Instead of writing a GraphQL server yourself, you can define everything declaratively by writing GraphQL schemas. For more information, go to https://www.stepzen.com/.

A SaaS (Software as a Service) content management system that allows you to create your content with powerful editing tools and access it from anywhere with a GraphQL or REST API.

Next-generation Node.js and TypeScript ORM with a built-in data loader, which can be used when building GraphQL backends. For more information, go to https://www.prisma.io/graphql

A robust multi-protocol API client with features like API scripting, automation, collaborative workspaces, and comprehensive support for testing and developing GraphQL APIs.

A GraphQL analaytics and monitoring Service to find functional and performance issues.

A headless CMS (Content Management System) that combines powerful content personalisation and scheduling capabilities with a modern content editing experience and a blazing fast GraphQL/REST content delivery API.

Insomnia is an open-source, cross-platform API Client for GraphQL, REST, and gRPC. Insomnia combines an easy-to-use interface with advanced functionality like authentication helpers, code generation, and environment variables.

Hygraph is the federated content platform that allows true composability of your stack. Integrate all your services with a unique content federation approach and distribute content from anywhere - to anywhere using a single, powerful GraphQL API.

Hasura connects to your databases & microservices and instantly gives you a production-ready GraphQL API.

Fast and free security scan to run a dozen of tests on a GraphQL endpoint. No login is required.

graphapi® is a secure low-code GraphQL-as-a-service platform. Based on the input data model, it auto-generates the GraphQL schema, all resolvers, and the database stack. Additionally, it provides a user interface allowing teams to manage their data. For more information, go to https://graphapi.com.

GraphQL backends made easy. Build your backend declaratively using a schema-first approach. Accelerate development and reduce boilerplate code by leveraging powerful directives and scalars.

Create an instant GraphQL backend by importing a gql schema. The database will create relations and indexes for you, so you'll be ready to query in seconds, without writing any database code. Serverless pricing, free to get started.

Live GraphQL Security & Compliance. Ensure your GraphQL endpoints are production-ready. During development. Without needed configuration. Supports every language and framework. Free to get started.

A Java library that can expose a JPA annotated data model as a GraphQL service over any relational database.

Dgraph

Dgraph is a native GraphQL database with a graph backend. This means Dgraph is not an interface on top of an existing database like Postgres but is actually designed from the ground-up for GraphQL. It is optimized for speed and performance, depending on multiple computer science breakthroughs to get the best result. Dgraph Cloud is a fully managed GraphQL backend service that lets you iterate faster, without worrying about your infrastructure.

Install Steps if running locally on linux not on Dgraph Cloud:

docker pull dgraph/standalone
mkdir -p ~/dgraph
docker run -it -p 5080:5080 -p 6080:6080 -p 8080:8080 \
-p 9080:9080 -p 8000:8000 -v ~/dgraph:/dgraph --name dgraph \
dgraph/standalone:master

Set your GraphQL Schema:

touch schema.graphql
nano schema.graphql
type Product {
id: ID!
name: String! @id
reviews: [Review] @hasInverse(field: about)
}
type Customer {
username: String! @id
reviews: [Review] @hasInverse(field: by)
}
type Review {
id: ID!
about: Product!
by: Customer!
comment: String @search(by: [fulltext])
rating: Int @search
}
curl -X POST localhost:8080/admin/schema --data-binary '@schema.graphql'

Fire up your favorite GraphQL Client pointed at http://localhost:8080/graphql and run mutations and queries

mutation {
addProduct(input: [{ name: "Dgraph" }, { name: "Dgraph Cloud" }]) {
product {
id
name
}
}
addCustomer(input: [{ username: "TonyStark" }]) {
customer {
username
}
}
}
mutation {
addReview(
input: [
{
by: { username: "TonyStark" }
about: { name: "Dgraph" }
comment: "Fantastic, easy to install, worked great. Best GraphQL server available"
rating: 10
}
]
) {
review {
id
comment
rating
by {
username
}
about {
id
name
}
}
}
}
query {
queryReview(filter: { comment: { alloftext: "server easy install" }, rating: { gt: 5 } }) {
comment
by {
username
reviews(order: { desc: rating }, first: 10) {
about {
name
reviews(order: { asc: rating, first: 5 }) {
by { username }
comment
rating
}
}
rating
}
}
about {
name
}
}
}

A feature-rich GraphQL IDE by ChilliCream that let's you explore, manage, and test your GraphQL APIs. Check it out here.

Fully managed GraphQL backend based on open source Parse Platform. Store and query relational data, run cloud functions and more over GraphQL API. Free to get started.

Fully managed GraphQL service with realtime subscriptions, offline programming & synchronization, and enterprise security features as well as fine grained authorization controls.

A cloud service that helps you build, validate, monitor and secure your organizations data graph.

Apache APISIX is a dynamic, real-time, high-performance API gateway providing rich traffic management features such as load balancing, dynamic upstream, canary release, observability, etc. As a cloud-native API gateway, Apache APISIX already can support GraphQL syntax at the beginning of its design. Efficiently matching GraphQL statements carried in requests can filter out abnormal traffic to further ensure security. For more information, please visit How to Use GraphQL with API Gateway Apache APISIX

A GraphQL API to query and mutate data across APIs like Salesforce, HubSpot, Microsoft Dynamics, Pipedrive, and many more.

An alternative to Postman that supports editing GraphQL queries directly and autoload your GraphQL schema.

Want to improve this page? See the docs here.