A distributed event-sourced database with real-time streaming.
Project details
Eventbase is an advanced key-value store built on NATS JetStream, empowering you with event sourcing and real-time data subscriptions. With features like automatic metadata tracking and distributed state synchronization, it supports large datasets while providing a simple API for seamless data management.
Eventbase is a powerful distributed event-sourced database built on NATS JetStream, designed to provide an efficient and scalable key-value store with real-time value change streaming. This innovative solution leverages event sourcing to ensure robust data tracking, enabling automatic metadata management for your data entries.
Begin by initializing the Eventbase in your application:
import createEventbase from '@markwylde/eventbase';
// Initialize Eventbase
const eventbase = await createEventbase({
nats: {
servers: ['localhost:4222']
},
streamName: 'myapp'
});
// Store data
await eventbase.put('user123', { name: 'John Doe' });
// Retrieve data with metadata
const result = await eventbase.get('user123');
console.log(result);
// Output includes data and metadata
With Eventbase, you have access to a straightforward API:
createEventbase(config): Create a new Eventbase instance with NATS configuration.put(key: string, data: any): Store data associated with a key.get(key: string): Retrieve data and metadata for a specific key.delete(key: string): Remove data from the store.keys(pattern: string): List keys matching a specific pattern.subscribe(pattern: string, callback: Function): Listen for updates that match the specified patterns, receiving detailed event information.close(): Safely close the connection and clean up resources.Each item stored includes critical metadata:
Utilize glob-style patterns for flexible data querying:
user:*order:2023:*Eventbase ensures that multiple instances of your application can synchronize data automatically and efficiently through NATS JetStream, promoting reliability and scalability.
Eventbase is ideal for developers looking for a robust solution that combines simple key-value storage with powerful real-time capabilities and extensive metadata tracking. Dive into the world of event sourcing and enhance your applications with Eventbase!
Comments
0Start the conversation
Share the first comment.