Welcome to BookStore, a Java-based RESTful web application designed to manage a simple online bookstore. This is an introductory project that demonstrates the core principles of Spring Boot and backend development using modern technologies.
BookStore was created to simulate the essential operations of a real-world online bookstore. Inspired by the need to understand and implement a full-stack backend solution, this project highlights key skills and technologies required in enterprise-grade applications.
It provides a solid foundation for beginners looking to grasp concepts like authentication, authorization, data persistence, REST APIs, and containerization with Docker.
- Java 17
- Spring Boot 3.2
- Spring Security
- Spring Data JPA
- Hibernate Validator
- MapStruct 1.5 for mapping between DTOs and entities
- Liquibase 4.27 for database version control
- MySQL 8 (deployed via Amazon RDS)
- Docker & Docker Compose
- Swagger / OpenAPI for API documentation
- Checkstyle for code quality
- GitHub Actions for CI/CD pipeline
- Register a new user with a default role
USER - Login and receive JWT token
- Role-based access to endpoints (admin/user)
-
Admins can:
- Add new books
- Update existing books
- Delete books
-
Users can:
- View the list of books
- Search books by title, author, or category
- Admins can create and manage book categories
-
Authenticated users can:
- Add books to their cart
- View and modify cart contents
- Place an order from the shopping cart
- View order history
bookstore/
├── src/main/java/com/bookstore
│ ├── config # Security and Swagger config
│ ├── controller # REST controllers
│ ├── dto # Data Transfer Objects
│ ├── exception # Custom exceptions and handlers
│ ├── model # JPA entity classes
│ ├── repository # Spring Data repositories
│ ├── security # Security-related logic
│ ├── service # Business logic layer
│ └── util # Utility classes
├── Dockerfile
├── docker-compose.yml
├── .env.sample
├── checkstyle.xml
└── pom.xml- Java 17
- Maven
- Docker
- AWS RDS MySQL instance or local MySQL
git clone https://github.com/oleksii-sukhenko/spring-boot-intro.git
cd spring-boot-introCreate an .env file or pass environment variables:
SPRING_DATASOURCE_URL=jdbc:mysql://your-db-endpoint:3306/bookstore
SPRING_DATASOURCE_USERNAME=your-username
SPRING_DATASOURCE_PASSWORD=your-password./mvnw clean installdocker-compose up --build- API base URL:
http://localhost:8080 - Swagger UI:
http://localhost:8080/api/swagger-ui/index.html
Interactive documentation available via Swagger UI:
- Local:
http://localhost:8080/api/swagger-ui/index.html
- Production:
http://ec2-3-83-161-155.compute-1.amazonaws.com/api/swagger-ui/index.html#/
- Docker DNS resolution errors: Solved by configuring custom DNS and restarting Docker service properly on AWS EC2.
- Access issues with AWS ECR: Fixed authentication errors using correct login with
aws ecr get-login-password. - JWT token authorization: Ensured correct filter order and security configuration to protect secured endpoints.
- Testing with real DB (RDS): Used Testcontainers and separated test configuration for isolated integration testing.
A Postman collection is available to test endpoints. You can import the collection and use predefined requests for:
- Registration
- Login
- CRUD operations for books
- Order flow
Watch the demo video to see how everything works in action: BookStore Loom Video Demo
This project is licensed under the MIT License.
If you find this project helpful or interesting, feel free to star the repo and connect with me on LinkedIn.