MCPcopy Index your code
hub / github.com/Netflix/dgs-examples-java

github.com/Netflix/dgs-examples-java @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
417 symbols 1,441 edges 30 files 8 documented · 2%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Java DGS Framework example

This repository is an example application for the DGS Framework. The example is a standalone GraphQL server in Java.

It shows the following features: * Datafetchers * Mutations * DataLoader to prevent the N+1 problem * Query testing * Using a generated Query API
File Upload * Using the Gradle codegen plugin * A custom instrumentation implementation * Subscriptions * Testing a subscription
Registering an optional scalar from graphql-java

Other examples

There are other examples of using the DGS framework as well:

Shows and Reviews

This example is built around two main types: Show and Review. A Show represents a series or movie you would find on Netflix. For ease of running the demo, the list of shows is hardcoded in ShowsServiceImpl. A show can have Reviews. Again, for ease of running the demo, a list of reviews is generated during startup for each show in DefaultReviewsService.

Reviews can also be added by users of the API using a mutation, and a GraphQL Subscription is available to watch for added reviews.

There's also a mutation available to add Artwork for a show, demonstrating file uploads. Uploaded files are stored in a folder uploaded-images in the work directory where ethe application is started.

Starting the example

The example requires Java 11. Run the application in an IDE using its main class or using Gradle:

./gradlew bootRun

Interact with the application using GraphiQL on http://localhost:8080/graphiql.

Extension points exported contracts — how you extend this code

ShowsService (Interface)
(no doc) [4 implementers]
src/main/java/com/example/demo/services/ShowsService.java
ReviewsService (Interface)
(no doc) [1 implementers]
src/main/java/com/example/demo/services/ReviewsService.java

Core symbols most depended-on inside this repo

n
called by 214
src/main/resources/static/static/js/2.ae627b82.chunk.js
a
called by 130
src/main/resources/static/static/js/2.ae627b82.chunk.js
c
called by 94
src/main/resources/static/static/js/2.ae627b82.chunk.js
e
called by 64
src/main/resources/static/static/js/2.ae627b82.chunk.js
s
called by 51
src/main/resources/static/static/js/2.ae627b82.chunk.js
t
called by 51
src/main/resources/static/static/js/2.ae627b82.chunk.js
i
called by 48
src/main/resources/static/static/js/2.ae627b82.chunk.js
u
called by 48
src/main/resources/static/static/js/2.ae627b82.chunk.js

Shape

Function 337
Method 58
Class 20
Interface 2

Languages

TypeScript81%
Java19%

Modules by API surface

src/main/resources/static/static/js/2.ae627b82.chunk.js328 symbols
src/test/java/com/example/demo/ShowsDataFetcherTest.java8 symbols
src/test/java/com/example/demo/SecurityExampleFetchersTest.java8 symbols
src/main/java/com/example/demo/services/DefaultReviewsService.java8 symbols
src/test/java/com/example/demo/ReviewSubscriptionTest.java7 symbols
src/main/java/com/example/demo/instrumentation/ExampleTracingInstrumentation.java7 symbols
src/main/java/com/example/demo/datafetchers/ReviewsDataFetcher.java6 symbols
src/main/resources/static/static/js/main.05accb10.chunk.js4 symbols
src/main/java/com/example/demo/datafetchers/SecurityExampleFetchers.java4 symbols
src/test/java/com/example/demo/ReviewSubscriptionIntegrationTest.java3 symbols
src/main/resources/static/static/js/runtime-main.09b85ec0.js3 symbols
src/main/java/com/example/demo/dataloaders/ReviewsDataLoaderWithContext.java3 symbols

For agents

$ claude mcp add dgs-examples-java \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact