The Book Store Application is a web-based API that allows authenticated users to manage books, including creating, updating, searching, deleting book entries, viewing personal profiles, maintaining a personal wishlist, and generating AI-based book reviews. The system implements JWT-based authentication with role-based authorization and integrates Gemini AI API for generating spoiler-free book reviews.
Live Frontend Deployment:
🌐 Visit Frontend
- User Authentication: Register and login with secure password hashing.
- JWT-based Authorization: Access control using JSON Web Tokens.
- Role-Based Access Control:
- User Role: Can view books, manage their own profile, and maintain a personal wishlist.
- Admin Role: Can add, update, and delete books from the global book library.
- Book Management: CRUD operations for books (restricted based on roles).
- Filtering & Search:
- Filter books by author, category, and rating.
- Search books by title with partial matching.
- User Profile Management: Authenticated users can view their personal details.
- Wishlist Management: Users can add and manage their favorite books in a personal wishlist.
- AI-Powered Book Review:
Generate spoiler-free, AI-generated book reviews using Gemini API for any book. - Cloudinary Image Hosting: Serve book cover images via Cloudinary URLs.
- Backend: Spring Boot, Spring Security, JWT
- Database: MongoDB (NoSQL Database)
- Authentication: JSON Web Token (JWT)
- Image Storage: Cloudinary API
- AI Integration: Gemini API for book reviews
- Tools: Postman (for API testing), Maven (for dependency management)
- User registers/login ➝ Gets JWT token.
- JWT Authentication Filter verifies the token before processing requests.
- Role-Based Authorization decides what each user type can access:
- Users can view and search books, manage their profile and wishlist.
- Admins can manage (add/update/delete) books globally.
- Profile Controller manages user profile operations.
- Wishlist Controller handles adding/removing books from the wishlist.
- Book Controller handles book-related operations with role checks.
- MongoDB Database securely stores user and book data.
- AI Controller communicates with Gemini API to generate reviews.
- Cloudinary serves book cover images.
📦 BookStoreApp
├── 📁 src/main/java/com/example/bookstore
│ ├── 📂 config # Security Configuration
│ ├── 📂 controller # API Controllers
│ ├── 📂 model # Book & User Models
│ ├── 📂 repository # MongoDB Repositories
│ ├── 📂 service # Business Logic Services
│ ├── 📂 security # JWT Utility & Filters
│ └── Application.java # Main entry point
├── 📄 pom.xml # Maven Dependencies
└── 📄 README.md # Documentation
- Uses JWT tokens for authentication.
- Spring Security for securing API endpoints.
- Role-Based Access Control:
- Users are assigned either User or Admin roles.
- Only Admin users can add, update, or delete books from the global collection.
- Normal Users can view books and manage their own wishlist and profile.
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/auth/register |
Register a new user |
POST |
/api/auth/login |
Authenticate and get JWT token |
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/books |
Create a new book |
GET |
/api/books |
Get all books |
GET |
/api/books/{id} |
Get a book by ID |
PUT |
/api/books/{id} |
Update a book by ID |
DELETE |
/api/books/{id} |
Delete a book by ID |
| Query | Description |
|---|---|
/api/books?author=xyz |
Filter books by author |
/api/books?category=xyz |
Filter books by category |
/api/books?rating=4.5 |
Filter books by rating |
/api/books?search=title |
Search books by title |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/profile |
Get authenticated user's profile details |
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/wishlist/{bookId} |
Add a book to wishlist |
GET |
/api/wishlist |
View wishlist |
DELETE |
/api/wishlist/{bookId} |
Remove a book from wishlist |
- Java 17+
- Maven
- MongoDB
- Clone the repository:
git clone https://github.com/your-repo/bookstore.git cd bookstore - Install dependencies:
mvn clean install
- Run the application:
mvn spring-boot:run
- Test API using Postman or any API client.
- Make sure to include your mongodbUri in application.properties for testing.
-
Cloudinary API is integrated to serve book cover images. Admins provide Cloudinary image URLs while adding books.
-
Admin credentials (username and password) are required to access admin controls like adding, updating, or deleting books.
-
Non-admin users can only view books, manage their profile, and maintain their personal wishlist.
-
AI Reviews are powered by Gemini API,providing spoiler-free, intelligent summaries and reviews for each book on demand.



