/spring-tiny-library-api

A Spring boot and Neo4J RESTful API designed to manage book entities as an example application.

Primary LanguageJava


Logo

Spring Boot Tiny Library RESTful API.

Tiny Library

Tiny Library is a Spring Boot and Neo4J RESTful API enabling yout to manage your library books to the next level:

  • Add a book to your stock.
  • Update a book.
  • Get all details of a book.
  • Search for books with title, reference, release date and author's name.
  • Get all books of a specific author wrote with a signle HTTP request!

Table of Contents

Built with

Models design


Logo

Above is the design used for Book and Author model relationships.

Getting Started

To run this application, you can either run it on your local machine with your already installed JDK and Neo4J database or use Docker to set up the application in just a few seconds (recommended way)!

Docker installation (recommended)

(Tested and working on OSx, not tested on Windows.)

Prerequisites

  • Have Docker installed
  • Have docker-compose installed
  • Make sure your don't have a current Neo4J database running on your local system. If it is, please edit the NEO4J host port parameters set in docker-compose.yaml

Installation

  1. Clone the repo
git clone https://gitlab.mindsapp.io/Brahim.Sliti/tinylibrary.git
  1. Edit the src/main/resources/application.properties file so it looks like the above example
# spring.data.neo4j.username=neo4j
# spring.data.neo4j.password=password
# Please if you want to run this application with the docker-compose neo4j service,
# comment out the above username and password settings and uncomment the bellow one
spring.data.neo4j.uri=bolt://neo4j:7687
  1. Build the jar file
./mvnw clean package
  1. Build the docker image
docker build -t spring-tiny-library-api .
  1. Build and run the docker-compose services
docker-compose build && docker-compose up -d
  1. Wait a few seconds so the services start properly and navigate to http://localhost:8080. There you can discover the available endpoints and request them.

Local installation

Prerequisites

  • JDK version 1.11 or later installed
  • Maven 3.6.3 or later installed
  • A Neo4J database running on the port 7687 with connection credentials as username = neo4j and password = password.

You can edit the Neo4J connection parameters in src/main/resources/application.properties file.

Installation

  1. Clone the repo
git clone https://gitlab.mindsapp.io/Brahim.Sliti/tinylibrary.git
  1. Run the application from your IDE (tested and working on IntelliJ IDEA)

  2. Wait a few seconds so the services start properly and navigate to http://localhost:8080. There you can discover the available endpoints and request them.