A small start-up named "iCommerce" wants to build a very simple online shopping application to sell their products. In order to get to the market quickly, they just want to build an MVP version with a very limited set of functionalities:
- The application is simply a simple web page that shows all products on which customers can filter, sort, and search for products based on different criteria such as name, price, brand, color, ...
- All product prices are subject to change at any time and the company wants to keep track of it.
- A product always shows the latest price when showing on the website
- If the customer finds a product that they like, they can add it to their shopping cart and proceed to place an order.
- For audit support, all customers' activities such as searching, filtering, and viewing product details need to be stored in the database. However, failure to store customer activity is completely transparent to customers and should have no impact on the activity itself.
- Customers can log in simply by clicking the button “Login with Facebook”. No further account registration is required.
- No online payment is supported yet. The customer is required to pay by cash when the product got delivered.
1. System Architecture
2. Components
3. Entity Relationship Diagram & Data Analysis
4. Development and Deployment Guideline
5. CI/CD Workflow
6. Next Steps
Microservices Architecture with Saga Pattern (supporting Distributed Transaction)
-
Web portal designed using Angular
my babe will grow sexy soon ^^
-
System secured by OAuth 2 using Okta (Facebook as indentity provider).
Alternative options: Keycloak, WSO2 Identity Server -
Distributed Transaction handled by Saga Pattern (Orchestration approach)
Alternative options: WSO2 ESB (Enterprise Service Bus)
-
ELK stask for monitoring system, and user data analytics
Elasticsearch will be used for quick search feature. User big data will be proccessed by AI for product recommendation.
-
API Gateway using Spring Cloud Gateway (previously, Netflix Zuu).
Service Discovery and Load Balancing alternatives: Kubernetes, HashiCorp Consul -
Dynamic Configuration using Spring Cloud Config Bus beacause we're going to have clusters with hundreds, even thounsands of nodes :)
- icommerce-portal
iCommerce web portal
- icommerce-parent
iCommerce Parent module stores common dependencies
- icommerce-common
iCommerce Common implements common entities, functions
- icommerce-gateway
API Gateway
- icommerce-discovery
Service Registry and Discovery
- icommerce-core
Core services (will be seperated as Order service, Product service)
- icommerce-orchestrator
Order Orchestrator (Saga Pattern) for Distributed Transaction
- icommerce-inventory
Inventory service
- icommerce-payment
Payment service
- Dockerfile, docker-compose.yml for packaging and containerization
- Based on the requirements, we can see that the Customer, Product, and Order data need to be consistent.
So it's reasonable to have RDBMS handle it. - Here we can use MySQL, or PostgreSQL as they're light weight, and easy to setup on dev machine.
- As a POC, we just use the simple structure as below
- Later on, we should consider MS SQL Server, or Oracle DB for more performance features, and support. Just imagine we have to handle millions of requests, or query million records per seconds 🔔
- As for User Behaviour data like searching, purchasing... we can store in Elasticsearch, MongoDB, Cassandra... for data mining, and recommendation system.
- We can also keep track of the system health, and service calls by using Logging and Reporting system like ELK.
- Java 11
- Apache Maven 3.8
- An Okta Developer account or a Keycloak server
You can easily build, run, and deploy all the services as they're just plain simple Spring Cloud microservices, and Angular app.
- To build backend microservices, please navigate to icommerce-parent directory, and run
$ mvn clean install
- For iCommerce portal, go to icommerce-portal, and execute
$ npm install
-
For backend microservices, please run the built jar file from step 1 or build Docker image, and then run the container
-
For icommerce-portal web app, please run dev
$ npm start
or build release package and then deploy to any HTTP server
The packages can run as (1) standalone apps
OR
run as (2) docker containers
OR
can be deployed to (3) Kubernetes cluster
- Souce code managed, and committed to Git repository
- Release packages built as Docker images
- Docker images stored at Docker Registry
- Kubernetes starts new instances of Docker images
- Jenkins for pipeline, automatic build and deployment
- Adding Data Service component to centralize handling multiple data sources, considering WSO2 Data Services Server (DSS)
- Executing load test and performance test on the whole system on production-ready environment (AWS Cloud, Google Cloud). Tools: SoapUI, JMeter
- Performing security test on the whole system, network. Tools: Burp Suite, Wireshark, Postman
- Implementing Product History
- Developing Shipping Service
- Introducing recommendation system (product sugguestion, best price, best buy)
- Integrating with CRM system for better customer interaction (events, points, coupons, vouchers...)
That's it for now :)
Enjoy and stay tuned for more updates!