This is a basic search engine for books built using Spring Boot, Docker, and PostgreSQL. The current implementation allows users to search for books by a given search term, add new books to the database, update existing books, and delete books. ๐
- ๐ Search Books: A single endpoint to search for books by a search term.
- โ Add Books: An endpoint to add new books to the database.
- โ๏ธ Update Books: An endpoint to update existing books in the database.
- ๐๏ธ Delete Books: An endpoint to delete books from the database.
- ๐ Search Books by ISBN: An endpoint to search for a book by its ISBN.
- ๐ Search Books by Author: An endpoint to search for books by an author's name.
- ๐ Search Books by Title: An endpoint to search for books by their title.
- ๐ Scalable Design: Built with Spring Boot, making it easy to add more features in the future.
- ๐ฅ๏ธ Backend: Java with Spring Boot
- ๐ Database: PostgreSQL
- ๐ณ Containerization: Docker
- Docker
- Java 11 or higher
- Maven
-
Clone the repository:
git clone https://github.com/asadsaud25/Book-Search-Engine.git cd book-search-engine
-
Run the Docker containers:
docker-compose up -d
-
Build the project:
mvn clean install
-
Run the Spring Boot application:
mvn spring-boot:run
For testing purposes, you can use the DbImporter.java
file to insert bulk CSV data from github gist into the database.
-
Ensure the database is running:
docker-compose up -d
-
Run the
DbImporter.java
file:mvn exec:java -Dexec.mainClass="com.h2.DBImporter"
-
Search Books:
GET /books/search?searchTerm={searchTerm}
- Example:
GET /books/search?searchTerm=Python
- Response: A list of books matching the search term.
- Example:
-
Add Book:
POST /books/add
- Request Body:
{ "title": "Java Programming", "description": "A comprehensive guide to Java programming.", "isbn": "123-456-7890", "rating": 4.5, "language": "English", "bookFormat": "PDF", "edition": "1st", "pages": 500, "publisher": "Oracle", "publishDate": "2021-01-01", "firstPublishDate": "2020-01-01", "likedPercent": 90, "price": 150.00, "authors": ["James Gosling"] }
- Response: The added book details.
- Request Body:
-
Update Book:
PUT /books/update/{isbn}
- Request Body:
{ "title": "Advanced Java Programming", "description": "An advanced guide to Java programming.", "rating": 4.8, "language": "English", "bookFormat": "Hardcover", "edition": "2nd", "pages": 600, "publisher": "Oracle", "publishDate": "2022-01-01", "firstPublishDate": "2020-01-01", "likedPercent": 95, "price": 200.00, "authors": ["James Gosling"] }
- Response: The updated book details.
- Request Body:
-
Delete Book:
DELETE /books/delete/{isbn}
- Example:
DELETE /books/delete/123-456-7890
- Response: A message indicating the book was successfully deleted.
- Example:
-
Search Book by ISBN:
GET /books/search/{isbn}
- Example:
GET /books/search/123-456-7890
- Response: The book details matching the ISBN.
- Example:
-
Search Books by Author:
GET /books/search/author?authorName={authorName}
- Example:
GET /books/search/author?authorName=James Gosling
- Response: A list of books matching the author's name.
- Example:
-
Search Books by Title:
GET /books/search/title?title={title}
- Example:
GET /books/search/title?title=Java Programming
- Response: A list of books matching the title.
- Example:
To run the tests, use the following command:
mvn test
This project is licensed under the MIT License - MIT LICENSE
- Authentication and Authorization: Implement Spring Security to secure the API endpoints.
- Role-Based Access Control: Define roles and permissions to control access to different parts of the application.
- OAuth2/JWT: Integrate OAuth2 and JWT for token-based authentication.