CRM Example: Custom Customer Relationship Management

Demonstrates modeling a CRM domain with domain events, commands, aggregates, and read models. No JavaScript; semantic HTML only.

Overview

A CRM system typically tracks customers, leads, opportunities, accounts, and activities. This example shows a minimal domain model that supports creating customers, managing contacts, and progressing leads through a sales pipeline.

Domain Model

  • Aggregates: Customer
  • Entities: Customer, Account, Lead, Opportunity, Contact
  • Domain Events: CustomerCreated, CustomerUpdated, LeadCreated, LeadConverted, OpportunityCreated
  • Value Objects: Email, PhoneNumber, Address

Commands

  • CreateCustomer
  • UpdateCustomer
  • CreateLead
  • ConvertLeadToOpportunity
  • CreateOpportunity

Read Models & Projections

  • CustomerProfile
  • OpportunitySummary
  • ActivityFeed

Lifecycle Example

  1. Create a Customer with basic details
  2. Add Contacts and an Account
  3. Capture a Lead and convert to Opportunity
  4. Move Opportunity to Won/Lost with final status

Diagram & Illustration

CRM workflow illustration
Illustrative CRM workflow showing customers, leads, opportunities, and activities.