CreatorStore is a backend e-commerce REST API built with Spring Boot. It demonstrates clean layered architecture, relational data modelling, request validation, and transactional order processing with PostgreSQL.
- Product catalogue with create, read, update, and delete operations
- Order creation that validates item quantities, calculates totals, records purchase prices, and updates inventory atomically
- One-to-many order/item and product/item relationships modelled with JPA/Hibernate
- Input validation for product data, customer details, and order quantities
- Environment-based database configuration and OpenAPI/Swagger UI support
- Java 17
- Spring Boot 4, Spring Web MVC, Spring Data JPA
- PostgreSQL
- Maven
- Lombok
- Springdoc OpenAPI
src/
├── main/
│ ├── java/com/ms/CreatorStore/
│ │ ├── controllers/ # REST endpoints
│ │ ├── services/ # Business rules and transactions
│ │ ├── repositories/ # JPA data access
│ │ ├── entities/ # Database models
│ │ └── dtos/ # Validated order request payloads
│ └── resources/
│ └── application.yaml
└── test/
Prerequisites: Java 17, PostgreSQL, and Git. Maven is included through the Maven Wrapper.
git clone https://github.com/rmss47/rest-ecommerce-store.git
cd rest-ecommerce-storeCreate a PostgreSQL database, then add a .env file at the project root:
DATABASE_URL=jdbc:postgresql://localhost:5432/creatorstore
DATABASE_USERNAME=postgres
DATABASE_PASSWORD=your_passwordStart the application:
# Windows
./mvnw.cmd spring-boot:run
# macOS/Linux
./mvnw spring-boot:runThe API runs at http://localhost:8080. Hibernate creates or updates the schema at startup.
| Method | Endpoint | Purpose |
|---|---|---|
| POST | /api/v1/products |
Create a product |
| GET | /api/v1/products |
List products |
| GET | /api/v1/products/{id} |
Get a product |
| PUT | /api/v1/products/{id} |
Update a product |
| DELETE | /api/v1/products/{id} |
Delete a product |
| POST | /api/v1/orders |
Create an order and reduce stock |
| GET | /api/v1/orders |
List orders |
| GET | /api/v1/orders/{id} |
Get an order |
Interactive API documentation is available at http://localhost:8080/swagger-ui/index.html while the application is running.
Create a product first:
{
"name": "Creator Hoodie",
"description": "Premium cotton hoodie",
"category": "Apparel",
"price": 49.99,
"stockQuantity": 20
}Then create an order using that product ID:
{
"customerName": "Alex Smith",
"customerEmail": "[email protected]",
"items": [{ "productId": 1, "quantity": 2 }]
}Run the automated test suite with:
./mvnw.cmd testThis project showcases practical backend development skills: designing RESTful APIs, structuring Spring Boot applications by responsibility, persisting relational data with JPA, validating external input, and protecting inventory updates within a transaction.