{"id":33204613,"url":"https://github.com/meteor-space/event-sourcing","last_synced_at":"2025-12-17T06:54:40.464Z","repository":{"id":22024586,"uuid":"25350715","full_name":"meteor-space/event-sourcing","owner":"meteor-space","description":"CQRS and Event Sourcing Infrastructure for Meteor.","archived":false,"fork":false,"pushed_at":"2016-12-15T18:11:29.000Z","size":431,"stargazers_count":63,"open_issues_count":14,"forks_count":11,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-06-26T09:41:52.756Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"CoffeeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/meteor-space.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-17T09:41:30.000Z","updated_at":"2023-09-23T02:03:04.000Z","dependencies_parsed_at":"2022-08-18T17:32:56.099Z","dependency_job_id":null,"html_url":"https://github.com/meteor-space/event-sourcing","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/meteor-space/event-sourcing","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meteor-space%2Fevent-sourcing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meteor-space%2Fevent-sourcing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meteor-space%2Fevent-sourcing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meteor-space%2Fevent-sourcing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/meteor-space","download_url":"https://codeload.github.com/meteor-space/event-sourcing/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meteor-space%2Fevent-sourcing/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27778913,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-17T02:00:08.291Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-11-16T10:00:18.614Z","updated_at":"2025-12-17T06:54:40.458Z","avatar_url":"https://github.com/meteor-space.png","language":"CoffeeScript","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# CQRS \u0026 Event Sourcing for Meteor\n\n[![Circle CI](https://circleci.com/gh/meteor-space/event-sourcing.svg?style=svg)](https://circleci.com/gh/meteor-space/event-sourcing)\n[![Join the chat at https://gitter.im/meteor-space/event-sourcing](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/meteor-space/event-sourcing?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\nThis package provides the infrastructure for building your Meteor app\nwith the **CQRS** (Command/Query Responsibility Separation) and **Event Sourcing**\nprinciples in mind. This enables you to build complex applications with a strong\nbusiness logic that is easy to test and reason about.\n\n### Contents:\n* [Installation](#installation)\n* [Concepts](#concepts)\n  * [Event Sourcing](#event-sourcing)\n  * [CQRS](#cqrs)\n  * [Domain Driven Design](#domain-driven-design)\n* [Documentation](#documentation)\n\n## Installation\n`meteor add space:event-sourcing`\n\n## Concepts\n\nIf you're new to concepts like **CQRS**, **ES** and **DDD**, read\non to get a quick overview.\n\n-----------------------\n\n### Event Sourcing\nStoring all the changes (events) to the system, rather than just its\ncurrent state.\n\n#### Why haven't I heard of storing events before?\nYou have. Almost all database systems use a log for storing all changes applied\nto the database (OPLOG anyone?). In a pinch, the current state\nof the database can be recreated from this transaction log. This is a kind of event\nstore. Event sourcing just means following this idea to its conclusion and using\nsuch a log as the primary source of data.\n\n#### What are some advantages of event sourcing?\n* **History**: Having a true history of the system. Gives further benefits such\nas audit and traceability.\n* **Answers**: You never know which questions about your system/users you will\nask in one year.\n* **Time travel**: Ability to put the system in any prior state. (I.e. what did\nthe system look like last week?)\n* **Flexibility**: By storing all events your can create arbitrary read-model\nprojections at any time in the project. This enables you to present your data in\nany number of ways and optimize it for the client-side.\n* **Speed:** Events are always appended, never updated or deleted which makes\nstoring them blazing fast.\n\n*You can read more about Event Sourcing here:*\n\n* [Martin Fowler - Event Sourcing](http://www.martinfowler.com/eaaDev/EventSourcing.html)\n* [Greg Young - Event Sourcing](http://docs.geteventstore.com/introduction/event-sourcing-basics/)\n* [Microsoft - Event Sourcing](https://msdn.microsoft.com/en-us/library/dn589792.aspx)\n\n-----------------------\n\n### CQRS\n*Command/Query Responsibility Separation*\n\nWe segregate the responsibility between **commands** (write requests) and **queries**\n(read requests). Where you had just one model to read/write data from/to your system,\nyou now have two. Each one is optimized for its purpose, reading or writing.\n\nThe true strength of CQRS lies in the combination with Event Sourcing. Your event-store\nbecomes the **write model** side of your system (optimized for business logic).\nThe projected data-structures based on your event stream, become the **read model**\n(optimized for the requirements of the UI / client-side).\n\n#### What are advantages of this pattern?\n\n* You can optimize the reading / writing to your system separately.\n* Your business logic becomes simpler because you don't need to think about UI concerns.\n* You can create any number of different read-models (think: Mongo.Collections)\nbased on your event stream. And rebuild them from scratch at any time in the project!\n* Much faster data subscriptions/loading because the collections can be optimized\nfor the UI.\n* No more reactive JOINS or other nonsense that does not perform.\n\n*You can read more about CQRS here:*\n\n* [Microsoft about CQRS](http://msdn.microsoft.com/en-us/library/dn568103.aspx)\n* [CQRS FAQ](http://www.cqrs.nu/)\n* [Tutorial about CQRS \u0026 Event Sourcing](http://cqrs.nu/tutorial/cs/01-design)\n(C# but still relevant)\n* [Martin Fowler about CQRS](http://martinfowler.com/bliki/CQRS.html)\n\n-----------------------\n\n### Domain Driven Design\nStructure, practices and terminology for making design decisions in complex software.\n\n#### What is a domain?\n*The field for which a system is built.*\n\nAirport management, insurance sales, coffee shops, orbital flight, you name it.\nIt's not unusual for an application to span several different domains. For example,\nan online retail system might be working in the domains of shipping (picking\nappropriate ways to deliver, depending on items and destination), pricing\n(including promotions and user-specific pricing by, say, location), and\nrecommendations (calculating related products by purchase history).\n\n#### What is a model?\n*\"A useful approximation to the problem at hand.\" -- Gerry Sussman*\n\nAn `Employee` class is not a real employee. It models a real employee. We know\nthat the model does not capture everything about real employees, and that's not\nthe point of it. It's only meant to capture what we are interested in for the\ncurrent context.\n\nDifferent domains may be interested in different ways to model the same thing.\nFor example, the salary department and the human resources department may model\nemployees in different ways.\n\n#### What is Domain-Driven Design (DDD)?\nIt is a development approach that deeply values the domain model and connects\nit to the implementation. DDD was coined and initially developed by Eric Evans\nin his great book [Domain-Driven Design: Tackling Complexity in the Heart of Software](http://www.amazon.com/Domain-Driven-Design-Tackling-Complexity-Software/dp/0321125215).\n\n*You can read more about DDD here:*\n\n* [An Introduction to Domain Driven Design](http://www.methodsandtools.com/archive/archive.php?id=97)\n* [Domain Driven Design Quickly - Great Book!](http://www.infoq.com/minibooks/domain-driven-design-quickly)\n* [Common DDD mistakes](http://www.infoq.com/news/2015/07/ddd-mistakes)\n\n-----------------------\n\n## Documentation\n\n*More and better documentation is coming soon …*\n\n`meteor:event-sourcing` provides distributed Event Sourcing infrastructure,\nwith CQRS and DDD patterns in mind. It provides a base class for event-sourced [Aggregates](http://martinfowler.com/bliki/DDD_Aggregate.html)\nand [ProcessManagers](https://msdn.microsoft.com/en-us/library/jj591569.aspx), and pairs nicely with `space:domain` to model\nyour business domain with Entities,\n[ValueObjects](http://martinfowler.com/bliki/ValueObject.html), and Domain Events.\n\nIt also provides a MongoDB based distributed EventStore which works a little bit different\nthan \"normal\" event store implementations because MongoDB doesn't support transactions.\nTo circumvent this, the concept of a commit is used, which bundles multiple events and\ncommands together into one \"transaction\" commit. [Here is a short blog article](http://blingcode.blogspot.co.at/2010/12/cqrs-building-transactional-event-store.html)\ntalking about the basic concept.\n\nIt heavily uses the `space-messaging` package for Metoer `EJSON` and\nruntime-`check`ed domain events and commands that are automatically serialized\ninto the MongoDB and restored for you. So you don't have to deal with\nserialization concerns anywhere but within your value objects.\n\n## Contributing\nIn lieu of a formal styleguide, take care to maintain the existing coding style.\nAdd unit / integration tests for any new or changed functionality.\n\n## Run the tests\n`meteor test-packages ./`\n\n## Release History\nYou can find the release history in the [changelog](https://github.com/meteor-space/event-sourcing/blob/master/CHANGELOG.md)\n\n## Thanks\nThanks to [CQRS FAQ](http://cqrs.nu/Faq/) (Creative Commons) for a lot of\ninspiration and copy.\n\n## License\nLicensed under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeteor-space%2Fevent-sourcing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeteor-space%2Fevent-sourcing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeteor-space%2Fevent-sourcing/lists"}