Fork me on GitHub
Overview

GraphQL-IO Server Java is an opinionated MIT-licensed GraphQL-based network communication framework for Java. The aim of GraphQl IO java is to provide the server-side implementation of original GraphQL-IO. The server-side runs under Java 8.

While GraphQL is just a formal language specification and GraphQL.js is a reference implementation of a corresponding execution engine, GraphQL-IO is an entire all-in-one GraphQL-based network communication solution for both client and server.

It integrates the necessary third-party libraries, provides a convenient and flexible API and especially supports real-time updates of GraphQL queries (aka GraphQL subscriptions) over a high-performance, framed, and optionally compressed, WebSocket channel.

Technologies

On the server-side, GraphQL-IO it is based on the GraphQL engine GraphQL.js, the GraphQL schema execution library GraphQL-Tools, the GraphQL type definition library GraphQL-Tools-Types, the GraphQL subscription management library GraphQL-Tools-Subscribe, the network communication framework Netty, the WebSocket integration plugin Netty-Plugin-WebSocket, the underlying WebSocket frame library WebSocket-Framed and the GraphiQL integration plugin Netty-Plugin-GraphiQL*.

For details on how these libraries are itegrated and play together, please see the Architecture page.

Sample

A Hello World sample for GraphQL-IO Server Java can look like the following. For more elaborate examples, check out the GraphQL-IO Server Samples

Hello World Java Server:

@SpringBootApplication public class SampleHelloWorldApplication implements ApplicationRunner { @Autowired private GsServer gsServer; @Autowired SampleHelloWorldResolver helloWorldResolver; public static void main(String[] args) { SpringApplication.run(SampleHelloWorldApplication.class, args); } public void run(ApplicationArguments args) throws Exception { gsServer.registerGraphQLResolver(helloWorldResolver); gsServer.start(); } }

Architecture

As mentioned on the Overview page, GraphQL-IO Server Java is primarily the glue between a dozen GraphQL partial solutions and as such is actually an extensive integration effort. The following diagram shows the Functional View of the GraphQL-IO architecture for the and server-side.

API Documentation

GraphQL-IO Java has an simple Application Programming Interface (API) for the GraphQL-IO Java Server.

To see most of the API functionality in practice, check out the GraphQL-IO Samples.