RESTful API developed using Java and Spring Boot to simulate a shopping cart system, allowing users to manage orders, products, and checkout operations.
This project follows a layered architecture (Controller → Service → Repository) and represents a backend system similar to food delivery or e-commerce platforms.
- Java 17
- Spring Boot
- Spring Data JPA
- Hibernate
- H2 Database
- Swagger (Springfox)
- Gradle
- Shopping cart creation
- Add items to cart
- Remove items from cart
- Calculate total cart value
- Close/checkout cart
- Relationship between customer, product, and restaurant
The project is organized using a standard Spring Boot architecture:
- Controller -> Handles HTTP requests
- Service -> Business logic
- Repository -> Data access layer (JPA)
- Entity -> Database models
- Type: H2 (in memory)
- Automatically created at runtime using Hibernate
- Resets every time the application restarts
git clone https://github.com/GhostRiley115/shopping-cart-api.git cd shopping-cart-api ./gradlew bootRun
Or run directly via your IDE (IntelliJ, Eclipse, etc.)
- API Base URL: http://localhost:8081
- Swagger UI (API documentation): http://localhost:8081/swagger-ui/
- H2 Console (database access): http://localhost:8081/h2-console
Use the following configuration:
- JDBC URL: jdbc:h2:mem:testdb
- Username: clayton
- Password: 5445
- Customer (Cliente)
- Product (Produto)
- Restaurant (Restaurante)
- Item
- Shopping Cart (Sacola)
- POST /api/v1/sacolas
- GET /api/v1/sacolas/{id}
- PATCH /api/v1/sacolas/{id}/fechar
To practice backend development using Spring Boot, focusing on:
- REST API design
- Layered architecture
- Database relationships
- Business logic implementation
This project represents the backend of a simulated real-world system.
It can be integrated with a frontend (web or mobile) to create a complete application, similar to platforms like food delivery services.
- Authentication and authorization (JWT)
- Migration to a real database (PostgreSQL/MySQL)
- Deployment (cloud environment)
- Integration with frontend applications