GraphQL

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

JavaScript

Server

GraphQL.js

Last Release3 weeks ago
Stars17k
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 root = { hello: () => 'Hello world!' };
graphql(schema, '{ hello }', root).then((response) => {
console.log(response);
});

Apollo Server

Last Release2 weeks ago
Stars11k
LicenseMIT License

A set of GraphQL server packages from Apollo that work with various Node.js HTTP frameworks (Express, Connect, Hapi, Koa etc).

To run a hello world server with apollo-server-express:

npm install apollo-server-express express

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

const express = require('express');
const { ApolloServer, gql } = require('apollo-server-express');
const typeDefs = gql`
type Query {
hello: String
}
`;
const resolvers = {
Query: {
hello: () => 'Hello world!',
},
};
const server = new ApolloServer({ typeDefs, resolvers });
const app = express();
server.applyMiddleware({ app });
app.listen({ port: 4000 }, () =>
console.log('Now browse to http://localhost:4000' + server.graphqlPath)
);

Apollo Server also supports all Node.js HTTP server frameworks: Express, Connect, HAPI, Koa and NestJs.

Express GraphQL

Last Release4 months ago
Stars6k
LicenseMIT License

The reference implementation of a GraphQL API server over an Express webserver. You can use this to run GraphQL in conjunction with a regular Express webserver, or as a standalone GraphQL server.

To run an express-graphql hello world server:

npm install express express-graphql graphql

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

var express = require('express');
var { graphqlHTTP } = require('express-graphql');
var { buildSchema } = require('graphql');
var schema = buildSchema(`
type Query {
hello: String
}
`);
var root = { hello: () => 'Hello world!' };
var app = express();
app.use('/graphql', graphqlHTTP({
schema: schema,
rootValue: root,
graphiql: true,
}));
app.listen(4000, () => console.log('Now browse to localhost:4000/graphql'));

graphql-yoga

Last Release1 year ago
Stars6k
LicenseMIT License

Fully-featured GraphQL Server with focus on easy setup, performance & great developer experience

  • Sensible defaults & includes everything you need with minimal setup.
  • Built-in support for GraphQL subscriptions using WebSockets.
  • Works with all GraphQL clients (Apollo, Relay...) and fits seamless in your GraphQL workflow.

To run a hello world server with graphql-yoga:

npm install graphql-yoga

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

import { GraphQLServer } from 'graphql-yoga'
// ... or using "require()"
// const { GraphQLServer } = require('graphql-yoga')
const typeDefs = `
type Query {
hello(name: String): String!
}
`;
const resolvers = {
Query: {
hello: (_, { name }) => `Hello ${name || 'World'}`,
},
};
const server = new GraphQLServer({ typeDefs, resolvers })
server.start(() => console.log('Server is running on localhost:4000'))

GraphQL Helix

Stars115
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.

Client

Apollo Client

Last Release2 months ago
Stars15k
LicenseMIT License

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

AWS Amplify

Last Release4 days ago
Stars8k
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.

GraphQL Request

Last Release1 day ago
Stars3k
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.

Relay

Last Release1 day ago
Stars15k
LicenseMIT License

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

urql

npmurql
Last Release4 days ago
Stars5k
LicenseMIT License

A highly customizable and versatile GraphQL client for React.

graphqurl

Stars2k
LicenseApache License 2.0

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

Lokka

Stars2k
LicenseMIT License

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

nanogql

Last Release2 years ago
Stars402
LicenseMIT License

Tiny GraphQL client library using template strings.

Grafoo

Last Release1 year ago
Stars263
LicenseMIT License

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

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

Tools

GraphiQL

Last Release4 weeks ago
Stars11k
LicenseMIT License

An interactive in-browser GraphQL IDE.

GraphQL Code Generator

Last Release1 week ago
Stars6k
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
Stars4k
LicenseMIT License

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

GraphQL CLI

Last Release1 month ago
Stars2k
LicenseMIT License

A command line tool for common GraphQL development workflows.

GraphQL Config

Last Release9 minutes ago
Stars1k
LicenseMIT License

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

GraphQL Inspector

Last Release3 weeks ago
Stars1k
LicenseMIT License

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

Postgraphile

Last Release3 weeks ago
Stars10k
LicenseMIT License

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

GraphQL Mesh

Last Release5 days ago
Stars1k
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.

GraphQL Scalars

Last Release1 month ago
Stars1k
LicenseMIT License

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

SOFA

Last Release2 months ago
Stars1k
LicenseMIT License

Generate REST API from your GraphQL API.

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

GraphQL-WS

Last Release2 days ago
Stars162
LicenseMIT License

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

GraphQL-ESLint

Last Release6 days ago
Stars77
LicenseMIT License

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

GraphQL Live Query

Last Release4 days ago
Stars60
LicenseMIT License

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

GraphQL Modules

Last Release2 months ago
Stars1k
LicenseMIT License

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

Server

graphql-go

Last Release9 months ago
Stars7k
LicenseMIT License

An implementation of GraphQL for Go / Golang.

99designs/gqlgen

Last Release1 month ago
Stars5k
LicenseMIT License

Go generate based graphql server library.

graph-gophers/graphql-go

Stars4k
LicenseBSD 2-Clause "Simplified" License

An active implementation of GraphQL in Golang (was https://github.com/neelance/graphql-go).

samsarahq/thunder

Last Release1 year ago
Stars1k
LicenseMIT License

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

graphql-relay-go

Stars362
LicenseMIT License

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

appointy/jaal

Last Release7 months ago
Stars55
LicenseMIT License

Develop spec compliant GraphQL servers in Go.

Client

machinebox/graphql

Last Release2 years ago
Stars1k
LicenseApache License 2.0

An elegant low-level HTTP client for GraphQL.

graphql

Stars419
LicenseMIT License

A GraphQL client implementation in Go.

Tools

super-graph

Last Release5 months ago
Stars1k
LicenseApache License 2.0

An instant GraphQL to SQL compiler. Use as a standalone service or a Go library

PHP

Server

API Platform

Last Release2 months ago
Stars6k
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 Release2 months ago
Stars4k
LicenseMIT License

A PHP port of GraphQL reference implementation

WPGraphQL

Last Release1 day ago
Stars3k
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 Release2 weeks ago
Stars2k
LicenseMIT License

A GraphQL server for Laravel

Siler

Last Release1 month 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 Release2 months ago
Stars1k
LicenseMIT License

A GraphQL server for Symfony

Railt

Last Release1 year ago
Stars343
LicenseMIT License

A PHP GraphQL Framework.

GraphQLite

Last Release3 months ago
Stars340

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...

graphql-relay-php

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

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

GraphQL API for WordPress

Last Release1 month ago
Stars121
LicenseGNU General Public License v2.0

A GraphQL server for WordPress

GraPHPinator

Last Release2 hours ago
Stars7
LicenseMIT License

A GraphQL implementation for modern PHP

serge

Stars1
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.

Python

Server

Graphene

Last Release3 weeks ago
Stars6k
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.

Ariadne

Last Release3 months ago
Stars1k
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

It ships with many GraphQL server implementations, enabling easy experimentation:

from ariadne import ObjectType, QueryType, gql, make_executable_schema
from ariadne.asgi import GraphQL
# Define types using Schema Definition Language (https://graphql.org/learn/schema/)
# Wrapping string in gql function provides validation and better error traceback
type_defs = gql("""
type Query {
hello: String!
}
""")
# Bind resolver functions to Query's fields using QueryType
query_type = QueryType()
# Resolvers are simple python functions
@query_type.field("hello")
def resolve_hello(*_):
return "Hello world!"
# Create executable GraphQL schema
schema = make_executable_schema(type_defs, query_type)
# Create an ASGI app using the schema, running in debug mode
app = GraphQL(schema, debug=True)

Above server can be ran with uvicorn:

pip install uvicorn
uvicorn example:app

Tartiflette

Last Release6 months 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.

Client

GQL

Last Release2 weeks ago
Stars1k
LicenseMIT License

A GraphQL client in Python.

sgqlc

Last Release4 months ago
Stars249
LicenseISC License

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

Simple GraphQL client for Python 2.7+.

Java / Kotlin

Server

graphql-java

Last Release5 months ago
Stars5k
LicenseMIT License

A Java library for building GraphQL APIs.

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} schema{query: Query}";
SchemaParser schemaParser = new SchemaParser();
TypeDefinitionRegistry typeDefinitionRegistry = schemaParser.parse(schema);
RuntimeWiring runtimeWiring = new RuntimeWiring()
.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 more information on setup.

graphql-kotlin

Last Release2 weeks ago
Stars1k
LicenseApache License 2.0

A set of libraries for running GraphQL server in Kotlin.

Client

Apollo Android

Last Release6 days ago
Stars3k
LicenseMIT License

A strongly-typed, caching GraphQL client for Android, written in Java.

Nodes

Last Release1 year ago
Stars268
LicenseApache License 2.0

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

Tools

GraphQL Java Generator

Stars3
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 Release2 days ago
Stars4k
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 Release8 hours ago
Stars2k
LicenseMIT License

GraphQL Server for .NET core and .NET classic

graphql-net

Stars1k
LicenseMIT License

Convert GraphQL to IQueryable

Entity GraphQL

Stars187
LicenseMIT License

.NET Core GraphQL library. Compiles to IQueryable to easily expose a schema from an existing data model (E.g. from an Entity Framework data model)

Client

GraphQL.Client

Last Release1 month ago
Stars374
LicenseMIT License

A GraphQL Client for .NET.

graphql-net-client

Stars85
LicenseMIT License

Basic example GraphQL client for .NET.

SAHB.GraphQLClient

Last Release6 months ago
Stars32
LicenseMIT License

GraphQL client which supports generating queries from C# classes

Ruby

Server

graphql-ruby

Last Release2 weeks 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
graphql_name 'Query'
field :hello do
type types.String
resolve -> (obj, args, ctx) { '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
Last Release1 week ago
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

Swift / Objective-C

Server

Caliban

Last Release2 weeks ago
Stars1k
LicenseApache License 2.0

Caliban is a purely functional library for building GraphQL servers and clients in Scala

An example of a GraphQL schema and query with caliban:

case class Character(name: String, age: Int)
def getCharacters(): List[Character] = ???
def getCharacter(name: String): Option[Character] = ???
// schema
case class CharacterName(name: String)
case class Queries(characters: List[Character],
character: CharacterName => Option[Character])
// resolver
val queries = Queries(getCharacters, args => getCharacter(args.name))
import caliban.GraphQL.graphQL
import caliban.RootResolver
val api = graphQL(RootResolver(queries))
for {
interpreter <- api.interpreter
} yield interpreter
case class GraphQLResponse[+E](data: ResponseValue, errors: List[E])
val query = """
{
characters {
name
}
}"""
for {
result <- interpreter.execute(query)
_ <- zio.console.putStrLn(result.data.toString)
} yield ()

Graphiti

Last Release1 month ago
Stars365
LicenseMIT License

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

GraphZahl

Last Release2 months ago
Stars103
LicenseMIT License

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

Client

Apollo iOS

Last Release3 weeks ago
Stars3k
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.

Caliban

Last Release2 weeks ago
Stars1k
LicenseApache License 2.0

Functional GraphQL library for Scala, with client code generation and type-safe queries.

Graphaello

Last Release1 month ago
Stars230
LicenseMIT License

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

GraphQL iOS

Stars57
LicenseOther

An Objective-C GraphQL client for iOS.

Elixir

Server

absinthe

Last Release2 months ago
Stars3k
LicenseOther

GraphQL implementation for Elixir.

graphql-elixir

Last Release4 years ago
Stars1k
LicenseOther

An Elixir implementation of Facebook's GraphQL.

Client

Neuron

Stars221
LicenseOther

A GraphQL client for Elixir

common_graphql_client

Last Release6 months ago
Stars27
LicenseMIT License

Elixir GraphQL Client with HTTP and WebSocket support

Rust

Server

graphql-rust/juniper

Last Release11 months ago
Stars3k
LicenseBSD 2-Clause "Simplified" License

GraphQL server library for Rust

Async-graphql

Last Release3 days ago
Stars1k
LicenseOther

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
}
}

Flutter

Client

graphql

Last Release1 week ago
Stars2k
LicenseMIT License

A GraphQL client implementation in Flutter.

Clojure

Server

lacinia

Last Release3 years ago
Stars1k
LicenseOther

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

graphql-clj

Stars278
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 Release3 years ago
Stars150
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 Release2 months ago
Stars351

A GraphQL client implemented in Clojurescript with support for websockets.

Scala

Server

Sangria

Last Release1 month 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

C / C++

Tools

libgraphqlparser

Last Release3 years ago
Stars1k
LicenseMIT License

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

Elm

Client

dillonkearns/elm-graphql

Last Release6 days ago
Stars1k
LicenseOther

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

Haskell

Server

Morpheus GraphQL

Last Release1 week ago
Stars254
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.

Client

morpheus-graphql-client

Last Release1 week ago
Stars254
LicenseMIT License

A strongly-typed GraphQL client implementation in Haksell.

Erlang

Server

graphql-erlang

Last Release2 years ago
Stars273
LicenseOther

GraphQL implementation in Erlang.

Groovy

Server

gorm-graphql

Last Release7 months ago
Stars69
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
Stars40
LicenseApache License 2.0

GQL is a Groove library for GraphQL

R

Server

ghql

Last Release8 months ago
Stars86
LicenseOther

General purpose GraphQL R client

Julia

Client

Diana.jl

Last Release1 year ago
Stars63
LicenseMIT License

A Julia GraphQL server implementation.

Perl

Server

graphql-perl

Stars50

A Perl port of GraphQL reference implementation

D

Server

graphqld

Last Release5 days ago
Stars20
LicenseGNU Lesser General Public License v3.0

A GraphQL implementaiton for the D Programming Language.

Tools#

GraphQL Code Generator

Last Release1 week ago
Stars6k
LicenseMIT License

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

quicktype

Stars6k
LicenseApache License 2.0

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

Services#

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

A cloud service for monitoring the performance and usage of your GraphQL backend.

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.

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

A BaaS (Backend as a Service) that sets you up with a GraphQL backend as well as tools for content editors to work with the stored data.

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

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.

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

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

An HTTP Client that supports editing GraphQL queries.

A BaaS (Backend as a Service) providing a GraphQL backend for your applications with a powerful web ui for managing your database and stored data.

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.