In a recent post on the Netflix TechBlog, the company announced it was releasing its Domain Graph Service (DGS) framework as open source, making it available to the Java and GraphQL communities. Netflix had only decided in 2019 to adopt a federated GraphQL architecture that would integrate with its existing system for logging, tracing and other metrics.
The resulting DGS framework relies on Netflix’s Spring boot-based backend infrastructure and the graphql-java library. It was originally intended only for internal purposes at Netflix, and has apparently since survived in production use as well. However, its modular structure does not limit the use of the DGS framework to the Netflix architecture alone, but also makes it useful beyond that – especially with regard to making it easier for developers to implement independent as well as federated GraphQL services.
With GraphQL into the Open Source Community
The Facebook-derived API query language GraphQL has been an open source project since 2015, and has since enjoyed growing popularity in microservice architectures and for serverless applications. Under the Linux Foundation umbrella, the query language will provide a vendor-neutral home for the community in the future. As an alternative to the programming paradigm REST (Representational State Transfer), GraphQL relies on queries in JSON-like form, which are handled as far as possible without unnecessary server roundtrips. The GraphQL API is also represented by a schema that describes the form of query and mutation operations, along with their associated types and fields.
Schematic overview of the DGS framework including Netflix and OSS modules
Compared to REST, GraphQL is not only more flexible, but also more powerful, according to the Netflix developers. Users have the choice to either create a suitable API schema in advance with the GraphQL Schema Language as a file or to create it via code definitions at runtime. The DGS framework supports both approaches, but Netflix prefers the so-called schema-first approach because it offers decisive advantages from the developer’s point of view. On the one hand, it is easier to integrate a schema file into the tooling and on the other hand, it is easier to ensure backward compatibility, which is critical in modern GraphQL architectures, because incompatible changes in schema diffs are easier to detect, says the blog entry.
More details on the Domain Graph Service framework and the scope of the components now released as open source, as well as an example of a simple schema, can be found in the Netflix TechBlog post. If you are looking for more detailed information, you should have a look at the documentation in the GitHub repository of the DGS framework.