VivaTech - E-Commerce Solution
System design for a SaaS company hosting physical & online stores.
SYSTEM DESIGN
Mirza Usman Tahir
2/27/20243 min read


Problem Statement:
VivaTech is a SaaS Platform that allows its customers to sell inventory via multiple channels at the same time be it digital or physical. For example, a customer may have a physical store where they sell phones but may also want to sell through Amazon, Ebay, Aliexpress, Daraz etc.
Each customer would have their own accounts where they can manage their own listings.
On the SaaS Platform, A customer can list inventory, manage quantity and integrate with digital channels (Amazon, Ebay, AliExpress, Daraz) and when an item is purchased on any of the digital platforms, the quantity should be synced to other platforms.
For example: Let's say a customer has an inventory of 100 phones that they list on 4 digital channels. The customer gets 1 phone order from 1 digital channel, now the total remaining inventory of the phones is 99. This updated inventory should be reflected automatically in other channels.
For VivaTech, the actions of inventory changes (adding new inventory to the system, subtracting it when a new order comes) are very important and must be processed at all costs. The sequence of the inventory changes is also an important business requirement for VivaTech. VivaTech currently has 5000 active customers using their service but their plans are to grow 10x in the next 2 years.
Functional Requirements:
Inventory Management:
Allow customers to list, update, and manage their inventory across multiple channels.
Support operations such as adding new inventory, updating quantities, and removing inventory items.
Real-time Sync:
Ensure real-time synchronization of inventory quantities across all digital channels when changes occur.
Instantly reflect inventory updates made by customers or orders received from digital platforms to maintain accurate stock levels.
Customer Account Management:
Provide customers with accounts to manage their listings, inventory, and integrations with digital channels.
Support authentication, authorization, and account settings management functionalities.
Digital Channel Integration:
Integrate with various digital channels such as Amazon, eBay, AliExpress, and Daraz to enable selling inventory on these platforms.
Facilitate seamless communication and data exchange between the platform and external digital channels.
Event Processing:
Ensure reliable and timely processing of inventory change events, including additions, updates, and deletions.
Maintain the sequence of inventory change events to accurately reflect the order of operations.
Non-Functional Requirements:
Scalability:
The system should be able to handle the current load of 5000 active customers and scale easily to support 10 times the load in the next 2 years.
Ensure horizontal scalability to accommodate increased traffic and data volume without sacrificing performance.
High Availability:
Maintain high availability to ensure uninterrupted access to the platform for customers.
Minimize downtime and implement fault-tolerant measures to mitigate the impact of potential failures.
Performance:
Provide low-latency responses for inventory management operations and real-time updates.
Optimize system performance to handle concurrent requests and process events efficiently.
Security:
Implement robust security measures to protect customer data, authentication mechanisms, and communication channels.
Ensure compliance with relevant security standards and regulations.
Reliability:
Ensure the reliability of inventory synchronization across digital channels to prevent discrepancies and errors.
Implement mechanisms for error detection, handling, and recovery to maintain data integrity and consistency.


Proposed Design(Click to zoom):
Flow & Components:
Client Applications:
Customer-facing applications for managing inventory, listings, and integrations. Technology used can be React/Angular. While angular is preferred due to large size of product.
API Gateway:
Acts as a single entry point for client applications to access backend services.
Handles authentication, request routing, and API management.
Authentication Service:
Authenticates users and issues access tokens for secure API access. AWS Cognito or any third party service can be used.
Load Balancer:
Distributes incoming traffic across multiple Node.js application servers for scalability and fault tolerance.
Node.js Application Servers:
Backend servers asynchronously handling client requests and WebSocket connections.
WebSocket Server:
Facilitates real-time communication of available stock between clients and servers.
Redis:
In-memory cache for caching frequently accessed products data.
Amazon SQS:
Queues inventory change events for processing in sequence. Can be used for both physical store events and virtual store events.
Inventory Processor (Node.js Workers):
Scalable worker processes for processing inventory change events.
Amazon RDS:
MySQL or Postgres can be used here due to requirement of ACID properties and facilitate data queries.
However, as VivaTech plans to scale rapidly over the next two years, it's crucial to carefully consider MySQL's scalability limitations compared to NoSQL databases like DynamoDB. While MySQL can handle significant traffic and data volume, it may require careful planning and optimization to ensure optimal performance as the system grows.
Amazon S3:
Storage for product images and static assets. Can also utilize CDNs additionally in case of speed optimization requirement.
Integration Modules:
Handles integration with external digital channels APIs. It may include utilizing webhooks of the target systems to listen inventory events and REST APIs to add new stock.
Monitoring and Alerting:
CloudWatch Metrics: Monitor API Gateway, Load Balancer, and backend services for performance metrics.
Custom Alarms: Set up alarms for critical metrics related to API Gateway, Load Balancer, and authentication service.
SNS Notifications: Send Email & SMS alerts for failures or performance issues in the system.
Contacts
mirzausman501@gmail.com
Subscribe to my newsletter
+923315423062