BUCKYVERSE

This document captures the results of our event storming session for the book building system, providing a foundation for our Elixir migration. The analysis maps the current system's behavior through domain events, commands, actors, aggregates, policies, and identified pain points.

Domain Events (Orange)

Domain events represent significant occurrences in the system that domain experts care about.

Metadata Phase

Directory Setup Phase

Build Phase

Quality Check Phase

Commands (Blue)

Commands represent actions that trigger domain events.

Actors (Yellow)

Actors represent users or systems that initiate commands.

Aggregates (Green)

Aggregates represent clusters of domain objects that are treated as a unit.

Pain Points (Red)

Pain points represent areas of friction or difficulty in the current system.

Policies (Purple)

Policies represent business rules that react to events and may trigger new commands.

Elixir Architecture Mapping

Based on this event storming, here's how we map to an Elixir architecture:

Supervision Tree

Codexis.Supervisor
├── BookBuilderOrchestrator
├── MetadataHandler
├── FileStructureSetup
├── BuildManager
│   ├── PDFBuilder
│   ├── EbookBuilder
│   │   ├── EPUBBuilder
│   │   ├── MOBIBuilder
│   │   └── KindleBuilder
│   ├── MarkdownBuilder
│   └── WikiJSBuilder
└── QualityChecker
    ├── EPUBCheck
    ├── ACECheck
    └── PDFDiff

Core Modules

  1. Codexis.BookBuilderOrchestrator - Main orchestrator GenServer
  2. Codexis.MetadataHandler - Metadata management
  3. Codexis.FileStructureSetup - Directory structure management
  4. Codexis.BuildManager - Build process coordination
  5. Codexis.Builder.* - Format-specific builders
  6. Codexis.QualityChecker - Quality check coordination

Event System

Implementation using Phoenix.PubSub:

defmodule Codexis.Events do
  @moduledoc """
  Event bus for the book building system
  """
  
  def publish(event_name, payload) do
    Phoenix.PubSub.broadcast(Codexis.PubSub, event_name, {event_name, payload})
  end
  
  def subscribe(event_name) do
    Phoenix.PubSub.subscribe(Codexis.PubSub, event_name)
  end
end

Next Steps

  1. Implement core GenServers and supervision tree
  2. Develop format-specific builders
  3. Integrate quality checking tools
  4. Create comprehensive testing strategy
  5. Document tool dependencies and setup requirements