Get started
Installation
Klyro is a single static binary with one dependency. Install it from npm, run the published image, bring it up with Compose, or build it from source.
npm
The shortest path from nothing to a running server. npm downloads a prebuilt binary for your machine; no Rust toolchain and no container runtime are involved.
klyro-db includes the typed TypeScript client and the CLI launcher. The native binaries ship as separate packages, and npm installs only the one that matches your platform:
| Platform | Package |
|---|---|
| macOS, Apple silicon | klyro-db-darwin-arm64 |
| macOS, Intel | klyro-db-darwin-x64 |
| Linux arm64, glibc | klyro-db-linux-arm64 |
| Linux x64, glibc | klyro-db-linux-x64 |
Klyro's event loop is poll(2) and it writes its dump from a POSIX signal handler, so there is no Windows binary to publish. Use Docker or WSL. Alpine and other musl distributions are covered by the container image, which is already musl-static.
Typed client packages
These packages connect application code to a running Klyro server and cover every current MEM.* command with typed inputs and decoded replies.
Docker
Every merge to main publishes an image, so there is usually nothing to build.
Tags are latest, the version from Cargo.toml (0.1.1 and 0.1), and sha-<commit> for a specific build. Pin the version tag for anything you care about.
Container environment
| Variable | Default | Meaning |
|---|---|---|
| KLYRO_PORT | 7171 | Port to listen on, inside the container |
| KLYRO_DUMP | /data/klyro.dump | Path of the snapshot file |
| KLYRO_CONFIG | unset | Config file to load, e.g. a mounted klyro.conf |
KLYRO_PORT is passed on the command line, so it overrides a port line inside KLYRO_CONFIG. Arguments given to docker run after the image name bypass all three and go straight to the binary.
docker stop sends SIGTERM, which Klyro handles by writing the snapshot before exiting, so data survives a restart. Compose allows 30 seconds for that; raise stop_grace_period if a large keyspace needs longer.
Docker Compose
Compose sets up the port and the volume for you:
The image is a two-stage build, a static musl binary from rust:1-alpine copied onto bare Alpine, so it lands around 15 MB. It runs as an unprivileged user (uid 10001), keeps the dump in the /data volume, and carries a healthcheck that PINGs over the real protocol.
From source
Settings come from a config file, the command line, or both. Command line arguments are applied last, so they win. Copy klyro.conf.sample to get started; it documents every parameter at its default value. See configuration.
