Atomic Repositories in Clean Architecture and TypeScript
You’re checking out on an e-commerce site. You have a cart with several items and quantities, and you click the checkout button. Under the hood, the operation flow might look like this: But alas, if you’ve designed your e-commerce site like this, you have likely created an atomicity problem. Atomicity in the Repository Pattern occurs when multiple repositories execute their queries in one transaction. If one query fails, all of them fail and must be rolled back.