Hello World Example

Use this tiny example to learn the shape of a Code Genie model without domain complexity.

Scenario

A user opens a page, enters a name, and the generated system returns a greeting. This is not a DDD showcase. It is a friendly smoke test for commands, events, read models, and generation.

Canvas Blocks

  • Actor: Visitor.
  • User Interface: Greeting Page.
  • Command: Say Hello.
  • Aggregate: Greeting.
  • Domain Event: Greeting Requested.
  • Read Model: Greeting Message.
  • Query: Show Greeting Message.

Command Configuration

  • Name: Say Hello.
  • Input fields: visitorName.
  • Validation: visitorName is required and must be short enough to display.
  • Target aggregate: Greeting.
  • Success event: Greeting Requested.

Event Configuration

  • Name: Greeting Requested.
  • Payload: greetingId, visitorName, requestedAt.
  • Business meaning: a visitor asked the system to create a greeting.
  • Read model updated: Greeting Message.

Read Model Configuration

  • Name: Greeting Message.
  • Fields: greetingId, message, requestedAt.
  • Projection rule: when Greeting Requested happens, set message to “Hello, {visitorName}.”
  • Query: Show Greeting Message by greetingId.

Generated Behaviour

  1. Visitor opens Greeting Page.
  2. Visitor submits Say Hello with a name.
  3. Greeting aggregate accepts the command.
  4. Greeting Requested is recorded.
  5. Greeting Message read model displays the generated greeting.

What This Teaches

Hello World shows the basic generation loop: actor, interface, command, aggregate, event, projection, query, and read model. Real business systems use the same shape, but with richer rules and consequences.