{"id":22284007,"url":"https://github.com/albe/node-event-storage","last_synced_at":"2026-04-02T21:26:52.977Z","repository":{"id":13982041,"uuid":"75570596","full_name":"albe/node-event-storage","owner":"albe","description":"An optimized event store for node.js","archived":false,"fork":false,"pushed_at":"2023-11-28T04:41:55.000Z","size":1102,"stargazers_count":34,"open_issues_count":20,"forks_count":4,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-04-14T12:30:30.972Z","etag":null,"topics":["cqrs","electron","embedded","event-sourcing","event-storage","event-stream","eventstore","nodejs"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/albe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-04T23:08:24.000Z","updated_at":"2024-05-22T15:52:27.961Z","dependencies_parsed_at":"2024-05-22T15:52:16.709Z","dependency_job_id":"f096b98c-c576-4129-8ee0-0da5c5ad22e0","html_url":"https://github.com/albe/node-event-storage","commit_stats":{"total_commits":415,"total_committers":7,"mean_commits":"59.285714285714285","dds":"0.18313253012048192","last_synced_commit":"13ebdd13bffb901b62214137a62e198ce0a3d727"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albe%2Fnode-event-storage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albe%2Fnode-event-storage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albe%2Fnode-event-storage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albe%2Fnode-event-storage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/albe","download_url":"https://codeload.github.com/albe/node-event-storage/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227960997,"owners_count":17847824,"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","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":["cqrs","electron","embedded","event-sourcing","event-storage","event-stream","eventstore","nodejs"],"created_at":"2024-12-03T16:43:36.288Z","updated_at":"2026-04-02T21:26:52.956Z","avatar_url":"https://github.com/albe.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"![event-storage](logo/color.png)\n\n[![build](https://github.com/albe/node-event-storage/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/albe/node-event-storage/actions/workflows/build.yml)\n[![npm version](https://badge.fury.io/js/event-storage.svg)](https://badge.fury.io/js/event-storage)\n[![Code Climate](https://codeclimate.com/github/albe/node-event-storage/badges/gpa.svg)](https://codeclimate.com/github/albe/node-event-storage)\n[![Coverage Status](https://coveralls.io/repos/github/albe/node-event-storage/badge.svg?branch=main)](https://coveralls.io/github/albe/node-event-storage?branch=main)\n[![Code documentation](https://inch-ci.org/github/albe/node-event-storage.svg?branch=main)](https://inch-ci.org/github/albe/node-event-storage)\n\n# node-event-storage\n\nAn optimized embedded event store for modern node.js, written in ES6.\n\n📖 **[Full documentation on readthedocs.io](https://node-event-storage.readthedocs.io/en/latest/)**\n\n---\n\n## Why?\n\nThere is currently only a single other embedded event store for node/javascript: [node-eventstore](https://github.com/adrai/node-eventstore). It has a few drawbacks:\n\n- Its API requires loading a full Event Stream before committing, making it unfit for frequently-restarting client applications.\n- Its embeddable backends (TingoDB, NeDB) do not persist indexes and are slow on initial load.\n- Events are fixed to one stream — creating overlapping projection streams is not possible.\n\n**node-event-storage** is built from first principles for append-only workloads, giving you near-optimal write speed with no unnecessary overhead.\n\n---\n\n## Installation\n\n```bash\nnpm install event-storage\n```\n\n\u003e **CommonJS / `require()` users:** version 1.0 is ESM-only. If your project uses `require()` and migrating to ESM is not an option, install the 0.x series (`npm install event-storage@0`) which is functionally equivalent and retains full CJS support.\n\n\n\n```javascript\nimport { EventStore } from 'event-storage';\n\nconst eventstore = new EventStore('my-event-store', { storageDirectory: './data' });\n\neventstore.on('ready', () =\u003e {\n    // Write events\n    eventstore.commit('my-stream', [{ type: 'SomethingHappened', value: 42 }], 0, () =\u003e {\n        console.log('Written!');\n    });\n\n    // Read events\n    const stream = eventstore.getEventStream('my-stream');\n    for (const event of stream) {\n        console.log(event);\n    }\n});\n```\n\n## Key Features\n\n| Feature | Summary |\n|---------|---------|\n| **Optimistic concurrency** | Pass `expectedVersion` to `commit()` to guarantee conflict-free writes. |\n| **Flexible stream reading** | Range queries, reverse iteration, and a fluent builder API. |\n| **Derived streams** | Filter or combine events into new read-only streams. |\n| **Stream categories** | Name streams `\u003ccategory\u003e-\u003cid\u003e` and query the whole category at once. |\n| **Durable consumers** | At-least-once (and exactly-once with `setState`) event delivery with automatic position tracking. |\n| **Consistency guards** | Build aggregates that enforce business invariants with built-in snapshotting. |\n| **Read-only mode** | Open the store from a second process to build projections without touching the writer. |\n| **Crash safety** | Torn writes detected and truncated on startup; automatic index repair via `LOCK_RECLAIM`; bounded, predictable data loss validated by a dedicated stress test. |\n| **Custom serialization** | Plug in msgpack, protobuf, or any other codec. |\n| **Compression** | Apply LZ4, zstd, or any other compression via the `serializer` option. |\n| **Access control hooks** | `preCommit` / `preRead` hooks with per-stream metadata for authorization. |\n\n---\n\n## Documentation\n\nThe full documentation is hosted at **\u003chttps://node-event-storage.readthedocs.io/en/latest/\u003e** and covers:\n\n- [Getting Started](https://node-event-storage.readthedocs.io/en/latest/getting-started/) — installation, constructor options, basic usage.\n- [Event Streams](https://node-event-storage.readthedocs.io/en/latest/streams/) — writing, reading, optimistic concurrency, fluent API, joining streams, categories, and event metadata.\n- [Consumers](https://node-event-storage.readthedocs.io/en/latest/consumers/) — at-least-once and exactly-once delivery, consumer state, consistency guards, and read-only mode.\n- [Advanced Topics](https://node-event-storage.readthedocs.io/en/latest/advanced/) — ACID properties, reliability and crash-safety guarantees, storage configuration, partitioning, custom serialization, compression, security, and access control hooks.\n\n---\n\n## Run Tests\n\n```bash\nnpm test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbe%2Fnode-event-storage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falbe%2Fnode-event-storage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbe%2Fnode-event-storage/lists"}