Event-driven, serverless cloud topology engineered for zero idle compute costs, atomic inventory reservations, and automatic scaling during high-traffic textile sale events.
Single-table entity domain model, order state progression automata, atomic inventory reservation logic, and idempotent payment webhook handling.
During high-traffic textile drops, overselling is physically prevented using DynamoDB TransactWriteItems condition expressions. Stock is decremented and order record created in one atomic transaction.
Strict state automata transitions: PENDING → PAYMENT_PROCESSING → CONFIRMED → SHIPPED → DELIVERED. Cancellations enforce automated refund requests via Paytm before inventory restock.
Paytm payment callbacks are cryptographically verified using HMAC-SHA256 checksums and checked against an idempotency ledger to prevent duplicate fulfillment or double refunds.
Global Secondary Indexes (GSI1-PK/SK) allow retrieval of customer order histories, product catalog listings, and category trees with zero relational JOIN penalties.
Event-driven, serverless cloud topology engineered for zero idle compute costs, atomic inventory reservations, and automatic scaling during high-traffic textile sale events.
Zero idle compute costs. AWS Lambda (ARM64 Graviton) scales from 0 to thousands of concurrent executions instantaneously during flash sales, billed per millisecond of compute.
CloudFront CDN with AWS WAF protects against DDoS, brute force, and injection attacks. Origin Access Control (OAC) ensures S3 asset buckets cannot be accessed directly from the public internet.
Single-table DynamoDB replicates data across 3 AWS Availability Zones synchronously. Point-in-time recovery (PITR) preserves continuous backups with zero operational maintenance.
Static web assets served globally via CloudFront with sub-20ms edge latencies. Lambda cold starts minimized to under 250ms via bundled ES modules. RPO = 0, RTO < 60 seconds.
To avoid RDS connection pooling overhead and cold-start connection penalties, all entities reside in a single high-performance DynamoDB table.
| Entity | Partition Key (PK) | Sort Key (SK) | GSI1-PK / GSI1-SK | Attributes |
|---|---|---|---|---|
| Product | PRODUCT#<productId> |
METADATA |
CATEGORY#<slug> / PRICE#<cents> |
Title, SKU, basePrice, images, stockCount, tags |
| Product Variant | PRODUCT#<productId> |
VARIANT#<variantId> |
SKU#<skuCode> / METADATA |
Color, size, fabric, stockQuantity, priceDelta |
| Customer Order | ORDER#<orderId> |
DETAILS |
CUSTOMER#<custId> / CREATED#<isoDate> |
Items, totalAmount, status, paytmTxnId, shippingAddress |
| Order Item | ORDER#<orderId> |
ITEM#<sku> |
— | Unit price, quantity, color, product title |
| Inventory Lock | LOCK#<sku> |
ORDER#<orderId> |
— | Reserved units, lockExpiresAt (TTL attribute) |
Atomic state transitions ensure no double-charging, no phantom inventory reservations, and 100% automated refund processing.
Customer initiates payment. Inventory reservation lock is created with a 15-minute TTL. Transaction token generated via Paytm API.
Asynchronous webhook from Paytm received. HMAC checksum validated. If verified, order status updates to CONFIRMED and stock is permanently decremented.
Shiprocket AWB generated automatically. Label printed in merchant desk. Customer receives tracking SMS & email.
If cancelled by merchant or customer, Lambda calls Paytm Refund API. On success, stock units are atomically incremented back to inventory.