WaggleMart Project - Section 5: Complete
Structure
Project: WaggleMart - Online Pet Supplies E-Commerce Platform
Document: Module Structure, Data Structures, and Process Logic
Prepared for: IGNOU BCA Project Synopsis (Section 5)
A. Number of Modules and Description
Module Breakdown with Effort Estimation
Total Project Effort: 100% (Estimated 200-250 hours)
Module Effort Estimated
Module Name Description
# (%) Hours
User Customer registration, authentication, profile
1.0 15% 30-38 hours
Management management, session handling
Product browsing, search, filtering, category
2.0 Product Catalog 20% 40-50 hours
management, admin CRUD operations
Add to cart, update quantities, remove items, cart
3.0 Shopping Cart 15% 30-38 hours
persistence, availability checks
Order Checkout process, order creation, payment handling,
4.0 20% 40-50 hours
Management order tracking, status updates
Review & Review submission, rating system, admin moderation,
5.0 15% 30-38 hours
Feedback feedback display
Admin Inventory management, reports generation, analytics,
6.0 15% 30-38 hours
Dashboard system monitoring
Project Totals:
Combined Effort: 100%
Development Hours: 200-250 hours
Lines of Code (Estimated): 15,000-20,000
API Endpoints: 40-50 endpoints
Test Cases: 100+ test cases
MODULE 1.0: USER MANAGEMENT
1.1 Module Description
The User Management module handles the complete customer lifecycle including registration,
authentication, profile management, and session security. It implements secure login mechanisms with
bcrypt password hashing and JWT-based session token management for robust authentication.
Key Features:
Secure customer registration with email verification
Password encryption using bcrypt (salt rounds: 10)
Session token generation and validation
Profile update functionality
Secure logout and session cleanup
Account status management (active/inactive)
1.2 Sub-processes
1. Register User (1.1) - New customer account creation with comprehensive validation
2. Authenticate (1.2) - Login credential verification and secure session creation
3. Update Profile (1.3) - Customer information modification with authorization
4. End Session (1.4) - Secure logout and session token invalidation
1.3 Data Structures Used
1.3.1 Customer Object
Structure: {
id: String (UUID),
email: String,
passwordHash: String,
displayName: String,
phone: String,
address: String,
registrationDate: Timestamp,
lastLogin: Timestamp,
sessionToken: String,
sessionExpiry: Timestamp,
isActive: Boolean
}
Purpose: Store complete customer information
Complexity: O(1) access time for attribute retrieval
1.3.2 Session HashMap
Structure: HashMap<String, SessionData>
Key: sessionToken (String)
Value: {customerId, expiryTime, ipAddress}
Purpose: Fast O(1) session validation without database queries
Size: Dynamic based on active sessions
1.3.3 Validation Error Array
Structure: Array of ErrorObject
ErrorObject: {field: String, message: String}
Purpose: Collect and display multiple validation errors
Example: [{field: "email", message: "Invalid format"},
{field: "password", message: "Too weak"}]
1.4 Process Logic
1.4.1 Register User Process
Algorithm: RegisterUser(email, password, displayName, phone, address)
Input: Customer registration details
Output: Success with customer ID or error messages
Time Complexity: O(n) where n is validation checks
Space Complexity: O(1)
BEGIN
1. Initialize validationErrors = []
2. Validate Input Data:
- Check email format using regex: ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$
- Verify password strength:
* Minimum 8 characters
* At least one uppercase letter
* At least one lowercase letter
* At least one digit
* At least one special character
- Validate phone: Must be 10 digits
- Check displayName: Minimum 3 characters, maximum 100
- IF validation fails, add to validationErrors[]
3. IF [Link] > 0 THEN
RETURN {success: false, errors: validationErrors}
4. Check Email Uniqueness:
Query: SELECT id FROM customers WHERE email = inputEmail
IF record exists THEN
RETURN {success: false, error: "Email already registered"}
5. Hash Password:
passwordHash = [Link](password, saltRounds=10)
Time: ~100ms for secure hashing
6. Generate Customer ID:
customerId = generateUUID()
7. Insert Customer Record:
BEGIN TRANSACTION
INSERT INTO customers (
id, email, password_hash, display_name,
phone, address, registration_date, is_active
) VALUES (
customerId, email, passwordHash, displayName,
phone, address, CURRENT_TIMESTAMP, TRUE
)
COMMIT TRANSACTION
8. Send Welcome Email:
[Link](email, displayName)
9. RETURN {success: true, customerId: customerId}
EXCEPTION HANDLING
IF database error THEN
ROLLBACK TRANSACTION
LOG error details with timestamp
RETURN {success: false, error: "Registration failed. Please try again."}
END
Edge Cases Handled:
Duplicate email registration attempts
Invalid email formats
Weak passwords
Database connection failures
Transaction rollback on errors
1.4.2 Authenticate (Login) Process
Algorithm: AuthenticateUser(email, password)
Input: Login credentials
Output: Session token and customer data or error
Time Complexity: O(1) for database lookup + O(n) for password verification
Space Complexity: O(1)
BEGIN
1. Validate Input:
IF email is empty OR password is empty THEN
RETURN {success: false, error: "Email and password required"}
2. Retrieve Customer:
Query: SELECT id, password_hash, is_active, display_name, email
FROM customers
WHERE email = inputEmail
IF no record found THEN
LOG failed login attempt for security monitoring
RETURN {success: false, error: "Invalid email or password"}
3. Check Account Status:
IF is_active = FALSE THEN
RETURN {success: false, error: "Account is suspended. Contact support."}
4. Verify Password:
isValid = [Link](password, customer.password_hash)
Time: ~100ms for verification
IF NOT isValid THEN
LOG failed login attempt (email, timestamp, IP)
INCREMENT failed_login_counter
IF failed_login_counter > 5 THEN
LOCK account temporarily
RETURN {success: false, error: "Invalid email or password"}
5. Generate Session Token:
sessionToken = generateSecureToken(32 bytes)
sessionExpiry = CURRENT_TIMESTAMP + 24 HOURS
6. Update Customer Record:
BEGIN TRANSACTION
UPDATE customers
SET last_login = CURRENT_TIMESTAMP,
session_token = sessionToken,
session_expiry = sessionExpiry
WHERE id = [Link]
COMMIT TRANSACTION
7. Store in Session Cache:
[Link](sessionToken, {
customerId: [Link],
expiryTime: sessionExpiry,
ipAddress: [Link]
})
8. RETURN {
success: true,
sessionToken: sessionToken,
customer: {
id: [Link],
displayName: [Link],
email: [Link]
}
}
EXCEPTION HANDLING
IF database error THEN
LOG error with context
RETURN {success: false, error: "Login service unavailable"}
END
Security Features:
Password never stored in plain text
Failed login attempt monitoring
Account lockout after 5 failed attempts
Session token expiry (24 hours)
IP address logging for security audits
MODULE 2.0: PRODUCT CATALOG
2.1 Module Description
Comprehensive product catalog management system supporting browsing, search, filtering, and
administrative CRUD operations. Implements hierarchical category organization, relevance-based
search ranking, and real-time inventory tracking.
Key Features:
Advanced keyword search with relevance scoring
Multi-criteria filtering (category, price, availability)
Category-based product organization
Product detail views with reviews
Administrative inventory management
Related product recommendations
2.2 Sub-processes
1. Search Products (2.1) - Keyword-based product search with ranking
2. Filter Products (2.2) - Category, price range, availability filters
3. View Details (2.3) - Detailed product information with reviews
4. Manage Inventory (2.4) - Admin product CRUD operations
2.3 Data Structures Used
2.3.1 Product Object
Structure: {
id: String (UUID),
name: String,
description: String,
price: Decimal(10,2),
stockQuantity: Integer,
sku: String,
imageUrl: String,
petCategoryId: String,
isAvailable: Boolean,
createdAt: Timestamp,
updatedAt: Timestamp
}
Purpose: Complete product representation
Storage: Database with indexed lookups
2.3.2 Category Tree
Structure: TreeNode<Category>
TreeNode: {
category: Category,
subcategories: Array<TreeNode>,
parent: TreeNode (nullable)
}
Purpose: Hierarchical category navigation
Operations:
- addSubcategory: O(1)
- findCategory: O(log n) with balanced tree
- getPath: O(h) where h is height
2.3.3 Product Search Index
Structure: HashMap<String, ArrayList<Product>>
Key: Normalized search term
Value: List of matching products
Purpose: Fast O(1) search result retrieval
Update: Asynchronous indexing on product changes
2.3.4 Priority Queue for Search Results
Structure: PriorityQueue<ProductScore>
ProductScore: {
product: Product,
relevanceScore: Float
}
Comparator: By relevanceScore descending
Purpose: Rank search results by relevance
Complexity: O(n log n) for sorting
2.4 Process Logic
2.4.1 Search Products Process
Algorithm: SearchProducts(searchQuery, filters)
Input: Search keyword and optional filters
Output: Sorted list of matching products
Time Complexity: O(n log n) for sorting results
Space Complexity: O(n) for result storage
BEGIN
1. Normalize Search Query:
query = [Link]().trim()
IF [Link] < 2 THEN
RETURN {products: [], message: "Search term too short"}
2. Tokenize Query:
keywords = [Link](" ")
stopWords = ["the", "a", "an", "in", "on", "at"]
keywords = [Link](word => )
3. Build Search Query:
SELECT p.*, [Link] as category_name
FROM products p
JOIN pet_categories pc ON p.pet_category_id = [Link]
WHERE p.is_available = TRUE
AND ([Link] LIKE '%keyword%'
OR [Link] LIKE '%keyword%'
OR [Link] LIKE '%keyword%'
OR [Link] LIKE '%keyword%')
4. Apply Filters:
IF [Link] PROVIDED THEN
ADD "AND p.pet_category_id = [Link]"
IF [Link] PROVIDED THEN
ADD "AND [Link] >= [Link]"
IF [Link] PROVIDED THEN
ADD "AND [Link] <= [Link]"
IF [Link] = TRUE THEN
ADD "AND p.stock_quantity > 0"
5. Calculate Relevance Score:
FOR EACH product IN results
score = 0
FOR EACH keyword IN keywords
IF keyword EXACT_MATCH [Link] THEN score += 15
IF keyword IN [Link] THEN score += 10
IF keyword IN [Link] THEN score += 5
IF keyword IN [Link] THEN score += 3
IF keyword = [Link] THEN score += 20
[Link] = score
6. Sort Results:
IF [Link] = "relevance" THEN
SORT by relevanceScore DESC
ELSE IF [Link] = "price_asc" THEN
SORT by price ASC
ELSE IF [Link] = "price_desc" THEN
SORT by price DESC
ELSE IF [Link] = "name" THEN
SORT by name ASC
ELSE
DEFAULT: SORT by relevanceScore DESC
7. Implement Pagination:
pageSize = 20 // Products per page
startIndex = (pageNumber - 1) * pageSize
endIndex = startIndex + pageSize
paginatedResults = [Link](startIndex, endIndex)
8. RETURN {
success: true,
products: paginatedResults,
totalCount: [Link],
currentPage: pageNumber,
totalPages: [Link]([Link] / pageSize),
hasNextPage: pageNumber < totalPages,
hasPreviousPage: pageNumber > 1
}
EXCEPTION HANDLING
IF database error THEN
LOG error with query details
RETURN {products: [], error: "Search temporarily unavailable"}
END
Search Optimization:
Full-text indexing on product names and descriptions
Caching of popular search results
Query result limit: 1000 products maximum
Search suggestions based on popular queries
MODULE 3.0: SHOPPING CART
3.1 Module Description
Manages shopping cart operations with real-time stock availability checks, quantity validation, and
persistent storage. Implements seamless cart calculations with tax and shipping computation,
supporting smooth transition to checkout.
Key Features:
Real-time stock availability verification
Persistent cart storage (survives logout/login)
Automatic price calculation with taxes
Free shipping threshold implementation
Cart item quantity updates
Product removal with confirmation
Cart abandonment tracking
3.2 Sub-processes
1. Add to Cart (3.1) - Add products with comprehensive quantity validation
2. View Cart (3.2) - Display cart with real-time pricing and totals
3. Remove Item (3.3) - Delete products from cart
4. Update Cart (3.4) - Modify item quantities with stock verification
3.3 Data Structures Used
3.3.1 Cart Item Object
Structure: {
id: String (UUID),
productId: String,
customerId: String,
quantity: Integer,
addedAt: Timestamp,
updatedAt: Timestamp,
productDetails: Product // Joined data
}
Purpose: Individual cart item representation
Constraints: quantity > 0 AND quantity <= stock_quantity
3.3.2 Cart Summary Object
Structure: {
items: Array<CartItem>,
subtotal: Decimal(10,2),
taxAmount: Decimal(10,2),
shippingFee: Decimal(10,2),
discount: Decimal(10,2),
totalAmount: Decimal(10,2),
itemCount: Integer,
uniqueProducts: Integer
}
Purpose: Complete cart calculation summary
Updates: Recalculated on every cart modification
3.3.3 Cart HashMap (In-Memory Cache)
Structure: HashMap<String, ArrayList<CartItem>>
Key: customerId
Value: List of cart items
Purpose: Fast O(1) cart retrieval without database queries
Cache Strategy: LRU with 1-hour TTL
Invalidation: On cart modifications
3.4 Process Logic
3.4.1 Add to Cart Process
Algorithm: AddToCart(customerId, productId, quantity, sessionToken)
Input: Customer ID, Product ID, Quantity, Session
Output: Success confirmation or error
Time Complexity: O(1) average case
Space Complexity: O(1)
BEGIN
1. Validate Session:
IF NOT isValidSession(sessionToken, customerId) THEN
RETURN {success: false, error: "Please login to add items"}
2. Validate Quantity:
IF quantity <= 0 THEN
RETURN {success: false, error: "Quantity must be positive"}
IF quantity > 100 THEN
RETURN {success: false, error: "Maximum 100 units per item"}
3. Retrieve Product:
Query: SELECT id, stock_quantity, is_available, price, name
FROM products
WHERE id = productId
IF no record THEN
RETURN {success: false, error: "Product not found"}
4. Check Availability:
IF [Link] = FALSE THEN
RETURN {success: false, error: "Product currently unavailable"}
IF [Link] < quantity THEN
RETURN {success: false,
error: "Only " + stockQuantity + " units available"}
5. Check Existing Cart Item:
Query: SELECT id, quantity
FROM carts
WHERE customer_id = customerId
AND product_id = productId
6. Update or Insert:
IF cart item EXISTS THEN
newQuantity = existingQuantity + quantity
IF newQuantity > [Link] THEN
RETURN {success: false,
error: "Total exceeds available stock"}
BEGIN TRANSACTION
UPDATE carts
SET quantity = newQuantity,
updated_at = CURRENT_TIMESTAMP
WHERE id = cartItemId
COMMIT TRANSACTION
ELSE
cartItemId = generateUUID()
BEGIN TRANSACTION
INSERT INTO carts (
id, customer_id, product_id, quantity, added_at
) VALUES (
cartItemId, customerId, productId, quantity,
CURRENT_TIMESTAMP
)
COMMIT TRANSACTION
7. Invalidate Cart Cache:
[Link](customerId)
8. Get Updated Cart Count:
Query: SELECT COUNT(*) as itemCount,
SUM(quantity) as totalItems
FROM carts
WHERE customer_id = customerId
9. RETURN {
success: true,
message: "Added to cart successfully",
cartItemCount: itemCount,
cartTotalItems: totalItems
}
EXCEPTION HANDLING
IF database error THEN
ROLLBACK TRANSACTION
LOG error with context
RETURN {success: false, error: "Unable to add to cart"}
END
Business Rules Enforced:
Maximum 100 units per product
Maximum 50 unique products per cart
Stock validation before adding
Duplicate prevention (update existing item)
Cart persistence across sessions
MODULE 4.0: ORDER MANAGEMENT
4.1 Module Description
Complete order lifecycle management from cart checkout to delivery tracking. Handles payment
processing integration, inventory synchronization, order status workflows, and customer notifications
throughout the order journey.
Key Features:
Atomic checkout transaction processing
Stock reservation during checkout
Multiple payment method support (COD, Online)
Order tracking with status updates
Automatic email notifications
Order history with filtering
Admin order management dashboard
Cancellation and refund handling
4.2 Sub-processes
1. Checkout (4.1) - Process cart items to create order
2. Place Order (4.2) - Finalize order with payment processing
3. Track Order (4.3) - View order status and tracking information
4. Update Status (4.4) - Admin order status management workflow
4.3 Data Structures Used
4.3.1 Order Object
Structure: {
id: String (UUID),
customerId: String,
orderDate: Timestamp,
status: Enum(pending, confirmed, shipped, delivered, cancelled),
totalAmount: Decimal(10,2),
shippingAddress: String,
trackingNumber: String,
paymentMethod: Enum(COD, Card, UPI, Wallet),
paymentStatus: Enum(unpaid, paid, failed, refunded),
createdAt: Timestamp,
updatedAt: Timestamp
}
4.3.2 Order Details Array
Structure: ArrayList<OrderDetail>
OrderDetail: {
id: String,
orderId: String,
productId: String,
productName: String,
quantity: Integer,
unitPrice: Decimal(10,2),
subtotal: Decimal(10,2)
}
Purpose: Line items breakdown for order
Constraint: subtotal = quantity * unitPrice
4.4 Process Logic
4.4.1 Checkout Process
Algorithm: CheckoutOrder(customerId, shippingAddress, paymentMethod, sessionToken)
Input: Customer details, shipping info, payment method
Output: Order confirmation or error
Time Complexity: O(n) where n is cart items
Space Complexity: O(n)
BEGIN
1. Validate Session:
IF NOT isValidSession(sessionToken, customerId) THEN
RETURN {success: false, error: "Session expired. Please login."}
2. Validate Shipping Address:
IF shippingAddress is EMPTY OR length < 10 THEN
RETURN {success: false, error: "Please provide complete address"}
addressComponents = parseAddress(shippingAddress)
IF NOT hasRequiredComponents(addressComponents) THEN
RETURN {success: false, error: "Invalid address format"}
3. Retrieve Cart:
cartResult = ViewCart(customerId, sessionToken)
IF [Link] = 0 THEN
RETURN {success: false, error: "Your cart is empty"}
4. Verify Stock Availability:
unavailableItems = []
FOR EACH item IN [Link]
currentStock = getProductStock(item.product_id)
IF currentStock < [Link] THEN
[Link]({
productName: [Link],
requested: [Link],
available: currentStock
})
IF [Link] > 0 THEN
RETURN {
success: false,
error: "Some items are out of stock",
unavailableItems: unavailableItems
}
5. Generate Order Identifiers:
orderId = generateUUID()
orderNumber = "WM" + DATE("Ymd") + RANDOM(1000, 9999)
// Example: WM202511191234
6. BEGIN DATABASE TRANSACTION
7. Create Order Record:
INSERT INTO orders (
id, customer_id, order_date, status,
total_amount, shipping_address, payment_method,
payment_status, created_at
) VALUES (
orderId, customerId, CURRENT_TIMESTAMP, 'pending',
[Link], shippingAddress,
paymentMethod, 'unpaid', CURRENT_TIMESTAMP
)
8. Create Order Details:
FOR EACH item IN [Link]
orderDetailId = generateUUID()
INSERT INTO order_details (
id, order_id, product_id, quantity,
unit_price, subtotal
) VALUES (
orderDetailId, orderId, item.product_id,
[Link], [Link],
[Link] * [Link]
)
9. Update Product Stock (Inventory Reduction):
FOR EACH item IN [Link]
UPDATE products
SET stock_quantity = stock_quantity - [Link],
updated_at = CURRENT_TIMESTAMP
WHERE id = item.product_id
10. Clear Customer Cart:
DELETE FROM carts
WHERE customer_id = customerId
11. COMMIT TRANSACTION
12. Process Payment:
IF paymentMethod = "COD" THEN
paymentStatus = "pending"
orderStatus = "confirmed"
ELSE
paymentResult = processOnlinePayment(
orderId,
[Link],
paymentMethod
)
IF [Link] THEN
BEGIN TRANSACTION
UPDATE orders
SET payment_status = 'paid',
status = 'confirmed'
WHERE id = orderId
COMMIT TRANSACTION
ELSE
// Rollback order if payment fails
CALL RollbackOrder(orderId)
RETURN {
success: false,
error: "Payment failed: " + [Link]
}
13. Send Notifications:
[Link](customerId, orderId)
[Link]([Link], orderNumber)
14. RETURN {
success: true,
orderId: orderId,
orderNumber: orderNumber,
estimatedDelivery: calculateDeliveryDate(),
message: "Order placed successfully!"
}
EXCEPTION HANDLING
IF any error DURING transaction THEN
ROLLBACK TRANSACTION
RESTORE product stock
LOG error with full context
RETURN {success: false, error: "Order creation failed"}
END
Transaction Safety:
All database operations wrapped in transaction
Automatic rollback on any failure
Stock restoration if payment fails
Idempotency through order ID checking
Prevents double-order placement
MODULE 5.0: REVIEW & FEEDBACK
5.1 Module Description
Customer review and rating system with administrative moderation capabilities. Enables customers to
share product feedback while maintaining quality through admin review approval process. Includes
rating analytics and review helpfulness tracking.
Key Features:
5-star rating system
Text review submission with character limits
Purchase verification (only bought products)
Admin moderation workflow
Inappropriate content filtering
Rating distribution analytics
Review helpfulness voting
Verified purchase badges
5.2 Data Structures & Process Logic
Review Object:
{
id: String (UUID),
customerId: String,
productId: String,
rating: Integer (1-5),
reviewText: String (max 1000 chars),
isApproved: Boolean,
feedback: String,
createdAt: Timestamp
}
Submit Review Algorithm: Validates purchase history, checks for existing reviews, filters
inappropriate content, and queues for admin approval.
MODULE 6.0: ADMIN DASHBOARD
6.1 Module Description
Comprehensive administrative interface providing system monitoring, inventory management,
business analytics, and operational reporting capabilities.
Key Features:
Real-time dashboard metrics
Sales report generation
Inventory management with low-stock alerts
Order status management
Customer account overview
Review moderation queue
Analytics and trends visualization
6.2 Report Generation
Sales Report Algorithm: Aggregates order data by date range, calculates revenue metrics, identifies
top products, and generates category-wise breakdowns with trend analysis.
B. Summary of Data Structures
Module Primary Data Structures Time Complexity Purpose
User Management HashMap (Sessions), Customer Object O(1) Fast session validation
Product Catalog TreeNode (Categories), PriorityQueue O(log n), O(n log n) Navigation, ranking
Shopping Cart HashMap (Cache), CartItem Array O(1), O(n) Fast operations
Order Management ArrayList (OrderDetails), Queue O(1), O(1) Order composition
Review & Feedback PriorityQueue (Moderation) O(log n) Review workflow
Admin Dashboard Metrics Object, Report Arrays O(1), O(n) Analytics
C. Testing Process
Unit Testing
Test each algorithm independently with mock data
Validate edge cases and boundary conditions
Achieve 80%+ code coverage
Integration Testing
Test module interactions (Cart → Order flow)
Verify database transaction integrity
API endpoint validation
System Testing
End-to-end user workflow testing
Performance testing (load simulation: 1000+ concurrent users)
Security testing (SQL injection, XSS, CSRF)
User Acceptance Testing
Real user scenario testing with feedback
Usability testing for UI/UX validation
Beta testing with limited user group
D. Project Metrics
Development Estimates:
Total Hours: 200-250 hours
Lines of Code: 15,000-20,000
Database Tables: 7 core tables
API Endpoints: 40-50 RESTful endpoints
Test Cases: 100+ comprehensive test cases
Documentation Pages: 50+ pages
Technology Stack:
Frontend: HTML5, CSS3, JavaScript, Bootstrap
Backend: PHP 7.4+ with OOP principles
Database: MySQL 5.7+ with InnoDB engine
Architecture: MVC Pattern with RESTful APIs
Document Prepared for: IGNOU BCA Project Synopsis
Section: 5 - Complete Structure
Date: November 19, 2025