<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="365068" data-post-id="365068">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="vasspilka" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/vasspilka/120/2026_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  vasspilka
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>It’s true that Ash does not enforce you to a specific architecture, one could definitely use Ash along with CQRS by for example have the Ash resources being constructed through the projections (effectively the “read-only” state that must only be updated as a result of an event being handled).</p>
<p>But the main point here is that using ES is a shift in mindset on how we approach solving business problems with software. My argument is that if one uses Ash as the main library to drive their modeling decisions they will likely be limited in the modeling they will end up doing. As <a class="mention" href="/u/yordisprieto" rel="nofollow">@yordisprieto</a> mentioned there are some core concepts of ES that in Ash exist through resources. For example one could easily make a projection as a standalone GenServer or whatnot, but they would have to insert the events as actions that belong to a Resource, so you already have to have a Resource to emit an event. It makes Resources as the core concept instead of Events.</p>
<p>The question I would ask is can you emit an event without needing a specific resource? If yes you can model ES effectively, if not you are constrained by resource oriented architecture (in effect even though Ash itself does not enforce an architecture, developers can build their architecture around Ash resources).</p>
<p>That being said, I think you can have ES and Ash separately in the same application (ES managing Events and Ash being the Application state) , Ash is indeed a really good abstraction around modeling resource oriented state, and at the end of the day even in ES software the “read-only” (updated only as a result of an event) state is usually resource oriented.</p>
<p>Finally something that is often misunderstood is that ES will be the dominant architecture in an application. That’s not necessary or effective, usually you only want to use ES on a subset of the core domain problems and most of your application can just use whatever other architecture is most convenient to you.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="365068" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/ashevents-event-sourcing-made-simple-for-ash/70777/32">Post #31</a>
	                </div>
	            </div>
              <div id="likers-container-365068" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="365068"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #31"></div>
  </section>
</div>
    <div class="postbit" id="365070" data-post-id="365070">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="vasspilka" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/vasspilka/120/2026_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  vasspilka
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Hey,</p>
<p>So as per my earlier post I think the main advantage of ES (when coupled with DDD) is the shift in how software is designed and modeled.</p>
<aside class="quote no-group" data-username="vasspilka" data-post="16" data-topic="70777">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/vasspilka/48/2026_2.png" class="avatar"> vasspilka:</div>
<blockquote>
<p>the main benefit is the ability to handle ever increasing complexity on a logarithmic curve</p>
</blockquote>
</aside>
<p>I like to compare it a bit to the shift of mindset in functional immutable programming and OOP (though it’s in fact it’s a quite different comparison), the former can handle increasing complexity on a smoother curve than the latter. Let’s see why.</p>
<p>When you are handling state in a traditional application you really don’t know how/why that state got there, for all you know someone might have went to the production database and updated a couple of rows of data. In other words the application state is itself “The source of truth” but the problem with that you don’t know how it got to that state, ofcourse you can have audit logs, transactional tables etc, but at the end most applications will not store all data changes as some audit log. This results in a situation where you <strong>can’t be sure why</strong> a specific applications state has the value it has.</p>
<p>ES flips that around, it sais the “audit log” or better yet event log, is the source of truth, it’s an immutable append only database and the application state is derived from that log (not all application state must be ES). This offers the advantages that now you <strong>know why</strong> a specific state is what it is, and <strong>if not you can fix it</strong>. Also you can decide to construct a new state or update existing state based on that event log.</p>
<p>Let’s see in practice how can that work. You are a fintech company, your core domain is dealing with financial transactions, this may be double entry accounting, but also higher level actions like, “Account opened/closed”, “Contract Signed”, “Invoice Generated”, etc… Now all these actions might have multiple sideeffects on your end state, like for example “Invoice Generated” might create credit/debit pairs and create add an invoice row, “Account Closed” might delete some rows from your database and update the customer etc. With ES not only you can reason about why your state is in the state it is. But also create <strong>new state from historical data</strong>. For example you might decide that you can to create a Loan Tape (a dataset that contains information about a pool of loans) for everything that happened since the beggining of 2023. With ES you simply write a new projector tell it when to start and handle all the events since then to create your new state. This can be for any type of data, you could build an XSL or calculate metrics for a presentation, maybe you want to know what’s the percentage of people that have closed their account within 2 months that a contract was signed, and you want to calculate that for data going back 3 years. That is the power of ES.</p>
<p>It’s not recreating your existing state, but creating new state that you don’t even have.</p>
<p>But as previously mentioned, you need the business to support you in modeling the software this way, it does not work just as an engineering solution, you need <strong>the business to actively work on modeling the events and how they contrsuct the application state</strong>.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="365070" data-batch-url="/posts/batch_likers">
                        6
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/ashevents-event-sourcing-made-simple-for-ash/70777/33">Post #32</a>
	                </div>
	            </div>
              <div id="likers-container-365070" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="365070"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #32"></div>
  </section>
</div>
    <div class="postbit" id="365072" data-post-id="365072">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="vasspilka" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/vasspilka/120/2026_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  vasspilka
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>As to why one might want to replay up to a particular state.</p>
<aside class="quote no-group" data-username="garrison" data-post="19" data-topic="70777">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/g/3bc359/48.png" class="avatar"> garrison:</div>
<blockquote>
<p>I don’t understand why anyone would ever “need” to replay events up to a particular state in this way. You already <em>have</em> the state, no?</p>
</blockquote>
</aside>
<p>I’ve never personally needed this. But imagine that something really critical happened at one specific point in time, your biggest customer opened your app, clicked on something and that caused a bug where all their balances now show 0.</p>
<p>It might be some very elusive bug, where you might want to recreate all state up to that event locally and try to debug the application to understand why it happened.</p>
<p>That being said in any ES application there are other factors as internet connection, physical equipment, non-ES state and human intervention that could have contributed. But you can verify wether your ES application code has a problem or not.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="365072" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/ashevents-event-sourcing-made-simple-for-ash/70777/34">Post #33</a>
	                </div>
	            </div>
              <div id="likers-container-365072" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="365072"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #33"></div>
  </section>
</div>
    <div class="postbit" id="365079" data-post-id="365079">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="zachdaniel" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/zachdaniel/120/31980_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  zachdaniel
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Ash</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="vasspilka" data-post="32" data-topic="70777">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/vasspilka/48/2026_2.png" class="avatar"> vasspilka:</div>
<blockquote>
<p>That being said, I think you can have ES and Ash separately in the same application (ES managing Events and Ash being the Application state) , Ash is indeed a really good abstraction around modeling resource oriented state, and at the end of the day even in ES software the “read-only” (updated only as a result of an event) state is usually resource oriented.</p>
</blockquote>
</aside>
<p>To be clear: this is like saying “I think you can have ES and Phoenix Contexts separately in the same application”. You can model any external or internal paradigm with Ash resources. This is not obvious on the tin, I understand that, but I do want to make it clear. You could use Ash and commanded side by side if you wanted. Ash actions that create events etc.</p>
<p>Ash does not even require that you ever use it to map to a storage layer.  This is a valid resource:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule Something do
  use Ash.Resource

  actions do
    action :say_hello, :string do
      {:ok, "Hello"}
    end
  end
end
</code></pre>
<p>That Ash is about state management or fits in as an ORM primarily is generally the most common misconception about Ash.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="365079" data-batch-url="/posts/batch_likers">
                        6
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/ashevents-event-sourcing-made-simple-for-ash/70777/35">Post #34</a>
	                </div>
	            </div>
              <div id="likers-container-365079" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="365079"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #34"></div>
  </section>
</div>
    <div class="postbit" id="365083" data-post-id="365083">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="vasspilka" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/vasspilka/120/2026_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  vasspilka
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Oww, yeah you are absolutely right!</p>
<p>I made the mistake to assume that an Ash resource would be coupled with a database table while that’s not the case.</p>
<p>Thank’s for spotting it and correcting me!</p>
<p>I suppose in this case <a href="https://github.com/ash-project/ash_events" class="inline-onebox" rel="noopener nofollow ugc">GitHub - ash-project/ash_events: An event-architecture extension for Ash. · GitHub</a> could grow to support ES sourcing fully <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>
<p>Ash never fails to surprise even after using it for months now &lt;3</p>
<p>Thanks again for seeing through me</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="365083" data-batch-url="/posts/batch_likers">
                        4
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/ashevents-event-sourcing-made-simple-for-ash/70777/36">Post #35</a>
	                </div>
	            </div>
              <div id="likers-container-365083" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="365083"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #35"></div>
  </section>
</div>
    <div class="postbit" id="365092" data-post-id="365092">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="byu" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/byu/120/32032_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  byu
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<blockquote>
<p><strong>the business to actively work on modeling the events and how they contrsuct the application state</strong> .</p>
</blockquote>
<p>A couple things came to mind:</p>
<ol>
<li>I learned from some CQRS/ES people that a “stream aggregate rebuilt state” is “internal” to the domain, and only used really to make business decisions (domain logic/policy) given an issued command… not visible to consumers.</li>
<li>And that it’s the “projections” that provide a perspective VIEW of the “domain state”; aka currently understanding about an aspect of what’s important the business. Same event stream can provide different projections/views that are tailored to the needs of the user (e.g. a Sales analyst role, or a marketing role, or warehouse manager role)</li>
</ol>
<p>I’m wondering in your experience, the extent and truth of this?</p>
<p>Also, I am reminded of the Greg Young quote, “You can’t rollback a truck already driving down the highway 1000 miles away” (paraphrased).</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="365092" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/ashevents-event-sourcing-made-simple-for-ash/70777/37">Post #36</a>
	                </div>
	            </div>
              <div id="likers-container-365092" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="365092"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #36"></div>
  </section>
</div>
    <div class="postbit" id="365094" data-post-id="365094">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="garrison" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  garrison
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Thanks to everyone for the replies, these were exactly the sort of responses I had hoped for <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>
<p>I had not considered the value of being able to construct future views of past data in that way. I totally see how that could be useful for “enterprisey” businesses with many teams where you don’t know exactly what you will need to do with the data down the road. Storing a full log, replaying, etc all make sense in that context.</p>
<p>I will reply separately to any bits which I am confused or skeptical about. Hopefully I have not derailed this thread too much - it was looking kinda derailed when I posted so I wasn’t feeling so bad about it, but I got more discussion here than I had bargained for. Maybe it will have to be split off <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="365094" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/ashevents-event-sourcing-made-simple-for-ash/70777/38">Post #37</a>
	                </div>
	            </div>
              <div id="likers-container-365094" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="365094"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #37"></div>
  </section>
</div>
    <div class="postbit" id="365096" data-post-id="365096">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="garrison" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  garrison
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="katafrakt" data-post="28" data-topic="70777">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/katafrakt/48/34763_2.png" class="avatar"> katafrakt:</div>
<blockquote>
<p>This silently assumes you are using the same database for keeping the events and keeping the projections</p>
</blockquote>
</aside>
<p>A fair point, though I am personally very skeptical of using multiple databases in this way <em>in general</em>.</p>
<aside class="quote no-group" data-username="katafrakt" data-post="28" data-topic="70777">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/katafrakt/48/34763_2.png" class="avatar"> katafrakt:</div>
<blockquote>
<p>But even in one database with transactions, errors will happen. Not because the database is buggy, but because of developers mistakes</p>
</blockquote>
</aside>
<p>I think the same problem applies here, though: a developer could make a mistake on the projection, but they could also make a mistake <em>on the events</em> too. What if the projection was actually correct and the events were bugged? How would you know?</p>
<p>There is probably an argument here that events have more information and thus it is easier to spot such issues, which I would be sympathetic to.</p>
<aside class="quote no-group" data-username="katafrakt" data-post="28" data-topic="70777">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/katafrakt/48/34763_2.png" class="avatar"> katafrakt:</div>
<blockquote>
<p>Some may dismiss it as a “programming model” or a “implementation detail”, but for me it’s a fundamental shift on how you think about modeling the data.</p>
</blockquote>
</aside>
<p>Oh I did not mean “programming model” to be dismissive, in fact what I actually meant was essentially what you describe - a different way to think about things.</p>
<aside class="quote no-group" data-username="katafrakt" data-post="28" data-topic="70777">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/katafrakt/48/34763_2.png" class="avatar"> katafrakt:</div>
<blockquote>
<p>I don’t have a lot of experience with snapshotting, but I think you rarely create snapshots on every event. Rather once per some period, liek 24 hours, or every 100 events.</p>
</blockquote>
</aside>
<p>The point I was trying to make was that snapshotting <em>in the limit</em> would just be “using the database normally” plus “keeping an audit log”. That is to say: if you are <em>already</em> doing those things, event sourcing is just “those things but worse”, where by “worse” I mean the materialized view is not always up-to-date or has to be reconciled (expensively) at query time.</p>
<p>I do have a better idea of how ES could be useful in other ways, though, which I did not yet have when I wrote that message <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="365096" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/ashevents-event-sourcing-made-simple-for-ash/70777/39">Post #38</a>
	                </div>
	            </div>
              <div id="likers-container-365096" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="365096"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #38"></div>
  </section>
</div>
    <div class="postbit" id="365097" data-post-id="365097">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="garrison" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  garrison
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="vasspilka" data-post="33" data-topic="70777">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/vasspilka/48/2026_2.png" class="avatar"> vasspilka:</div>
<blockquote>
<p>You are a fintech company, your core domain is dealing with financial transactions, this may be double entry accounting, but also higher level actions like, “Account opened/closed”, “Contract Signed”, “Invoice Generated”, etc</p>
</blockquote>
</aside>
<p>I see the value here, but this reminded me of something else which was bugging me.</p>
<p>What if, for compliance reasons or whatever, you need to ensure something is <em>removed</em> from your system? If you merely store a tombstone event then of course nothing has actually been removed, which could create all sorts of problems.</p>
<p>I don’t think this is a niche issue, it’s something that affects essentially any app or product. I care a lot about privacy, and it’s very important to me that my systems are designed to promptly remove anything which a user chooses to permanently delete. How would I use event sourcing in cases like these?</p>
<p>I see how a mental model of “keeping track of historical state” can be useful. As a real example, I just finished work on a note system to complement my bookmarking system and it keeps track of revisions - like git, but without the merkle tree. But if a user were to delete a particular revision for whatever reason, I would want to ensure that it is promptly removed. I don’t see how I could implement this with ES.</p>
<p>Of course it could be the case that my use case is just not a great fit, but surely even in these sorts of enterprise settings there is a need to <em>actually</em> remove data sometimes. How is this handled?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="365097" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/ashevents-event-sourcing-made-simple-for-ash/70777/40">Post #39</a>
	                </div>
	            </div>
              <div id="likers-container-365097" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="365097"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #39"></div>
  </section>
</div>
    <div class="postbit" id="365111" data-post-id="365111">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="vasspilka" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/vasspilka/120/2026_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  vasspilka
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="byu" data-post="37" data-topic="70777">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/byu/48/32032_2.png" class="avatar"> byu:</div>
<blockquote>
<p>A couple things came to mind:</p>
<ol>
<li>I learned from some CQRS/ES people that a “stream aggregate rebuilt state” is “internal” to the domain, and only used really to make business decisions (domain logic/policy) given an issued command… not visible to consumers.</li>
<li>And that it’s the “projections” that provide a perspective VIEW of the “domain state”; aka currently understanding about an aspect of what’s important the business. Same event stream can provide different projections/views that are tailored to the needs of the user (e.g. a Sales analyst role, or a marketing role, or warehouse manager role)</li>
</ol>
</blockquote>
</aside>
<p>Yes that’s accurate for CQRS. The “highest definition” data are the events themselves, that’s the most detailed view of what happened. The aggregate state (build from the event stream) is the state that the business creates for themselves “internal” so that they can take decisions on what events should be created. So one starts with a command that holds information X it is send to an aggregate (“internal” state) that holds information Y, it then combines information X &amp; Y to decide what events should (or not) be appended to the event log. Usually it does not make sense to share that state with customers as it’s intent is for the system to reason about what to do next and it lives in memory.</p>
<p>The projections are representations of the data that help solve specific business problems, so it’s state created from the events with the purpose of finding (viewing) information about the system. It can be used to solve a problem for a customer, but can also be created to solve a problem for the business. The main difference there is that this state is not used to take decisions on what the result of a command will be (even though in practive projections are sometimes used to build the data inside commands, but that can be dangerous so it’s important to understand what could go wrong) and in general there is a “lag” of this state, meaning that it might be slightly stale. For example it might get updated 1 second after an event was added to the log, (that’s where the dangers of using it in commends can arrise)</p>
<p>But I’ve build a <a href="https://github.com/vasspilka/micro_words" rel="noopener nofollow ugc">toy application</a> where the aggregate state is used as the main state of the application. It’s more of a fun experiment and would not expect to see this in a real application other. than games.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="365111" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/ashevents-event-sourcing-made-simple-for-ash/70777/41">Post #40</a>
	                </div>
	            </div>
              <div id="likers-container-365111" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="365111"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #40"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <a class="load-more-button" data-turbo-stream="true" href="/topics/70777/load_more?page=5">Load more posts (4 remaining)</a>
</div></template></turbo-stream>