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.
- 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
- Java 21 (LTS)
- Spring Boot 4.0.7
- Spring Web MVC
- Spring Data JPA
- MySQL
- Maven
- Lombok
- MapStruct
- Jakarta Validation
- SpringDoc OpenAPI (Swagger)
src
├── controller
├── service
│ ├── impl
├── repository
├── entity
├── dto
├── mapper
├── exception
├── common
└── config
After starting the application, the interactive Swagger UI is available at:
http://localhost:8080/swagger-ui/index.html
git clone https://github.com/zeynep4713/ecommerce-backend.gitCreate 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_passwordmvn spring-boot:runor run the main application class directly from your IDE.
| 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 |
| 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 |
Examples:
GET /products?page=0&size=5
GET /products?page=0&size=5&sort=price
GET /products?page=0&size=5&sort=price,desc
- JWT Authentication & Authorization
- Order Management
- User Management
- Advanced Filtering
- Unit & Integration Tests
- Docker Support
- GitHub Actions CI/CD
This project is intended for educational and portfolio purposes.
Zeynep Nur Yılmaz