Skip to content

tsobe/lobiani

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Backend Quality Gate Status
Admin Quality Gate Status
Shopping Quality Gate Status
CI CircleCI

Motivation

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.

Desired areas to examine

  • Event Sourcing
  • DDD
  • CQRS
  • TDD/BDD
  • Microservices
  • CI/CD
  • Cloud native technologies
  • Machine Learning

High level requirements

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

Domain model

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.

Bounded contexts

  • 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

Event Storming - Ubiquitous Language

Event Storming (Click on the image for the interactive diagram)

Architecture Diagrams

Diagram as a code is defined in DSL following the C4 modelling. Read more here.

System Context view

System Context view System Context view legend

Container view

Container view Container view legend

Component view

Component view Component view legend

CI/CD

Continuous Deployment is implemented in a GitOps fashion. This monorepo contains project sources as well as manifest files (config).

Monorepo CI/CD (Click on the image for the interactive diagram)

Backlog

  • 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

Development process and roadmap

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.

Milestones

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

Building and running

The backend

from app-backend directory

  1. Build and test
    ./gradlew build
    
  2. Start Axon server
    docker run -d --restart unless-stopped --name axonserver -p 8024:8024 -p 8124:8124 axoniq/axonserver:4.4
    
  3. Start the backend
    export SERVER_PORT=9090 && ./gradlew bootRun
    

The admin

To build test and run, execute following commands from admin directory

npm install
npm run test:unit
npm run serve

The shopping

To build test and run, execute following commands from shopping directory

npm install
npm run test
npm run dev

Run E2E tests locally

Prerequisites

  • backend, admin and shopping are running
  • JDK 11 (hint jenv)

With a remote WebDriver

  1. 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
    
  2. Execute the tests from e2e-tests directory
    ./gradlew test \
        -Dtest.admin.user=<user> \
        -Dtest.admin.password=<password>
    

With a local Firefox

  1. Download geckodriver (0.29.0 or later)
  2. Execute the tests from e2e-tests directory
    ./gradlew testLocalFirefox \
        -Dtest.admin.user=<user> \
        -Dtest.admin.password=<password>
    

Live demo

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.

Known issues

  • Gradle for Groovy DSL doesn't work with JDK 14, more info here.

Resources