How Netflix’s Open‑Source DGS Framework Simplifies Java GraphQL Development

Netflix’s Domain Graph Service (DGS) framework, now open‑sourced, provides a Spring Boot‑based, annotation‑driven solution for building both standalone and federated GraphQL services, offering schema‑first and code‑first development, code generation, testing tools, and seamless integration with Netflix’s tracing and security infrastructure.

Programmer DD
Programmer DD
Programmer DD
How Netflix’s Open‑Source DGS Framework Simplifies Java GraphQL Development

Netflix’s Domain Graph Service (DGS) framework is now open‑source. It simplifies the implementation of both standalone and federated GraphQL services on the Java ecosystem.

Key capabilities include:

Annotation‑driven Spring Boot programming model

Testing framework that lets you write query tests as unit tests

Gradle code‑generation plugin that creates Java/Kotlin types from a GraphQL schema

Easy integration with GraphQL Federation

Integration with Spring Security

GraphQL subscriptions (WebSockets and SSE)

File upload support

Error handling

Automatic support for interface/union types

Java‑focused GraphQL client

Pluggable instrumentation

1. Why the DGS framework is needed

In spring 2019 Netflix began exploring a federated GraphQL architecture. To give backend teams a good developer experience for GraphQL in Java, they built an internal framework that later was modularized and open‑sourced.

2. Schema‑first development

Schema defines the GraphQL API. Using a schema‑first approach, developers write the GraphQL schema in SDL and implement only the resolver code. DGS supports both schema‑first and code‑first, but Netflix prefers schema‑first because it improves developer experience, tooling, and makes breaking changes more visible.

Schema design is central to developer experience.

It provides a simpler way for tools to consume the schema.

Schema differences highlight backward‑incompatible changes, which is critical for federated GraphQL.

3. Practical usage

The framework revolves around the familiar annotation‑based model in Spring Boot. A simple example starts with a schema, generates Java/Kotlin types via the Gradle code‑generation plugin, and implements data fetchers with @DgsData. The application can be started and accessed via the /graphql endpoint and the built‑in GraphiQL UI.

4. Integration with the GraphQL ecosystem

DGS works with existing GraphQL libraries such as graphql‑java (schema‑first) and graphql‑kotlin (code‑first). It can be used to build both independent services and federated services.

5. Federation support

DGS enables easy implementation of Apollo Federation by using @extends directives and providing entity fetchers. Services can respond to _entities queries, allowing the gateway to compose a unified schema.

6. Architecture

The framework is built on standard Spring Boot modules, with optional Netflix‑specific extensions. It is modularized using Gradle’s implementation configuration, allowing most parts to be used without Netflix’s internal infrastructure.

7. Distributed tracing and metrics

DGS can integrate with Netflix’s tracing, metrics, logging, and security infrastructure. It also supports GraphQL Java’s Instrumentation API for custom extensions.

8. Getting started

Documentation and tutorials are available at https://netflix.github.io/dgs/ . Contributions are welcomed via the GitHub repository.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

JavaBackend DevelopmentSpring BootGraphQLDGS
Programmer DD
Written by

Programmer DD

A tinkering programmer and author of "Spring Cloud Microservices in Action"

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.