Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

E-Commerce Backend API

Java Spring Boot MySQL Maven

A RESTful e-commerce backend application built with Spring Boot. The project demonstrates modern backend development practices including layered architecture, DTO mapping, validation, exception handling, searching, filtering, pagination, sorting, and API documentation with Swagger.

Features

  • Category CRUD operations
  • Product CRUD operations
  • Product search by keyword (name and description)
  • Filter products by category
  • Pagination
  • Sorting
  • Request validation
  • Global exception handling
  • Custom exception classes
  • Category–Product relationship (Many-to-One)
  • DTO-based request and response handling
  • MapStruct for Entity-DTO mapping
  • Swagger / OpenAPI documentation

Technologies

  • Java 21 (LTS)
  • Spring Boot 4.0.7
  • Spring Web MVC
  • Spring Data JPA
  • MySQL
  • Maven
  • Lombok
  • MapStruct
  • Jakarta Validation
  • SpringDoc OpenAPI (Swagger)

Project Structure

src
├── controller
├── service
│   ├── impl
├── repository
├── entity
├── dto
├── mapper
├── exception
├── common
└── config

API Documentation

After starting the application, the interactive Swagger UI is available at:

http://localhost:8080/swagger-ui/index.html

Running the Project

1. Clone the repository

git clone https://github.com/zeynep4713/ecommerce-backend.git

2. Configure MySQL

Create a MySQL database (e.g. ecommerce) and update the application.yaml file with your own database credentials.

Example:

spring:
  datasource:
    url: jdbc:mysql://localhost:3306/ecommerce
    username: your_username
    password: your_password

3. Run the application

mvn spring-boot:run

or run the main application class directly from your IDE.

Available Endpoints

Categories

Method Endpoint Description
POST /categories Create category
GET /categories Get all categories
GET /categories/{id} Get category by id
PUT /categories/{id} Update category
DELETE /categories/{id} Delete category

Products

Method Endpoint Description
POST /products Create product
GET /products Get products (supports pagination & sorting)
GET /products/{id} Get product by id
PUT /products/{id} Update product
DELETE /products/{id} Delete product
GET /products/search?keyword=... Search products

Pagination & Sorting

Examples:

GET /products?page=0&size=5
GET /products?page=0&size=5&sort=price
GET /products?page=0&size=5&sort=price,desc

Future Improvements

Planned Features

  • JWT Authentication & Authorization
  • Order Management
  • User Management
  • Advanced Filtering

DevOps & Quality

  • Unit & Integration Tests
  • Docker Support
  • GitHub Actions CI/CD

License

This project is intended for educational and portfolio purposes.

Author

Zeynep Nur Yılmaz

About

RESTful e-commerce backend API built with Spring Boot, Spring Data JPA, MapStruct, MySQL and Swagger/OpenAPI.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Contributors

Languages