eventkit —

Eventkit is a library for defining, composing, and observing asynchronous streams of data.
- Declarative 🌍: Build complex data streams using a simple, declarative API inspired by RxJS and Node.js streams
- Async-First Architecture ⚡️: Built on modern async iterators and generators, making it perfect for handling real-time data and I/O operations
- Batteries Included 🔋: Super clean APIs, first-class TypeScript support with full type inference, and all the extras included
- Lightweight & Modular 📦: Zero external dependencies and a modular design that lets you only import what you need
You can learn more about the use cases and features of Eventkit in the official documentation.
The best way to start using Eventkit is by checking out the getting started guide.
Here's a basic example of how to use an eventkit stream— a common object used to represent data that will be emitted elsewhere in your application:
import { Stream, filter } from "@eventkit/base";
// Create a stream of events
const stream = new Stream<{ type: string; payload: any }>();
// Filter for specific event types
const userEvents = stream.pipe(filter((event) => event.type.startsWith("user.")));
// Subscribe to the filtered stream
userEvents.subscribe((event) => {
console.log(`Received user event: ${event.type}`);
});
// Push events to the stream
stream.push({ type: "user.login", payload: { userId: "123" } });
stream.push({ type: "system.update", payload: { version: "1.0.1" } }); // This won't be logged
// Wait for all events to be processed
await stream.drain();
View the official eventkit documentation here.
We welcome contributions! Please see our CONTRIBUTING.md guide for more information on how to get involved.
Distributed under the MIT License. See the LICENSE for more information.