https://github.com/mohammadalmalt/eshopbackend
A Spring Boot-based RESTful API for an e-commerce platform with user authentication, product management, order processing, and admin capabilities.
https://github.com/mohammadalmalt/eshopbackend
api cucumber database h2-database java jp jwt jwt-authentication openapi rest-api security spring-boot swagger testing
Last synced: about 1 month ago
JSON representation
A Spring Boot-based RESTful API for an e-commerce platform with user authentication, product management, order processing, and admin capabilities.
- Host: GitHub
- URL: https://github.com/mohammadalmalt/eshopbackend
- Owner: mohammadalmalt
- License: mit
- Created: 2025-04-27T19:02:12.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-04-28T09:26:57.000Z (10 months ago)
- Last Synced: 2025-04-29T23:58:46.209Z (10 months ago)
- Topics: api, cucumber, database, h2-database, java, jp, jwt, jwt-authentication, openapi, rest-api, security, spring-boot, swagger, testing
- Language: Java
- Homepage:
- Size: 52.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# E-commerce Backend API
[](https://shields.io/)
[](https://opensource.org/licenses/MIT)
[](https://spring.io/projects/spring-boot)
A **Spring Boot**-based RESTful API for an e-commerce platform with user authentication, product management, and order processing.
---
## โจ Features
- User registration and login with JWT-based authentication
- Product browsing, searching, and filtering
- Shopping cart and order management
- Admin capabilities for product CRUD operations
- Swagger/OpenAPI documentation
- H2 in-memory database
- Unit and integration tests with JUnit, MockMvc, and Cucumber
---
## ๐ Tech Stack
- Spring Boot 3.3.4
- Spring Security with JWT
- Spring Data JPA
- H2 Database
- ModelMapper for DTO mapping
- Swagger/OpenAPI for API documentation
- JUnit 5 and Cucumber for testing
---
## ๐ Setup
1. **Clone the repository:**
```bash
git clone
```
2. **Navigate to the project directory:**
```bash
cd ecommerce-backend
```
3. **Build and run the application:**
```bash
mvn spring-boot:run
```
4. **Access the API**:
```bash
- [Swagger UI](http://localhost:8080/swagger-ui.html)
- [H2 Console](http://localhost:8080/h2-console)
```
## ๐ API Endpoints
| Category | Method | Endpoint | Description |
|:---------|:-------|:---------|:------------|
| Auth | POST | `/api/auth/register` | Register a new user |
| Auth | POST | `/api/auth/login` | Login and receive JWT token |
| Products | GET | `/api/products` | Get all products |
| Products | POST | `/api/products` | Create a new product (Admin) |
| Products | GET | `/api/products/{id}` | Get product by ID |
| Products | PUT | `/api/products/{id}` | Update product by ID (Admin) |
| Products | DELETE | `/api/products/{id}` | Delete product by ID (Admin) |
| Orders | GET | `/api/orders` | Get all orders |
| Orders | POST | `/api/orders` | Create a new order |
| Orders | GET | `/api/orders/{id}` | Get order by ID |
| Orders | PUT | `/api/orders/{id}/status` | Update order status (Admin) |
---
## ๐งช Testing
Run all tests with:
```bash
mvn test
```
## โก Notes
> - Replace `your-256-bit-secret-key-for-jwt-signing` in `application.yml` with a secure key.
> - Product image uploads are simulated using `imageUrl` fields.
> - The application uses an in-memory H2 database for development purposes.
Made with โค๏ธ by Mohammad Almalt ๐