Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CreatorStore API

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.

Highlights

  • 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

Tech Stack

  • Java 17
  • Spring Boot 4, Spring Web MVC, Spring Data JPA
  • PostgreSQL
  • Maven
  • Lombok
  • Springdoc OpenAPI

Project Structure

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/

Run Locally

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-store

Create 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_password

Start the application:

# Windows
./mvnw.cmd spring-boot:run

# macOS/Linux
./mvnw spring-boot:run

The API runs at http://localhost:8080. Hibernate creates or updates the schema at startup.

API Endpoints

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.

Test the API

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 test

What This Project Demonstrates

This 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.

About

Showcasing REST api implementation in basic Spring Boot app.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages