Welcome to the Ecom E-Commerce Platform documentation. This is a monolithic Spring Boot application currently designed for a single deployment. Below is a complete guide to the project structure, setup, and future migration paths.
This documentation package contains:
High-level architecture review of the monolithic system.
- Technology stack
- Project structure
- Design patterns used
- Current database (PostgreSQL)
- Future roadmap phases
- Key observations & recommendations
Read this first to understand the overall architecture.
Complete database entity relationship diagram and schema documentation.
- Mermaid ERD diagram
- Table schemas with constraints
- Relationship types and cardinalities
- Data flow scenarios
- SQL schema definitions
- Migration path to PostgreSQL + MongoDB
Use this for understanding data models and database design.
Complete REST API documentation with examples.
- All endpoints organized by domain
- Request/response formats
- HTTP status codes
- Validation rules
- cURL examples
- Complete workflow walkthrough
- Future endpoints planned
Reference this when building client applications or testing APIs.
Step-by-step guide for setting up local development environment.
- Prerequisites and installation
- Project setup instructions
- IDE configuration
- Build commands
- Testing APIs
- Debugging guide
- Common issues & solutions
- Environment configuration
Follow this to get the application running locally.
Detailed 16-week plan to migrate from monolith to microservices.
- Phase-by-phase breakdown
- Service boundaries definition
- Communication patterns (sync/async)
- API Gateway setup
- Advanced patterns (Circuit Breaker, Saga)
- Database optimization (Polyglot Persistence)
- Kubernetes deployment
- CI/CD pipeline setup
- Risk mitigation strategies
Study this when planning future architecture evolution.
- Java 25 JDK
- Maven 3.8.0+
- IDE (IntelliJ IDEA, VS Code, or Eclipse)
# Clone repository
git clone <repo-url>
cd ecom
# Build
mvn clean install
# Run
mvn spring-boot:run
# Application starts at http://localhost:8080# Test API
curl http://localhost:8080/productsecom/
βββ document/ # Documentation files (this folder)
β βββ PROJECT_OVERVIEW.md
β βββ DATABASE_ERD.md
β βββ API_ENDPOINTS_REFERENCE.md
β βββ DEVELOPMENT_SETUP.md
β βββ MICROSERVICES_MIGRATION_ROADMAP.md
β
βββ src/main/java/com/app/ecom/mono/
β βββ controller/ # REST endpoints (4 controllers)
β βββ service/ # Business logic (interfaces + implementations)
β βββ Repo/ # Data access layer (5 repositories)
β βββ entity/ # JPA entities (7 entities)
β βββ model/ # DTOs for API (7 models + 2 enums)
β βββ EcomApplication.java
β
βββ src/main/resources/
β βββ application.yml
β
βββ pom.xml # Maven dependencies
βββ Dockerfile # (to be created for containerization)
βββββββββββββββββββββββββββββββββββββββ
β REST Controllers β (4 controllers)
β /users, /products, /cart, /orders β
ββββββββββββββ¬βββββββββββββββββββββββββ
β
ββββββββββββββΌβββββββββββββββββββββββββ
β Service Layer β (8 services)
β Business logic & validations β
ββββββββββββββ¬βββββββββββββββββββββββββ
β
ββββββββββββββΌβββββββββββββββββββββββββ
β Repository Layer β (5 repositories)
β JPA queries & data access β
ββββββββββββββ¬βββββββββββββββββββββββββ
β
ββββββββββββββΌβββββββββββββββββββββββββ
β Entity Layer β (7 entities)
β Database models with relationships β
ββββββββββββββ¬βββββββββββββββββββββββββ
β
ββββββββββββββΌβββββββββββββββββββββββββ
β PostgreSQL Database β
β (PostgreSQL for production) β
βββββββββββββββββββββββββββββββββββββββ
UserController- User CRUD + managementProductController- Product catalog + searchCartController- Shopping cart operationsOrderController- Order creation & history
UserService- User business logicProductService- Product operations & filteringCartItemService- Cart management logicOrderService- Order creation & retrieval- Plus interfaces:
IUserService,IProductService,ICartItemService,IOrderService
IUserRepo- User data accessIProductRepo- Product queries (with custom finders)ICartItemRepo- Cart item data accessIOrderRepo- Order data accessIOrderItemRepo- Order item data access
BaseEntity- Shared lifecycle (createdAt, updatedAt)UserEntity- User profileAddressEntity- User addressProductEntity- Product catalogCartItemEntity- Shopping cart itemsOrderEntity- OrdersOrderItemEntity- Items in orders
User- DTO for User APIProduct- DTO for Product APICartItem- DTO for Cart APIOrder- DTO for Order APIOrderItem- DTO for order itemsAddress- DTO for address- Plus:
UserRoleenum (ADMIN, CUSTOMER) - Plus:
OrderStatusenum (PENDING, CONFIRMED, SHIPPED, DELIVERED, CANCELLED)
Client
β
POST /cart/{productId}?quantity=2 (Header: X-User-Id: 1)
β
CartController
β
CartItemService.addCartItem(userId, productId, quantity)
β
Validate: User exists, Product exists, quantity > 0
β
ICartItemRepo.findByUserIdAndProductId()
β
Database
ββ If exists: UPDATE quantity and price
ββ If new: INSERT cart item
β
Return CartItem DTO
Client
β
POST /orders (Header: X-User-Id: 1)
β
OrderController
β
OrderService.createOrder(userId)
β
Validate: User exists, Cart not empty
β
Get all cart items for user
β
Create OrderEntity with status=PENDING
β
Create OrderItemEntity for each cart item
β
Calculate totalAmount
β
Save order to database
β
Clear user's cart
β
Return Order DTO with items
- User ID passed via
X-User-Idheader - Basic entity existence validation
- Quantity validation (> 0)
- Spring Security for authentication/authorization
- Input validation beans (@Valid, @NotBlank, etc.)
- Global exception handler
- Rate limiting
- CORS configuration
See PROJECT_OVERVIEW.md for detailed recommendations.
t_user- Users with rolest_address- User addresses (1:1 with user)t_product- Product catalogt_cart_item- Shopping cart items (user + product)t_order- Orders with statust_order_item- Items in orders (product + order)
- User β Address (1:1)
- User β CartItem (1:M) β Product (M:1)
- User β Order (1:M) β OrderItem (M:1) β Product (M:1)
See DATABASE_ERD.md for complete schema, SQL definitions, and ERD diagrams.
http://localhost:8080
Users (5 endpoints)
- GET /users
- POST /users
- GET /users/{id}
- PUT /users/{id}
- DELETE /users/{id}
Products (6 endpoints)
- GET /products (active + stock > 0)
- GET /products/search?keyword=...
- GET /products/{id}
- POST /products
- PUT /products/{id}
- DELETE /products/{id}
Cart (3 endpoints)
- POST /cart/{productId}?quantity=... (add)
- GET /cart (view)
- DELETE /cart/{productId} (remove)
Orders (3 endpoints)
- POST /orders (create/checkout)
- GET /orders/{orderId}
- GET /orders/user/orders (history)
See API_ENDPOINTS_REFERENCE.md for complete documentation with cURL examples.
β User Management
- Create, read, update, delete users
- User addresses (1:1 relationship)
- User roles (ADMIN, CUSTOMER)
β Product Catalog
- Full CRUD operations
- Search with keyword filtering
- Active product filtering
- Stock availability checks
- Category organization
β Shopping Cart
- Add items (create or update)
- Remove items
- View cart
- Auto-quantity aggregation
- Price snapshot storage
β Orders
- Create orders from cart
- Auto cart clearing
- Order status tracking (PENDING, CONFIRMED, SHIPPED, DELIVERED, CANCELLED)
- Order history per user
- Total amount calculation
- Add input validation annotations
- Create global exception handler
- Add pagination to list endpoints
- Add sorting capabilities
- Implement Spring Security
- Add payment integration
- Email notifications
- Inventory management
- Product reviews & ratings
- User wishlist
- Microservices architecture
- PostgreSQL + MongoDB
- Kubernetes deployment
- Spring Cloud setup
- Message queue integration
- Distributed tracing
- Advanced caching
See MICROSERVICES_MIGRATION_ROADMAP.md for detailed 16-week plan.
# Build
mvn clean install
# Run
mvn spring-boot:run
# Test
mvn test
# Package
mvn clean package
# Run JAR
java -jar target/ecom-0.0.1-SNAPSHOT.jar
# View dependency tree
mvn dependency:tree
# Skip tests during build
mvn clean package -DskipTestsSee DEVELOPMENT_SETUP.md for comprehensive guide.
Product Manager
- Start: PROJECT_OVERVIEW.md (sections: Business Domains, Current Features)
- Then: API_ENDPOINTS_REFERENCE.md (to understand capabilities)
- Future: MICROSERVICES_MIGRATION_ROADMAP.md (for scaling strategy)
Backend Developer
- Start: DEVELOPMENT_SETUP.md (to set up environment)
- Then: PROJECT_OVERVIEW.md (understand architecture)
- Then: DATABASE_ERD.md (understand data model)
- Reference: API_ENDPOINTS_REFERENCE.md (for API contracts)
DevOps Engineer
- Start: DEVELOPMENT_SETUP.md (current setup)
- Then: PROJECT_OVERVIEW.md (technology stack)
- Then: MICROSERVICES_MIGRATION_ROADMAP.md (containerization & K8s)
- Reference: DATABASE_ERD.md (database considerations)
Architect
- Start: PROJECT_OVERVIEW.md (overview & design patterns)
- Then: DATABASE_ERD.md (data model & relationships)
- Then: MICROSERVICES_MIGRATION_ROADMAP.md (evolution path)
- Reference: API_ENDPOINTS_REFERENCE.md (API contracts)
| Layer | Technology | Version |
|---|---|---|
| Framework | Spring Boot | 4.1.0 |
| Language | Java | 25 |
| ORM | JPA/Hibernate | (auto-managed) |
| Database | H2 β PostgreSQL | Current: PostgreSQL |
| Build Tool | Maven | 3.8.0+ |
| Annotations | Lombok | (latest) |
| Testing | JUnit 5 | (via starter) |
Planned Additions:
- Spring Security
- Spring Cloud
- Docker
- Kubernetes
- MongoDB
- Redis
- RabbitMQ/Kafka
- Elasticsearch
- Repository: [Link to git repo]
- Issue Tracker: [Link to issues]
- Wiki: [Link to wiki]
- Slack Channel: [Link to channel]
- Build Pipeline: [Link to CI/CD]
- See
DEVELOPMENT_SETUP.md- Troubleshooting Checklist section - See
PROJECT_OVERVIEW.md- Key Observations section
- Check relevant documentation file
- Search existing issues/tickets
- Contact project maintainer
- Create new issue with details
[Add your license information here]
[Add contributor information]
| Version | Date | Changes |
|---|---|---|
| 1.0 | 2026-06-14 | Initial comprehensive documentation suite |
Last Updated: 2026-06-14
-
New to the project? β Start with
DEVELOPMENT_SETUP.mdand get it running locally -
Want to understand architecture? β Read
PROJECT_OVERVIEW.mdandDATABASE_ERD.md -
Building a client? β Reference
API_ENDPOINTS_REFERENCE.md -
Planning to scale? β Study
MICROSERVICES_MIGRATION_ROADMAP.md
Happy coding! π