Backend | |
Admin | |
Shopping | |
CI |
This project is a personal exercise to improve skills in various software engineering practices, will it be coding disciplines, architecture, technologies and anything in between or around them.
See live demo below.
- Event Sourcing
- DDD
- CQRS
- TDD/BDD
- Microservices
- CI/CD
- Cloud native technologies
- Machine Learning
Develop eCommerce system capable of:
- Managing stock levels in the inventory
- Providing ways of searching and browsing through the available products and purchasing them
- Handling billing and shipping
- Recommending products to customers based on their purchase history
Disclaimer: I don't have a practical experience in the eCommerce domain, so model described here may seem utterly inadequate. However, for the sake of this exercise (despite DDD being one of the primary focus), I hope that something will work out.
- Inventory - managing stock levels
- Marketing - describing and presenting products to sell
- Sales - dealing with pricing rules, and the overall shopping experience
- Billing - charging customers to execute the orders
- Shipping - delivering orders to customers
- Personalization - recommending products to customers
(Click on the image for the interactive diagram)
Diagram as a code is defined in DSL following the C4 modelling. Read more here.
Continuous Deployment is implemented in a GitOps fashion. This monorepo contains project sources as well as manifest files (config).
(Click on the image for the interactive diagram)
- As an inventory operator I want to define an item so that actual items can be added to stock
- As an inventory operator I want to add item to stock so that it can be purchased by customers
- As a marketing manager I want to describe product so that all the important information is presented to the customer
- As a marketing manager I want to publish/unpublish product to control whether a product will be visible (and hence sellable) to customer
- As a sales manager I want to assign price to a product so that customer can be charged appropriately
- As a customer I want to browse through the list of all available products so that I can get some idea about what's available for sale
- As a customer I want to search a particular product(s) by name or description so that I can filter out irrelevant items
- As a customer I want to see the details of the particular product so that I can get more information
- As a customer I want to add the product to the cart so that I can purchase it later
- As a customer I want to remove possibly mistakenly added product from the cart so that I can select a better option
- As a customer I want to proceed to payment so that I can see the summary before I actually pay
- As a customer I want to cancel the purchase if I changed my mind
- As a customer I want to fill billing and shipping information so that I can be charged and product can be shipped
- As a customer I want to see recommended products based on my purchase history so that suggestions are personalized for me
- As a courier I want to update delivery status so that customers see the progress
Monolith-first approach will be followed where initially entire backend system is delivered as
a single deployment unit, however it will be still modular internally, to allow easier transition
to microservices. There's going to be a separate deployment units for the admin
and shopping
(SPAs).
See ADR for more info.
Milestone | High level objectives | Date |
---|---|---|
Milestone 1 | ✓ System allows to define and add inventory items to stock ✓ System allows to define and see the products available for sale ✓ User interface is not ugly ✓ Admin area is accessible to authenticated users only ✓ Basic metrics such as HTTP success rate, latency and etc. are available ✓ Basic CI/CD pipeline exists |
April 1 2021 |
from app-backend
directory
- Build and test
./gradlew build
- Start Axon server
docker run -d --restart unless-stopped --name axonserver -p 8024:8024 -p 8124:8124 axoniq/axonserver:4.4
- Start the backend
export SERVER_PORT=9090 && ./gradlew bootRun
To build test and run, execute following commands from admin
directory
npm install
npm run test:unit
npm run serve
To build test and run, execute following commands from shopping
directory
npm install
npm run test
npm run dev
- backend, admin and shopping are running
- JDK 11 (hint jenv)
- Download and start selenoid and optionally selenoid-ui
curl -s https://aerokube.com/cm/bash | bash \ && ./cm selenoid start --vnc --tmpfs 128 \ && ./cm selenoid-ui start
- Execute the tests from
e2e-tests
directory./gradlew test \ -Dtest.admin.user=<user> \ -Dtest.admin.password=<password>
- Download geckodriver (0.29.0 or later)
- Execute the tests from
e2e-tests
directory./gradlew testLocalFirefox \ -Dtest.admin.user=<user> \ -Dtest.admin.password=<password>
Tool | Address | Comments |
---|---|---|
Admin | admin.lobiani.baybay.dev | requires authentication (but anyone can) |
Shopping | lobiani.baybay.dev | main frontend for public use |
For feature documentation, you may want to explore these issues.
NOTE: system gets shut down from time to time to save the costs.
- Gradle for Groovy DSL doesn't work with JDK 14, more info here.
- Microservices, bounded context, cohesion. What do they have in common?
- Introduction into Microservices
- Example of Service Boundaries Identification Example 1
- Example of Service Boundaries Identification Example 2
- Tackling Complexity in Microservices
- Bounded Contexts are NOT Microservices
- Backend for frontend
- Service mesh
- Scaling Microservices with an Event Stream
- Ports and Adapters
- Domain-Driven Design: Everything You Always Wanted to Know About it, But Were Afraid to Ask
- Feature flags
- Microservices as an Evolutionary Architecture
- Exposing CQRS Through a RESTful API
- A Comprehensive Guide to Contract Testing APIs in a Service Oriented Architecture
- Strategic Domain Driven Design with Context Mapping
- Modelling Reactive Systems with Event Storming and Domain-Driven Design
- CQRS: What? Why? How?
- DDD and Messaging Architectures