| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A comprehensive demonstration of different approaches to implementing GraphQL with Spring Boot, showcasing three popular libraries and their unique features.
This repository contains three independent Spring Boot applications that demonstrate different approaches to implementing GraphQL APIs. Each application implements the same domain model (Organization → Department → Employee hierarchy) using different GraphQL libraries, allowing for direct comparison of approaches and features.
graph TB
A[Organization] --> B[Department]
B --> C[Employee]
subgraph GraphQLImplementations ["GraphQL Implementations"]
D[GraphQL Kickstart]
E[Netflix DGS]
F[Spring for GraphQL]
end
subgraph DataLayer ["Data Layer"]
G[JPA/Hibernate]
H[H2 Database]
end
D --> G
E --> G
F --> G
G --> H
GraphQL Kickstart Library Implementation
Key Features:
Netflix DGS Framework Implementation
Key Features:
Spring for GraphQL Implementation
Key Features:
The application models a simple organizational structure:
erDiagram
Organization ||--o{ Department : contains
Department ||--o{ Employee : contains
Organization ||--o{ Employee : employs
Organization {
int id
string name
}
Department {
int id
string name
int organization_id
}
Employee {
int id
string firstName
string lastName
string position
int salary
int age
int department_id
int organization_id
}
git clone https://github.com/piomin/sample-spring-boot-graphql.git
cd sample-spring-boot-graphqlmvn clean installcd sample-app-kickstart
mvn spring-boot:runcd sample-app-netflix-dgs
mvn spring-boot:runcd sample-app-spring-graphql
mvn spring-boot:runAll three applications implement the same GraphQL schema:
type Query {
# Organization queries
organizations: [Organization]
organization(id: ID!): Organization!
# Department queries
departments: [Department]
department(id: ID!): Department!
# Employee queries
employees: [Employee]
employee(id: ID!): Employee!
employeesWithFilter(filter: EmployeeFilter): [Employee]
}
type Mutation {
# Organization mutations
newOrganization(organization: OrganizationInput!): Organization
# Department mutations
newDepartment(department: DepartmentInput!): Department
# Employee mutations
newEmployee(employee: EmployeeInput!): Employee
}
type Organization {
id: ID!
name: String!
employees: [Employee]
departments: [Department]
}
type Department {
id: ID!
name: String!
organization: Organization
employees: [Employee]
}
type Employee {
id: ID!
firstName: String!
lastName: String!
position: String!
salary: Int
age: Int
department: Department
organization: Organization
}
input EmployeeFilter {
salary: FilterField
age: FilterField
position: FilterField
}
input FilterField {
operator: String! # eq, gt, lt, gte, lte, ne
value: String!
}query {
organizations {
id
name
departments {
id
name
employees {
id
firstName
lastName
position
}
}
}
}query {
employeesWithFilter(filter: {
salary: { operator: "gt", value: "15000" }
position: { operator: "eq", value: "Developer" }
}) {
id
firstName
lastName
position
salary
department {
name
}
}
}mutation {
newEmployee(employee: {
firstName: "Jane"
lastName: "Doe"
position: "Senior Developer"
salary: 25000
age: 28
organizationId: 1
departmentId: 1
}) {
id
firstName
lastName
position
salary
}
}mvn testcd sample-app-kickstart
mvn testmvn jacoco:reportEach module includes comprehensive test coverage for:
| Feature | GraphQL Kickstart | Netflix DGS | Spring GraphQL |
|---|---|---|---|
| Learning Curve | Moderate | Steep | Easy (Spring devs) |
| Performance | Good | Excellent | Good |
| Community | Active | Growing | Official Spring |
| Documentation | Comprehensive | Good | Excellent |
| Testing Support | Good | Excellent | Good |
| Schema Generation | Schema-first | Code-first | Schema-first |
| Spring Integration | Good | Excellent | Native |
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License - see the LICENSE file for details.
If you have any questions or need help with the project:
| Back | FazBrowse Home | New Git URL |