A Spring Boot-based RESTful API for an e-commerce platform with user authentication, product management, and order processing.
- 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
- 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
-
Clone the repository:
git clone <repository-url>
-
Navigate to the project directory:
cd ecommerce-backend -
Build and run the application:
mvn spring-boot:run
-
Access the API:
- [Swagger UI](http://localhost:8080/swagger-ui.html) - [H2 Console](http://localhost:8080/h2-console)
| 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) |
Run all tests with:
mvn test
- Replace
your-256-bit-secret-key-for-jwt-signinginapplication.ymlwith a secure key.- Product image uploads are simulated using
imageUrlfields.- The application uses an in-memory H2 database for development purposes.
Made with ❤️ by Mohammad Almalt 😎