Giter VIP home page Giter VIP logo

ecommerce's Introduction

ecommerce

Application with CQRS and Event Sourcing built on Rails and Rails Event Store.

๐Ÿ‘‰ ecommerce.arkademy.dev

imgur

Domains

Event storming (events and commands) - Miro documentation

Domains exist in directories starting at ecommerce.

ecommerce/
โ”œโ”€โ”€ crm
โ”œโ”€โ”€ inventory
โ”œโ”€โ”€ ordering
โ”œโ”€โ”€ payments
โ”œโ”€โ”€ pricing
โ””โ”€โ”€ product_catalog
โ””โ”€โ”€ shipping

Each one has a README introduction:

Application

Order management application lives at rails_application directory.

This application simulates a process of managing orders.

We start with a list of exiting products and customers (populated with seeds).

UI flow

Customer perspective

The customer perspective is "simulated" only - via using the select box.

  • Add/remove some of the existing products to the order
  • Choose the customer
  • Submit the order
    • after this you can't update the order items or customer
    • it generates the order number like "2021/03/20" (the last part is random(100))
  • Look at the order
  • Look at the history of events (in the Rails Event Store Browser)

Read models

There's only one read model - which helps us listing all the orders and individual order details.

It consists of 2 ActiveRecord classes: Order and OrderItem.

Process Managers

Release payments when order expired

There's a process manager responsible for dealing with the process of expiring orders.

It takes the following events as the input:

  • Ordering::OrderSubmitted
  • Ordering::OrderExpired
  • Ordering::OrderPaid
  • Payments::PaymentAuthorized
  • Payments::PaymentReleased

When certain conditions are met the process manager return a ReleasePayment command.

Confirm order when payment successful

Another process manager is responsible for confirming order. It does it, when a successful payment is detected.

The Big Vision

This project has several high-level goals:

  • to show that it's possible to modularize a non-trivial Rails app
  • to serve as an example of a DDD project (not only in Rails)
  • to let people play with this codebase to get a feel if DDD is for them
  • to show that tests can be fast if the app is well modularized
  • to show a proper pyramid of tests
  • to teach event-driven architectures
  • to show how to use RailsEventStore
  • to bring DDD enthusiasts from .Net/Java/PHP/others to the Ruby world ๐Ÿ˜Ž
  • to popularize professional testing techniques - mutation testing
  • to allow programmers to reuse existing and popular domains
  • to build new apps like Lego

Contributing guide

We welcome all the contributors here.

As you see, this project is not an usual Rails project. Many Rails conventions are not followed here. Usually there's a good reason for that. Trust us, but feel free to challenge our decisions.

As for the local dev setup:

  • we use Makefile, so make install should simplify a lot
  • there's docker-compose in the rails_application, if you're into Docker

Things worth knowing about:

  • Zeitwerk is not used here - you need to be explicit with requires
  • Any IDE should work with this codebase
  • We use mutant for mutation testing, code that is untested breaks the build.
  • But sometimes we allow ourselves for mutant ignores (explicit mark for mutant to ignore)
  • Mutant ignores are considered technical debt.
  • REST is not followed here for routes, no need for that
  • register_command accepts events because it's used in the /architecture view. It's a visualisation/documentation of the events flow
  • Certain ideas are in the Work In Progress status - sorry about that
  • Feel free to ask.
  • After you make a contribution, we'll invite you to a special Discord
  • Contributing is a good way to learn DDD/CQRS/Event sourcing.

I like it, where can I learn more about all those DDD concepts?

Over time we have developed a number of DDD-related online courses. We now sell them as part of one membership access via arkademy.dev for $49/month.

ecommerce's People

Contributors

mostlyobvious avatar andrzejkrzywda avatar mpraglowski avatar pjurewicz avatar dependabot[bot] avatar fidel avatar ortegacmanuel avatar antonpaisov avatar dependabot-support avatar bbuchalter avatar fpacanowski avatar jandudulski avatar porbas avatar ag4ta avatar sardaukar avatar caws avatar hugohernani avatar kennethkalmer avatar swistak35 avatar wlk avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.