Question re "Balance Forward"

Hello – I’ve been using Eventstoredb in a non-production capacity for about a year now, and our organization is considering eventually moving this to production.

One of the concerns I have has to do with snapshots. I’m not very familiar with it. in the old days, when we have savings account books, we would get a “balance forwarded” line that indicates the balance. that way, we can safely put away the old book. but because we have the old book, we can always go back to it and see how that balance came about.

is this a feature in Eventstore? if so, would you have some references regarding this? thanks in advance!

One way to solve this is to have an explicit event (e.g., AccountingPeriodClosed) that has the new account balances in it. Then in your repository, you read that stream backwards, pushing events into a stack. When you hit that event, you stop reading, then pop each event off the stack and apply it to your aggregate. You can see an example of that here.

While technically this is a ‘forever’ stream, I can get away with it here because I know that a) either GeneralLedgerOpened or AccountingPeriodClosed will always be the last event in the stream, and b) the number of events I’m legally required to keep is relatively low (7 years * 12 accounting periods * number of accounts). I can then use EventStore’s truncate before feature to trim that stream.

Please keep in mind that this is not generic snapshot advice for any domain; rather it is specifically for accounting-like domains.

1 Like

Thanks for the suggestion @Joao_Braganca. Very close to what I’m looking for, although it requires some elbow grease. Your example will give me some inspiration towards it.