This Spring Boot project serves as a demonstration platform for exploring GraphQL as a tool for querying and mutating data while experimenting with various persistence strategies. It implements a simple bookstore domain model with Author and Book entities.
- server: Defines the core GraphQL API (schema, resolvers), the bookstore domain model (Author, Book), and establishes interfaces and testing tools for persistence.
- redis: Implements the
server
persistence interfaces using Redis for fast in-memory data storage. - filesystem: Implements the
server
persistence interfaces with a custom filesystem-based approach with JSON serialization. - elasticsearch: Implements the
server
persistence interfaces using Elasticsearch for robust search and indexing capabilities.
- Java Development Kit (JDK) 17 - Download and install the JDK.
- Apache Maven - Download and install the Maven build tool.
- For backend choice:
- redis: A running Redis instance.
- elasticsearch: A running Elasticsearch instance.
- filesystem: No additional setup needed.
-
Download the project: Obtain the project folder. This folder should contain the
pom.xml
file and the project's source code. -
Choose your Backend: Inside the project, navigate to your desired backend (either
redis
,filesystem
orelasticsearch
). Make sure, that the according requirement from the prerequisites is fulfilled. -
Build the project: Run the following command to build and package the project:
mvn clean package
. This command will download the required dependencies, compile the project, and package it into an executable JAR file. The final JAR file will be located in the directorytarget
, and its name will be...-1.0-SNAPSHOT.jar
. -
Run the application: Execute the following command:
java -jar ...-1.0-SNAPSHOT.jar
. This will start the Spring Boot application, and it will be accessible locally. -
Access the application: Once the application is up and running, you can access the GraphQL API on
http://localhost:8080/graphql
. Seesrc/main/resources/graphql/schema.graphqls
for possible GraphQL queries and mutations.