Quick Start

In order to learn about sec in the following sections you will need a basic setup. Below are instructions to get you up and running.

EventStoreDB Setup#

First we need to get an EventStoreDB node loaded up. One easy way to do this is to use docker and start up a single node in in-secure mode as follows:

docker run -it --rm --name es-node \
-p 2113:2113 \

The above is enough to get something up and running for the purpose of exploration and learning. Consult the EventStoreDB docs for more details on configuration for production setup.

Scala Setup#

Create a new project with sec as dependency:

libraryDependencies += "io.github.ahjohannessen" %% "sec-fs2" % "0.20.7"

Verify Your Setup#

In order to verify that you can reach the database try out the following IOApp:

import cats.effect._
import sec.api._
object HelloWorld extends IOApp {
def run(args: List[String]): IO[ExitCode] = EsClient
.singleNode[IO](Endpoint("", 2113))
.resource.use(client =>
client.gossip.read.map(_.render).flatMap(str => IO(println(str)))

The methods used on EsClient are explained in the subsequent sections.