Provides a JSON event store with support for multi-tenancy and observability.
- Event Storage: Persists all events directly into Postgres.
- Multi-Tenancy: separate streams for each client application or domain.
- Security: Support for TLS.
- Observability: Native OpenTelemetry (OTEL) instrumentation.
Launch a local development environment via Docker Compose with the following:
./dev.sh up //Creates the stream
exampleKind := "example" //used for the kind of event
stream := sys.MustStream(ctx, "readme", "test")
//submit events to be queried
stream.MustSubmit(ctx, exampleKind, &Event{First: true})
stream.MustSubmit(ctx, exampleKind, &Event{First: false})
// prepare a query to find all events with First == true
q := query2.NewQuery(stream)
q.OnKind(exampleKind).Subset(Event{First: true}).On(v1.EntityFunc(func(ctx context.Context, e v1.Envelope, entity Event) {
//will be called for each found event as the query is executing
fmt.Printf("%#v\n", e)
}))
if err = q.StreamBatch(ctx); err != nil {
panic(err)
}See the full example in examples/readme/main.go .
To get started quickly, you'll need:
- Go 1.25+
- Docker & Docker Compose (for local development)
Just run ./docker-up.sh to get it moving on port 9000 and 9001 . The tool pgcqrs will be available in the root
of the repository.
The project contains several examples demonstrating different usage patterns in the examples/ directory:
- Simple: Basic usage (
examples/simple) - Querying: How to query events (
examples/query,examples/query2) - Watching: Subscribing to streams (
examples/watch) - Batching: Batch query operations (
examples/queryBatch)
A whole battery of examples are available via ./run-examples.sh.
Pull requests are welcome.
For major changes, please open an issue first to discuss what you would like to change.
Contributions will be accepted under the Apache 2.0 license.