Monster Shop is an e-commerce web application developed with Java 21 and Spring Boot. It allows users to browse products, view reviews, and write their own opinions. It serves as the backend for an online store whose frontend is implemented in React.
- Features
- Technologies Used
- Environment Setup
- How to Run
- Main Endpoints
- Project Structure
- Error Handling
- Additional Notes
- Author
- Acknowledgments
- Monster Shop management
- CRUD operations for products and reviews
- Custom exception handling
- Input validation at the DTO level
- Layered architecture using Spring Boot
- Structured and controlled API responses
- Ready to be connected to a frontend or tested with Postman
- Java 21
- Spring Boot
- Maven
- Spring Web (REST API)
- Spring Data JPA
- MySQL
- DTO Pattern
- MapStruct (for mapping between entities and DTOs)
- Spring CORS Configuration
- .env configuration (environment variables)
- Java 21
- Maven 3.x
- MySQL
- An IDE such as IntelliJ or VSCode
Create a .env file at the root of the project with the following variables:
DB_URL=jdbc:mysql://localhost:3306/monster_shop
DB_USERNAME=your_username
DB_PASSWORD=your_password# Clone the repository
git clone https://github.com/FemcodersPaulaCalvo/MonsterShop.git
cd MonsterShop
# Configure the database and the .env file
# Compile and run
./mvnw spring-boot:runLa API estará disponible en: http://localhost:8080
Note: Endpoints are grouped by resource type.
GET /products→ Listar productosGET /products/{id}→ Obtener producto por IDPOST /products→ Crear productoPUT /products/{id}→ Actualizar productoDELETE /products/{id}→ Eliminar producto
GET /reviews→ Listar reseñasGET /reviews/product/{productId}→ Reseñas por productoPOST /reviews→ Crear reseñaDELETE /reviews/{id}→ Eliminar reseña
MonsterShop/
├── src/
│ ├── main/
│ │ ├── java/com/MonsterShop/MS/
│ │ │ ├── config/ # Global configurations (CORS, etc.)
│ │ │ ├── controller/ # REST controllers
│ │ │ ├── dto/ # DTO classes and mappers
│ │ │ ├── entity/ # JPA entities
│ │ │ ├── repository/ # JPA repositories
│ │ │ └── service/ # Business logic
│ │ └── resources/
│ │ └── application.properties
├── .env # Environment variables
├── pom.xml # Maven dependencies
Includes centralized error management via GlobalExceptionHandler and custom exceptions like:
EmptyListExceptionProductAlreadyExistExceptionNoIdProductFoundException
- The project implements a clear separation of layers using the MVC pattern (Controller, Service, Repository).
- DTOs are used to avoid directly exposing the entities.
- The database is configured via .env variables and application.properties
Developed by Paula Calvo
- Spring Boot Team
- Factoria F5
- Open Source Community
Thanks for using MonsterShop! 🚀