Rewrite example: full working app with projections, automations, and no circular refs #21

Closed
opened 2026-02-19 21:28:52 +00:00 by ash · 1 comment
Owner

Problem

Current example (order-processing) is deciders-only. No projections, no automations, no CommandBus, no subscriptions. The package-per-slice structure will cause circular reference issues when projections need events from multiple slices or automations send commands across slices.

Required

Full working example demonstrating ALL three event modeling patterns:

State Changes (Commands → Events)

  • CreateOrder, AddItem, SubmitOrder, ShipOrder, CancelOrder
  • All wired through CommandBus with single writer

State Views (Projections)

  • OrderListProjection: list of all orders with status
  • OrderDetailProjection: full order details
  • OrderTotalProjection: revenue totals
  • All using EventSubscription with guaranteed delivery

Automations (Event → Command)

  • OrderSubmitted → trigger payment processing
  • PaymentConfirmed → trigger shipping
  • OrderShipped → send notification

Package Structure (no circular refs)

examples/order-system/
  domain/           # shared types: events, commands, state
    events.go       # ALL event types
    commands.go     # ALL command types  
    state.go        # decision model
  slices/           # vertical slice handlers
    create_order.go
    add_item.go
    submit_order.go
    ship_order.go
    cancel_order.go
  projections/      # read models
    order_list.go
    order_detail.go
    revenue.go
  automations/      # event reactions
    payment.go
    shipping.go
    notification.go
  main.go           # wires everything together

Events and commands live in domain/ — everything imports domain, nothing imports each other. Zero circular refs.

Key: Must Actually Run

  • go run main.go starts the app
  • HTTP endpoints for sending commands
  • SSE endpoint for live updates via watchers + Datastar
  • SQLite store
  • Everything wired: CommandBus → Store → Subscription → Projections + Automations

Tests

  • Integration test: full flow from CreateOrder to ShipOrder
  • Verify projections update correctly
  • Verify automations trigger correctly
  • Verify GDPR forget works end-to-end
## Problem Current example (order-processing) is deciders-only. No projections, no automations, no CommandBus, no subscriptions. The package-per-slice structure will cause circular reference issues when projections need events from multiple slices or automations send commands across slices. ## Required Full working example demonstrating ALL three event modeling patterns: ### State Changes (Commands → Events) - CreateOrder, AddItem, SubmitOrder, ShipOrder, CancelOrder - All wired through CommandBus with single writer ### State Views (Projections) - OrderListProjection: list of all orders with status - OrderDetailProjection: full order details - OrderTotalProjection: revenue totals - All using EventSubscription with guaranteed delivery ### Automations (Event → Command) - OrderSubmitted → trigger payment processing - PaymentConfirmed → trigger shipping - OrderShipped → send notification ## Package Structure (no circular refs) ``` examples/order-system/ domain/ # shared types: events, commands, state events.go # ALL event types commands.go # ALL command types state.go # decision model slices/ # vertical slice handlers create_order.go add_item.go submit_order.go ship_order.go cancel_order.go projections/ # read models order_list.go order_detail.go revenue.go automations/ # event reactions payment.go shipping.go notification.go main.go # wires everything together ``` Events and commands live in `domain/` — everything imports domain, nothing imports each other. Zero circular refs. ## Key: Must Actually Run - `go run main.go` starts the app - HTTP endpoints for sending commands - SSE endpoint for live updates via watchers + Datastar - SQLite store - Everything wired: CommandBus → Store → Subscription → Projections + Automations ## Tests - Integration test: full flow from CreateOrder to ShipOrder - Verify projections update correctly - Verify automations trigger correctly - Verify GDPR forget works end-to-end
ash changed title from Example app: full vertical slice with all eskit features to Rewrite example: full working app with projections, automations, and no circular refs 2026-02-19 21:30:55 +00:00
ash closed this issue 2026-02-20 00:29:56 +00:00
Author
Owner

Example rewritten with all 3 event modeling patterns, no circular refs. Domain/slices/projections/automations package structure.

Example rewritten with all 3 event modeling patterns, no circular refs. Domain/slices/projections/automations package structure.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ash/eskit#21
No description provided.