MonoMart
MonoMart is a modern, single-vendor e-commerce backend application built with Spring Boot 3, PostgreSQL, and JWT authentication. It provides a complete RESTful API for managing products, categories, shopping carts, orders, and user authentication with role-based access control.
π Features
Core Functionality
- User Management: Registration, authentication, and role-based access (USER/ADMIN)
- Product Catalog: Full CRUD operations for products with category organization
- Category Management: Hierarchical product categorization
- Shopping Cart: Add, update, remove items with persistent cart functionality
- Order Processing: Create orders from cart, track order status
- JWT Authentication: Secure token-based authentication with refresh tokens
Technical Highlights
- Modern Stack: Spring Boot 3.3.2 with Java 17
- Database: PostgreSQL with Liquibase migrations
- Security: Spring Security with JWT tokens
- API Documentation: Swagger/OpenAPI integration
- Data Mapping: MapStruct for efficient DTO mappings
- Validation: Bean validation with custom validators
- CORS: Configurable cross-origin resource sharing
- Containerized: Docker and Docker Compose ready
ποΈ Architecture
βββ controller/ # REST API endpoints
βββ service/ # Business logic layer
βββ repository/ # Data access layer
βββ domain/ # Entity models
βββ dto/ # Data transfer objects
βββ security/ # JWT and authentication
βββ config/ # Application configuration
βββ exception/ # Global exception handling
π API Documentation
Swagger UI
Once the application is running, access the interactive API documentation:
- Swagger UI: http://localhost:8080/swagger-ui.html
- OpenAPI JSON: http://localhost:8080/api-docs
API Endpoints Overview
Authentication
POST /api/v1/auth/signup
- User registrationPOST /api/v1/auth/login
- User loginPOST /api/v1/auth/admin/login
- Admin loginPOST /api/v1/auth/refresh
- Refresh JWT token
Products
GET /api/v1/products
- List products (paginated)GET /api/v1/products/{id}
- Get product detailsPOST /api/v1/products
- Create product (Admin only)PUT /api/v1/products/{id}
- Update product (Admin only)DELETE /api/v1/products/{id}
- Delete product (Admin only)
Categories
GET /api/v1/categories
- List all categoriesGET /api/v1/categories/{id}
- Get category detailsPOST /api/v1/categories
- Create category (Admin only)PUT /api/v1/categories/{id}
- Update category (Admin only)DELETE /api/v1/categories/{id}
- Delete category (Admin only)
Shopping Cart
GET /api/v1/cart
- Get userβs cartPOST /api/v1/cart/items
- Add item to cartPUT /api/v1/cart/items/{id}
- Update cart itemDELETE /api/v1/cart/items/{id}
- Remove cart itemDELETE /api/v1/cart
- Clear entire cart
Orders
GET /api/v1/orders
- List all orders (Admin) or user ordersGET /api/v1/orders/{id}
- Get order detailsPOST /api/v1/orders
- Create order from cartPUT /api/v1/orders/{id}/status
- Update order status (Admin only)
Sample API Usage
Register a new user
curl -X POST http://localhost:8080/api/v1/auth/signup \
-H "Content-Type: application/json" \
-d '{
"username": "john",
"email": "john@example.com",
"password": "Passw0rd!"
}'
Login and get JWT token
curl -X POST http://localhost:8080/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{
"usernameOrEmail": "john",
"password": "Passw0rd!"
}'
Access protected endpoints
curl -X GET http://localhost:8080/api/v1/cart \
-H "Authorization: Bearer YOUR_JWT_TOKEN"
MonoMart - Building the future of e-commerce, one API at a time! π