DEV Community

Andrzej Krzywda
Andrzej Krzywda

Posted on

E-commerce modules worth extracting in the code

When you work on a non-trivial e-commerce application the complexity is usually, well non-trivial too.

E-commerce is one of this kind of apps, where just following a CRUD approach may not be enough.

Here is a list of modules (definitely not a full list) that might be worth having as separate, in order to avoid coupling.

Ordering

This is a classic one. If you have no modules in your e-commerce code then you can call it Ordering anyway, because that's the most important.
Some possible operations (commands) here:

  • initiate an order (usually with some items from the cart)
  • confirm the order (so that other modules are aware)

Ecommerce

I recently like to call this Ecommerce - a module which contains the logic around the cart concept.

Catalog

This module allows adding products to the offer visible to the clients.

Inventory

Keep track of how many items are left. Sometimes booking too.

Pricing

Pricing is usually not as trivial as just assigning a price to one product. USually we have a whole range of pricing strategies that change over time. It's nice to encapsulate them and keep it separate from other modules.

Payments

Keep track of what was paid for. Sometimes your order will be paid in multiple payments, sometimes it's not fully paid. Sometimes you pay for multiple orders with one payment - hadle this logic here.

Sample application with ecommerce modules

I'm working on sample application which shows some of those concepts. It started as a ordering system, but now it's in a process of becoming an e-commerce app too.

https://github.com/RailsEventStore/cqrs-es-sample-with-res

Are there any other modules that you like to extract in ecommerce apps? Share them in the comments :)

Top comments (3)

Collapse
 
aleron75 profile image
Alessandro Ronchi

IMO the following two subdomains are missing unless you didn't include them elsewhere:

  • Customers
  • Shipments
Collapse
 
andrzejkrzywda profile image
Andrzej Krzywda

Good point!

I was wondering if Customers could be called CRM - what do you think? Is it the same concepts?

Agree on Shipments (sometimes can be called Delivery too).

Collapse
 
aleron75 profile image
Alessandro Ronchi

Yes, I confirm that Customers are related to CRM