Cloudflare D1 persistence layer for little-es.
npm i little-es-cloudflare-persistence
Usage:
// ... define your Cloudflare bindings
const persistence = createPersistenceHandler<MYAGGREGATE, MYEVENTS>(env.DB);
// ... now you can pass it little-es aggregates and projections
const todoAggregate = {
...
persistence: persistence
};
- Create your D1 database following Cloudflare instructions
- Run the migrate.sql script you find in this project
- Add the D1 binding to your app
- Create a PersistenceHandler using the createPersistenceHandler()
- Add the handler to your little-es aggregate and projection configurations.