| Crates.io | korrosync |
| lib.rs | korrosync |
| version | 0.2.0 |
| created_at | 2025-11-13 09:18:34.001507+00 |
| updated_at | 2026-01-09 10:53:43.878421+00 |
| description | A KOReader Sync Server |
| homepage | |
| repository | https://github.com/szaffarano/korrosync |
| max_upload_size | |
| id | 1930732 |
| size | 255,040 |
A modern, high-performance KOReader sync server written in Rust
Korrosync is a self-hosted synchronization server for KOReader. It enables seamless reading progress synchronization across multiple devices, allowing you to pick up where you left off on any device.
# Clone the repository
git clone https://github.com/szaffarano/korrosync.git
cd korrosync
# Build with cargo (without TLS)
cargo build --release
# Or build with TLS support
cargo build --release --features tls
# Run the server
./target/release/korrosync
# Run directly with Nix
nix run github:szaffarano/korrosync
# Or enter development shell
nix develop
cargo run
Pre-built binaries for Linux and macOS are available in the releases section.
Docker images are uploaded in Docker Hub.
If you want to build the image yourself, use the following instructions.
# Build for your current platform
docker build -t korrosync .
# Multi-arch builds (requires buildx)
# First, create a buildx builder if you haven't already
docker buildx create --name multiarch --use
# e.g., build for Raspberry Pi 3 and load locally
docker buildx build \
--platform linux/arm/v7 \
-t korrosync:arm32 \
--load .
# Run container (HTTP)
docker run -d \
-p 3000:3000 \
-v $(pwd)/data:/data \
-e KORROSYNC_DB_PATH=/data/db.redb \
--name korrosync \
korrosync
# Run container with TLS enabled
docker run -d \
-p 3000:3000 \
-v $(pwd)/data:/data \
-v $(pwd)/tls:/tls \
-e KORROSYNC_DB_PATH=/data/db.redb \
-e KORROSYNC_USE_TLS=true \
-e KORROSYNC_CERT_PATH=/tls/cert.pem \
-e KORROSYNC_KEY_PATH=/tls/key.pem \
--name korrosync \
korrosync
Korrosync supports optional features that can be enabled at compile time:
tlsEnables native TLS/HTTPS support using rustls. When enabled, the server can accept HTTPS connections directly without requiring a reverse proxy.
Building with TLS support:
cargo build --release --features tls
What it enables:
KORROSYNC_USE_TLS, KORROSYNC_CERT_PATH, KORROSYNC_KEY_PATH)Note: If the tls feature is not enabled during compilation, the server will only support HTTP. You can still use HTTPS by placing the server behind a reverse proxy like Nginx (see Deployment section).
Korrosync is configured through environment variables:
| Variable | Description | Default |
|---|---|---|
KORROSYNC_DB_PATH |
Path to the redb database file | data/db.redb |
KORROSYNC_SERVER_ADDRESS |
Server bind address | 0.0.0.0:3000 |
KORROSYNC_USE_TLS |
Enable TLS/HTTPS support (true/1/yes/on or false/0/no/off, case-insensitive) | false |
KORROSYNC_CERT_PATH |
Path to TLS certificate file (PEM format) | tls/cert.pem |
KORROSYNC_KEY_PATH |
Path to TLS private key file (PEM format) | tls/key.pem |
# Basic configuration
export KORROSYNC_DB_PATH=/var/lib/korrosync/db.redb
export KORROSYNC_SERVER_ADDRESS=127.0.0.1:8080
korrosync
# With TLS enabled
export KORROSYNC_DB_PATH=/var/lib/korrosync/db.redb
export KORROSYNC_SERVER_ADDRESS=0.0.0.0:3000
export KORROSYNC_USE_TLS=true
export KORROSYNC_CERT_PATH=/etc/korrosync/tls/cert.pem
export KORROSYNC_KEY_PATH=/etc/korrosync/tls/key.pem
korrosync
# Start with default configuration
korrosync
# Or with custom configuration
KORROSYNC_SERVER_ADDRESS=0.0.0.0:8080 korrosync
POST /users/create — Register a new userGET /users/auth — Verify authentication statusPUT /syncs/progress — Update reading progress for a documentGET /syncs/progress/{document} — Retrieve progress for a specific documentGET /healthcheck — Health check endpointGET /robots.txt — Robots exclusion fileCreate a systemd service file at /etc/systemd/system/korrosync.service:
[Unit]
Description=Korrosync - KOReader Sync Server
After=network.target
[Service]
Type=simple
User=korrosync
Group=korrosync
Environment="KORROSYNC_DB_PATH=/var/lib/korrosync/db.redb"
Environment="KORROSYNC_SERVER_ADDRESS=0.0.0.0:3000"
# Uncomment to enable TLS
#Environment="KORROSYNC_USE_TLS=true"
#Environment="KORROSYNC_CERT_PATH=/etc/korrosync/tls/cert.pem"
#Environment="KORROSYNC_KEY_PATH=/etc/korrosync/tls/key.pem"
ExecStart=/usr/local/bin/korrosync
Restart=on-failure
RestartSec=5s
# Security
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/var/lib/korrosync
[Install]
WantedBy=multi-user.target
Enable and start the service:
sudo systemctl enable korrosync
sudo systemctl start korrosync
sudo systemctl status korrosync
Korrosync supports built-in TLS/HTTPS without requiring a reverse proxy:
# Enable TLS with environment variables
export KORROSYNC_USE_TLS=true
export KORROSYNC_CERT_PATH=/etc/korrosync/tls/cert.pem
export KORROSYNC_KEY_PATH=/etc/korrosync/tls/key.pem
korrosync
Note: Certificate and private key files must be in PEM format. For production, use certificates from a trusted CA
(e.g., Let's Encrypt). For testing, self-signed certificates are provided in the tls/ directory. See tls/README.md
for more information.
Alternatively, use a reverse proxy with TLS termination:
server {
listen 443 ssl;
http2 on;
server_name sync.example.com;
ssl_certificate /path/to/cert.pem;
ssl_certificate_key /path/to/key.pem;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Using Nix flakes (recommended):
# Enter development shell with all tools
nix develop
# Pre-commit hooks will be installed automatically
# Run all tests
cargo test
# Run with coverage
cargo tarpaulin --out Html
# Run integration tests only
cargo test --test '*'
Korrosync is built with:
The following features and improvements are planned:
This project is licensed under the MIT License — see the LICENSE file for details.