2

E-commerce modules worth extracting in the code

 3 years ago
source link: https://dev.to/andrzejkrzywda/e-commerce-modules-worth-extracting-in-the-code-1a57
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

E-commerce modules worth extracting in the code

Apr 21

・2 min read

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 :)


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK