Run the startup script:
./start.shThis will start the backend (port 8080), frontend (port 3000/3001), and open the application in your browser.
- Email:
demo@bookstore.com - Password:
Demo@123
A complete full-stack web application for online bookstore management built with Spring Boot (backend), React (frontend), and H2 embedded database. Users can register, login, browse books, search, and manage shopping cart.
- Spring Boot 3.0 - REST API development
- Spring Data JPA - ORM for database operations
- H2 Database - Embedded relational database (file-based)
- Spring Security + JWT - Authentication and authorization
- Maven - Build and dependency management
- Lombok - Reduce boilerplate code
- React 18 - UI framework
- React Router 6 - Client-side routing
- Axios - HTTP client
- Vite - Build tool
- CSS - Styling (vanilla CSS)
- H2 Database - Embedded file-based relational database at
/tmp/bookstore_db - Hibernate ORM - Object-Relational Mapping
bookstore-backend/
├── src/
│ ├── main/
│ │ ├── java/com/bookstore/
│ │ │ ├── entity/ (Database entities)
│ │ │ ├── repository/ (JPA repositories)
│ │ │ ├── service/ (Business logic)
│ │ │ ├── controller/ (REST endpoints)
│ │ │ ├── dto/ (Data transfer objects)
│ │ │ ├── security/ (JWT utilities)
│ │ │ └── BookstoreApplication.java
│ │ └── resources/
│ │ └── application.properties
│ └── test/
└── pom.xml
bookstore-frontend/
├── src/
│ ├── components/ (Reusable components)
│ ├── pages/ (Page components)
│ ├── services/ (API service layer)
│ ├── styles/ (CSS files)
│ ├── App.jsx
│ └── main.jsx
├── index.html
├── vite.config.js
└── package.json
- id (PK)
- email (unique)
- password (hashed)
- name
- role- id (PK)
- title
- author
- category
- price
- stock
- description- id (PK)
- user_id (FK)
- total_amount
- status
- created_at- id (PK)
- order_id (FK)
- book_id (FK)
- quantity
- price- Java 17+
- Node.js 14+
- Maven 3.6+
- (No database installation needed - uses H2 embedded database)
Simply run the startup script:
./start.shEverything will be configured and running automatically!
If you prefer manual setup, follow these steps:
- Navigate to backend folder:
cd bookstore-backend- Build the application:
mvn clean package -DskipTests- Run:
java -jar target/bookstore-api-1.0.0.jarBackend runs on: http://localhost:8080
Note: No database configuration needed - H2 is embedded and auto-configured
- Navigate to frontend folder:
cd bookstore-frontend- Install dependencies:
npm install- Run development server:
npm run devFrontend runs on: http://localhost:3000
POST /api/auth/register- Register new userPOST /api/auth/login- Login user
GET /api/books- Get all booksGET /api/books/{id}- Get book by IDGET /api/books/search/title?title=...- Search by titleGET /api/books/search/author?author=...- Search by authorGET /api/books/category/{category}- Get books by categoryPOST /api/books- Add new book (Admin)PUT /api/books/{id}- Update book (Admin)DELETE /api/books/{id}- Delete book (Admin)
GET /api/orders/user/{userId}- Get user's ordersGET /api/orders/{id}- Get order detailsPUT /api/orders/{id}/status?status=...- Update order status
- User Authentication & Authorization (JWT)
- Book Management (CRUD operations)
- Search & Filter functionality
- Shopping Cart (local storage)
- Order Management
- Responsive UI
- Input Validation (Backend & Frontend)
- Error Handling
- Layered Architecture (Controller → Service → Repository)
- Role-based Access Control
- Register - Create new account with email and password
- Login - Use credentials to login
- Browse Books - View all available books
- Search - Search books by title or author
- Add to Cart - Click "View Details" and add desired quantity
- Manage Cart - Modify quantities or remove items
Email: demo@bookstore.com
Password: Demo@123
- Test registration with new email
- Test login with valid/invalid credentials
- Add/remove items from cart
- Search with different keywords
- Verify responsive design on different screen sizes
mvn clean package
java -jar target/bookstore-api-1.0.0.jarnpm run build
npm run preview- JWT tokens expire after 24 hours
- Passwords are hashed using BCrypt
- Cart is stored in browser's localStorage
- All APIs require authentication (except /auth endpoints)
- CORS is enabled for localhost:3000 and localhost:3001
- Database is H2 embedded file-based at
/tmp/bookstore_db - Data persists between application restarts
- 8 sample books are pre-loaded on first run
- Frontend will automatically try port 3001 if 3000 is in use
- Backend uses port 8080. To change, modify
application.properties:server.port=8081
- Ensure both
pom.xml(backend) andpackage.json(frontend) are in place - Check that Maven and Node.js are installed:
mvn -vandnode -v - Try removing the database file:
rm -f /tmp/bookstore_db*
- Ensure backend allows requests from http://localhost:3000 and http://localhost:3001
- Check CorsConfig.java in backend code
- Clear browser cache if issue persists
- Check logs:
tail -f /tmp/bookstore-backend.log tail -f /tmp/bookstore-frontend.log
- Ensure you're in the correct directory when running
./start.sh - Check file permissions:
ls -la start.sh(should havexpermission)
Student Name: Ritvik Mukherjee Roll Number: 2328113 Batch: 2024 Date: April 2026
Educational Project - Learning Purpose Only