GraphNest is a Spring Boot 3 + GraphQL demo project using H2 database, designed to showcase CRUD operations for multiple entities (User, Product, Category, Order) with a common ServerResponse wrapper for consistent API responses.
It demonstrates how to build scalable, high-throughput GraphQL APIs with Spring Boot and use a generic response pattern.
- CRUD operations for User, Product, Category, and Order.
- GraphQL endpoints with queries and mutations.
- H2 in-memory database for easy setup.
- Spring Boot + Lombok + JPA.
- Easily extendable for other entities.
- Java 17
- Spring Boot 3.5
- Spring Boot GraphQL
- GraphQL Java
- H2 Database
- Lombok
- Maven
GraphNest
│
├── src/main/java/com/antspace/GraphNest
│ ├── models/ # JPA Entities
│ ├── repository/ # Spring Data JPA Repositories
│ ├── service/ # Business logic
│ ├── resolver/ # GraphQL Resolvers (Queries & Mutations)
│ └── GraphNestApplication.java
│
├── src/main/resources
│ ├── application.yml # Spring Boot configuration
│ └── graphql/
│ ├── user.graphqls
│ ├── product.graphqls
│ ├── category.graphqls
│ └── order.graphqls
│
└── pom.xml
Example GraphQL queries for User:
Query all users
query {
users(search: "") {
code
message
details {
id
name
email
role
}
}
}Add a new user
mutation {
addUser(name: "John Doe", email: "john@example.com", role: "ADMIN") {
code
message
details {
id
name
email
role
}
}
}Similar queries and mutations exist for Product, Category, and Order.
- Clone the repository:
git clone https://github.com/<your-username>/GraphNest.git
cd GraphNest- Build and run:
mvn clean install
mvn spring-boot:run- Access GraphQL Playground at:
http://localhost:8080/graphiql
This project is open-source and free to use.