Cart and pricing microservices
Bruno's first assignments at Lalalab, in summer 2021: moving pricing (August 2021) and then the cart (September 2021) out of the PHP monolith into MoleculerJS microservices.
Pricing, built with functional programming
The price calculation applies percentage discounts, fixed-amount discounts, coupons, priority prices, shipping costs… Bruno wrote it as a chain of pure functions ("apply a discount", "compute a subtotal"…).
The choice and its trade-off: a style less familiar to the rest of the team, but fully predictable behaviour — same input, same price — and very fine-grained unit tests, case by case. The service reached 100% test coverage within its first weeks.
The cart
The cart orchestrates pricing, coupons, perks and shipping, and persists everything in a single transaction. This is the service that later ran into database lock issues. → Deadlocks on the cart database