OnlineShop is a full REST API backend for an e-commerce system.
This is a training project, frontend-independent, and usable by any client (Web, Mobile, Desktop) over HTTP.
It implements product catalog, categories, orders, user roles, security, and full CRUD operations.
HTML documentation is available at the root endpoint of the running application.
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ REST API โโโโโโ Business โโโโโโ Data Access โ
โ Controllers โ โ Services โ โ Layer (JPA) โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ โ โ
โผ โผ โผ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ HTTP โ โ Business โ โ PostgreSQL โ
โ Clients โ โ Logic & DTOs โ โ Database โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
erDiagram
USERS {
integer user_id PK
string username
string email
string phone_number
string hash_password
string role
string status
}
CART {
integer cart_id PK
integer user_id FK
}
CART_ITEMS {
integer cart_item_id PK
integer cart_id FK
integer product_id FK
int quantity
}
PRODUCTS {
integer product_id PK
string product_name
string product_description
decimal product_price
decimal product_discount_price
string image
integer category_id FK
}
CATEGORIES {
integer category_id PK
string category_name
string image
}
ORDERS {
integer order_id PK
integer user_id FK
datetime created_at
datetime updated_at
string delivery_address
string delivery_method
string contact_phone
string status
}
ORDER_ITEMS {
integer order_item_id PK
integer order_id FK
integer product_id FK
int quantity
decimal price_at_purchase
}
FAVOURITES {
integer favourite_id PK
integer user_id FK
integer product_id FK
}
USERS ||--o{ CART : owns
USERS ||--o{ ORDERS : places
USERS ||--o{ FAVOURITES : has
CART ||--o{ CART_ITEMS : contains
PRODUCTS ||--o{ CART_ITEMS : appears_in
PRODUCTS ||--o{ ORDER_ITEMS : appears_in
CATEGORIES ||--o{ PRODUCTS : includes
ORDERS ||--o{ ORDER_ITEMS : includes
User โ id, username, email, phoneNumber, hashPassword, role, status, cart, orders, favouritesUserRequestDto โ registration dataUserResponseDto โ returned user infoUserUpdateRequestDto โ update user dataCart, CartItemCartResponseDto, CartItemRequestDto, CartItemResponseDto, CartItemUpdateDtoProduct, CategoryProductRequestDto, ProductResponseDto, ProductResponseForUserDto, ProductUpdateDto, CategoryRequestDto, CategoryResponseDto, CategoryUpdateDtoOrder, OrderItemOrderRequestDto, OrderResponseDto, OrderStatusResponseDto, OrderItemRequestDto, OrderItemResponseDto, OrderItemUpdateDtoFavouriteFavouriteResponseDtoProductStatisticResponseDto, ProfitStatisticRequestDto, ProfitStatisticsResponseDto, GroupByPeriodhttp://localhost:8080/swagger-ui/http://localhost:8080/ or https://api.onlineshop.name/git clone https://github.com/YuriyDolgikh/onlineshop.git
cd onlineshop
application.propertiesmvn spring-boot:run
mvn clean install
mvn spring-boot:run
docker-compose up --build
File:
src/main/resources/application.properties
Example:
server.port=8080
spring.datasource.url=jdbc:postgresql://localhost:5432/onlineshop
spring.datasource.username=your_user
spring.datasource.password=your_password
spring.jpa.hibernate.ddl-auto=update
Run all tests:
mvn test
Previously deployed to Heroku:
https://api.onlineshop.name
Suitable for:
onlineshop/
โโโ src/
โ โโโ main/
โ โ โโโ java/
โ โ โโโ resources/
โ โ โ โโโ application.properties
โ โ โ โโโ static/ (HTML documentation)
โ โ โ โโโ templates/
โ โโโ test/
โโโ docker-compose.yml
โโโ Dockerfile
โโโ pom.xml
โโโ README.md
A complete full-stack-ready REST backend for an e-commerce system with: