Welcome to EZ-Commerce, a powerful and modular e-commerce backend built with Spring Boot. This project offers full-stack-ready REST APIs for product listings, user authentication, shopping cart, and order management.
- ✅ User Registration & JWT Authentication
- 🛍️ Product & Category CRUD (Admin only)
- 🛒 Shopping Cart management
- 📦 Order Placement & History
- 🔐 Role-based Access (User/Admin)
- 📖 Swagger Documentation
Layer | Technology |
---|---|
Language | Java 17 |
Framework | Spring Boot 3 |
Security | Spring Security + JWT |
Database | H2 (dev) / PostgreSQL |
ORM | Spring Data JPA |
Docs | Swagger / OpenAPI |
Base URL:
/api
Method | Endpoint | Description |
---|---|---|
POST | /auth/register |
Register new account |
POST | /auth/login |
Login & receive JWT |
Method | Endpoint | Description |
---|---|---|
GET | /products |
List all products |
POST | /products |
Create product (Admin) |
GET | /products/{id} |
Get product by ID |
PUT | /products/{id} |
Update product (Admin) |
DELETE | /products/{id} |
Delete product (Admin) |
Method | Endpoint | Description |
---|---|---|
GET | /categories |
List all categories |
POST | /categories |
Create category (Admin) |
GET | /categories/{id} |
Get category by ID |
PUT | /categories/{id} |
Update category (Admin) |
DELETE | /categories/{id} |
Delete category (Admin) |
Method | Endpoint | Description |
---|---|---|
GET | /cart |
Get current user's cart |
POST | /cart |
Add product to cart |
DELETE | /cart/{productId} |
Remove product from cart |
Method | Endpoint | Description |
---|---|---|
GET | /orders |
Get current user's orders |
POST | /orders |
Place a new order |
Full API specification can be accessed through (https://github.com/bintangginanjar/EZ-Commerce-Restful-API/blob/main/docs/API.md)
Use /auth/login
to retrieve a Bearer token and add this header to protected requests:
git clone https://github.com/bintangginanjar/EZ-Commerce-Restful-API.git cd EZ-Commerce-Restful-API
./mvnw spring-boot:run
Folder | Description |
---|---|
controller |
Handles HTTP requests (REST API) |
entity |
Data abstraction object |
exception |
Custom exceptions and global error handling |
mapper |
Data response mapper |
model |
JPA entities (e.g. User, Product) |
repository |
Spring Data JPA interfaces |
security |
JWT and security configuration |
service |
Business logic and use cases |
Developed by @bintangginanjar Contributions, issues, and stars ⭐ are welcome!