Serialized Javascript & Typescript client
The official Javascript/Typescript client for Serialized.
✨ Features
- Client for Event Sourcing & CQRS APIs provided by Serialized
- Works both for Typescript and Javascript on Node version >= 10.
- Promise-based API that supports async/await
- Built with Typescript
- Provides an easy way to implement DDD Aggregates using Event Sourcing.
💡 Getting Started
First, install the Serialized TS/JS client via the npm package manager:
npm install @serialized/serialized-client
Then, import the library and initialize the client instance:
var {Serialized} = require("@serialized/serialized-client")
var serialized = Serialized.create({
accessKey: "<YOUR_ACCESS_KEY>",
secretAccessKey: "<YOUR_SECRET_ACCESS_KEY>"
});
Test the client by storing an event:
var aggregateClient = serialized.aggregates;
var request = {
aggregateType: 'user-registration',
aggregateId: uuidv4(),
event: {
eventType: 'UserRegistrationStarted',
data: {
email: 'johndoe@example.com'
}
}
}
await aggregateClient.storeEvent(request)
❓ Troubleshooting
Encountering an issue? Don't feel afraid to add an issue here on Github or to reach out via Serialized.
📄 Resources