A backend ecommerce API built with Java and Spring Boot. This application provides endpoints for authentication, managing items, and processing orders.
- User authentication with Spring Security
- JWT-based login system
- CRUD operations for items
- Order creation and management
- Modular project structure with DTOs, services, and controllers
- Java 17+
- Spring Boot
- Spring Security
- Spring Data JPA
- Maven
src/
├── main/
│ └── java/
│ └── dev/
│ └── elijuh/
│ └── ecommerce/
│ ├── configuration/ # App & security config
│ ├── controller/ # REST controllers for auth, items, orders
│ ├── dto/ # Data Transfer Objects
│ ├── model/ # Entity models
│ ├── repository/ # Spring Data repositories
│ ├── service/ # Business logic services
│ └── EcommerceApplication.java # Main class
- Java 17 or higher
- Maven
- (Optional) MySQL or any preferred RDBMS
# Clone the repo
git clone https://github.com/elijuh/ecommerce-backend-spring.git
cd ecommerce-backend-spring
# Run with Maven
./mvnw spring-boot:run- API base:
http://localhost:8080/api - H2 Console (if enabled):
http://localhost:8080/h2-console
POST /api/auth– Login with credentialsPOST /api/auth/register– Register a new user
GET /api/items– List all itemsGET /api/items/{id}– Get an item by IDGET /api/items/sku/{sku}– Get an item by SKUPOST /api/items/create– Create a new itemDELETE /api/items/{id}– Delete an item
GET /api/orders– List all orders for the current userGET /api/orders/{userId}– List all orders for a userGET /api/orders/active– List all active orders for the current userGET /api/orders/active/{userId}– List all active orders for a userPOST /api/orders/create– Create a new order for the current user