Skip to content

GraphNest is a Spring Boot 3 + GraphQL demo project using H2 database, designed to showcase CRUD operations for multiple entities

Notifications You must be signed in to change notification settings

Amaljeevs/GraphNest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GraphNest – Spring Boot GraphQL Demo

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.


Features

  • 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.

Technologies

  • Java 17
  • Spring Boot 3.5
  • Spring Boot GraphQL
  • GraphQL Java
  • H2 Database
  • Lombok
  • Maven

Project Structure

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

GraphQL Queries & Mutations

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.


Setup Instructions

  1. Clone the repository:
git clone https://github.com/<your-username>/GraphNest.git
cd GraphNest
  1. Build and run:
mvn clean install
mvn spring-boot:run
  1. Access GraphQL Playground at:
http://localhost:8080/graphiql

License

This project is open-source and free to use.

About

GraphNest is a Spring Boot 3 + GraphQL demo project using H2 database, designed to showcase CRUD operations for multiple entities

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages