To illustrate how to use a single entity as an aggregate root in DDD, let's look at some examples from different domains. One example is an order in an e-commerce domain. An order is an entity that represents a customer's purchase of one or more products. An order has a unique identifier, a status, a total amount, and a collection of order lines. Each order line is a value object that contains the product, the quantity, and the price. An order is an aggregate root that controls the access and behavior of the order lines, and that enforces the business rules and invariants of the order, such as checking the availability of the products, calculating the total amount, and changing the status.
Another example is a bank account in a banking domain. A bank account is an entity that represents a customer's financial balance and transactions. A bank account has a number, a balance, and a list of transactions. Each transaction is a value object that contains the amount, the date, and the type. A bank account is an aggregate root that controls the access and behavior of the transactions, and that enforces the business rules and invariants of the bank account, such as validating the amount, updating the balance, and applying the fees.