Rajdip789/Netflix-DGS

Building and scaling federated GraphQL services with the Netflix Domain Graph Service (DGS) framework.

โ˜… 0Forks 0JavaGitHub โ†—Compare
dgs-frameworkgraphqlspring-boot

README

DGS GraphQL Project

A Netflix DGS (Domain Graph Service) GraphQL application built with Spring Boot and Java 21.

Features

  • GraphQL API for querying TV shows
  • Spring Boot 4.0.5 with Netflix DGS starter
  • Query filtering by title
  • Comprehensive test suite

API Endpoints

  • GraphQL Endpoint: http://localhost:8080/graphql
  • GraphiQL UI: http://localhost:8080/graphiql (for interactive testing)

Sample GraphQL Query

query {
  show {
    title
    rating
    genre
    releaseDate
  }
}

Query with Filter

query {
  show(titleFilter: "Breaking") {
    title
    rating
    genre
  }
}

Testing with GraphiQL UI

Visit http://localhost:8080/graphiql to access the interactive GraphQL IDE.

Features:

  • โ–ถ๏ธ Run Query: Press Ctrl+Enter or click the play button to execute
  • ๐ŸŽฏ Auto Complete: Press Space or start typing for suggestions
  • ๐Ÿ“– Schema Documentation: View all available queries and fields
  • ๐Ÿ“Š Real-time Results: See response data formatted as JSON

Example Query in GraphiQL:

{
  show {
    rating
    genre
    releaseDate
  }
}

This will return all TV shows with their rating, genre, and release date in the right panel.

Testing with cURL

Get all shows

curl -X POST \
  -H "Content-Type: application/json" \
  -d '{"query": "query { show { title rating genre } }"}' \
  http://localhost:8080/graphql

Get shows filtered by title

curl -X POST \
  -H "Content-Type: application/json" \
  -d '{"query": "query { show(titleFilter: \"Breaking\") { title rating genre } }"}' \
  http://localhost:8080/graphql

Build & Run

Build the project

./gradlew build

Run the application

./gradlew bootRun

Run tests

./gradlew test

Tech Stack

  • Framework: Spring Boot 4.0.5
  • GraphQL: Netflix DGS 11.0.0
  • Java: OpenJDK 21
  • Build Tool: Gradle

Project Structure

src/
โ”œโ”€โ”€ main/
โ”‚   โ”œโ”€โ”€ java/com/rajdip14/dgs/
โ”‚   โ”‚   โ”œโ”€โ”€ DgsApplication.java
โ”‚   โ”‚   โ””โ”€โ”€ graphql/ShowsDataFetcher.java
โ”‚   โ””โ”€โ”€ resources/
โ”‚       โ””โ”€โ”€ schema/schema.graphqls
โ””โ”€โ”€ test/
    โ””โ”€โ”€ java/com/rajdip14/dgs/DgsApplicationTests.java

Contributors

Rajdip789

Issues