A modern, reactive web application demonstrating an online product catalog with full e-commerce functionality built with Java 21 and Spring Boot 3.
| Category | Technologies |
|---|---|
| Backend | Java 21, Spring Boot 3 (WebFlux, R2DBC, Security, OAuth2) |
| Databases | PostgreSQL, Redis (caching) |
| Infrastructure | Docker, Testcontainers |
| UI | Thymeleaf, HTML, CSS, JavaScript |
| Tools | Lombok, MapStruct, OpenAPI Generator |
This web application serves as a fully-functional product showcase with e-commerce capabilities, built using reactive programming principles for better scalability and performance.
- Browse product catalog
- View product details
- Full cart management (add/remove items)
- Order placement, payment, and cancellation
- Product creation (stock replenishment)
- Session management with "Remember Me" functionality
- Two login modes:
- Temporary session: Session expires when browser closes (default)
- Persistent session: Session restored after browser restart ("Remember Me" enabled)
- OAuth 2.0 Authorization Server using Client Credentials Flow for payment service authorization
- "Remember Me" authentication uses Base64-encoded tokens to reconstruct full Authentication objects with UserDetails
- Default user balance: 15,000 RUB (configurable via
payment.default-balance) - Successful order cancellations refund the amount to user's balance
- Insufficient balance prevents payment with appropriate user notification
- Redis caching for user carts and product lists to reduce application load
- Reactive programming model with Spring WebFlux for better scalability
@ControllerAdviceimplementation for real-time cart total updates and dynamic UI state management
- Auto-generated client (showcase-service) and controller (payment-service) from OpenAPI specifications
- Service-to-service communication between showcase and payment services
- Comprehensive integration tests using Testcontainers
- Docker-in-Docker setup for executing Testcontainers tests within Docker containers
- Clear error messaging during registration and authentication
- Graceful degradation when payment service is unavailable:
- Payment and cancellation buttons are disabled
- Informative messages displayed to users
- Real-time balance validation with user feedback
docker-compose --profile test up --build --abort-on-container-exit
Exit code 0 indicates all tests passed successfully.
docker-compose --profile prod up -d
Application will be available at: http://localhost:8080/products
To stop all running containers:
docker-compose down
To remove volumes:
docker-compose down -v
- PostgreSQL running on port 5432
- Redis running on port 6379
- Docker Desktop (for Testcontainers)
- Maven 3.6+
- Java 21
Build all services (including tests):
mvn clean package
(Optional) Build authorization service:
mvn clean install -pl auth-service
java -jar showcase-service/target/showcase-service.jar --spring.profiles.active=prod
(Optional) Run payment service separately:
java -jar payment-service/target/payment-service.jar --spring.profiles.active=prod
Access the application at: http://localhost:8080/products
The project includes comprehensive testing:
- Unit tests with JUnit 5 and Mockito
- Integration tests with Testcontainers
- End-to-end Docker-based testing
- Code coverage tracking via Coveralls
Feel free to fork the repository and submit pull requests for any improvements.
This project is for demonstration purposes as part of a learning portfolio.
Built with ❤️ using Spring Boot, Java 21, and reactive programming principles
