Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gustavopch/firebase-event-sourcing
Event Sourcing + CQRS + DDD for Firebase
https://github.com/gustavopch/firebase-event-sourcing
cqrs ddd es event-sourcing firebase firestore
Last synced: 3 months ago
JSON representation
Event Sourcing + CQRS + DDD for Firebase
- Host: GitHub
- URL: https://github.com/gustavopch/firebase-event-sourcing
- Owner: gustavopch
- License: mit
- Created: 2020-07-15T15:27:12.000Z (over 4 years ago)
- Default Branch: alpha
- Last Pushed: 2023-01-08T01:19:01.000Z (almost 2 years ago)
- Last Synced: 2024-09-28T17:02:03.400Z (3 months ago)
- Topics: cqrs, ddd, es, event-sourcing, firebase, firestore
- Language: TypeScript
- Homepage:
- Size: 3.65 MB
- Stars: 21
- Watchers: 2
- Forks: 2
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Firebase Event Sourcing
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/gustavopch/firebase-event-sourcing-alt/CI?style=flat-square)
> Event Sourcing + CQRS + DDD for Firebase.
## Basic concepts
**Event Sourcing**: Think of a bank account. You can't simply store the current balance. Instead, you must store the records (or the **events**) that have led up to the current balance (or the **state**). The events (`deposited 100 dollars`, `withdrawn 50 dollars`, etc.) are the source of truth. The state (the current balance) is just derived from the events.
**CQRS**: It means Command Query Responsibility Segregation. All those words... it must be a pretty hard concept, doesn't it? Nah, it just means that the part of your system that's responsible for writing data will be separated from the part that's in charge of reading data. So when you write data, you'll be writing events, but when you need to read data, you'll read projections (the data derived from the events). For example, whenever you call the `deposit({ to: 'john', amount: 100 })` command, a `deposited 100 dollars to John's account` event will be recorded. In the background, that will trigger a function (a projection handler) that will update the `balance` of John's account in the `accounts` collection. Did you see it? You wrote to the `events` collection, but you'll read from the `accounts` collection.
**DDD**: It means Domain-Driven Design. It's a hard way to say you'll mostly name things in your code exactly how other non-tech people name them. Don't worry, you'll see that in action.
## Installation
```sh
npm i firebase-event-sourcing
``````sh
yarn add firebase-event-sourcing
```## Usage
WIP.
## License
Released under the [MIT License](./LICENSE.md).