A robust CRUD application built with Java, Spring Boot, and MySQL for efficient book inventory management.
- Full CRUD Operations: Create, Read, Update, Delete books
- RESTful API: Standardized endpoints for integration
- Database Integration: MySQL persistence with Spring Data JPA
- Error Handling: Comprehensive API error responses
- Validation: Input validation for book data
- Java 17+
- Spring Boot 3.x
- Spring Data JPA
- MySQL 8+
- Maven (dependency management)
- Postman (API testing)
- Java 17+ (JDK Installation Guide
- MySQL 8+ (MySQL Server)
- Postman (Download) or similar API client
-
Clone the repository
git clone https://github.com/KrishnaBishowkarma/book-store.git cd book-store -
Set up MySQL database
Make sure MySQL is installed and running on your system.
-
Create the
book_storedatabase and tableRun the SQL script located at:
src/main/resources/book-store.sqlThis will create the
book_storedatabase, abooktable, and insert sample data. -
Configure your database credentials
Open
src/main/resources/application.propertiesand update it with your MySQL username and password:spring.datasource.url=jdbc:mysql://localhost:3306/book_store spring.datasource.username=<your_username> spring.datasource.password=<your_password>
-
Run the application
You can run the app using your IDE or from the terminal:
# Using Maven Wrapper ./mvnw spring-boot:run# Or with installed Maven mvn spring-boot:run -
Explore the API
Access the REST APIs via Postman or any REST client. The app will be available at:
http://localhost:8080You can test endpoints like:
📂 API Endpoints
Method Endpoint Description GET /api/books Get all books GET /api/books/{id} Get book by ID POST /api/books Add a new book PUT /api/books Update an existing book DELETE /api/books/{id} Delete a book by ID
To quickly test the API endpoints, use the provided Postman collection:
📁 Bookstore API Postman Collection
- Open Postman.
- Click on "Import" → "Upload Files".
- Select the
BookStore.postman_collection.jsonfile located at:
src/main/resources/BookStore.postman_collection.json
- Once imported, you can test all the endpoints:
GET /api/booksGET /api/books/{id}POST /api/booksPUT /api/booksDELETE /api/books/{id}
Make sure the application is running at
http://localhost:8080before sending any requests.
This project is licensed under the MIT License.
Pull requests are welcome. For major changes, please open an issue first to discuss what you'd like to change.
Krishna B. K (Bishowkarma)
🌐 Portfolio | 💼 LinkedIn | 🐙 GitHub