CRUD Example Library

CRUD examples are included for clarity. Code Genie supports them, but they are not where the power of DDD usually appears.

TODO List

Use CRUD when TODO items are personal or lightweight team tasks without complex workflow.

  • Commands: Create Todo Item, Update Todo Item, Complete Todo Item, Delete Todo Item.
  • Events: Todo Item Created, Todo Item Updated, Todo Item Completed, Todo Item Deleted.
  • Read models: Todo List, Todo Item Detail, Completed Todo History.
  • Queries: Show Open Todo Items, Show Completed Todo Items, Search Todo Items.
  • Rules: title required, completed items can be reopened, deleted items are hidden by default.

See the TODO tutorial for the behaviour-rich version with assignment, reminders, and escalation.

Supplier Directory

Use CRUD when the goal is to maintain supplier records and search them.

  • Commands: Create Supplier, Update Supplier, Archive Supplier.
  • Events: Supplier Created, Supplier Updated, Supplier Archived.
  • Read models: Supplier Search Result, Supplier Detail.
  • Queries: Search Suppliers, Get Supplier Detail.
  • Rules: supplier name required, tax id unique, archived suppliers hidden by default.

Upgrade this to DDD only if supplier onboarding, due diligence, risk review, approval, or compliance renewal becomes important.

Product Reference Catalogue

Use CRUD when users manage product reference information that other systems consume.

  • Commands: Add Product, Update Product, Archive Product, Assign Category.
  • Events: Product Added, Product Updated, Product Archived, Product Category Assigned.
  • Read models: Product Search Result, Product Detail, Category List.
  • Queries: Search Products, Get Product Detail, List Active Categories.
  • Rules: SKU unique, category required for active product, archived products unavailable for new orders.

Upgrade this to DDD if pricing, bundling, inventory allocation, approvals, publication workflow, or compliance checks become central.

CRUD Modelling Checklist

  • Use plain create, update, archive, and delete commands only when they match the business language.
  • Still emit useful events for audit and integrations.
  • Still model value objects for email, money, address, and other reusable values.
  • Do not invent aggregates, policies, or sagas unless there is real behaviour to protect.