Central Protobuf + gRPC hub for Kopuz: end-to-end encrypted cross-device sync, anywhere remote control (phone <-> desktop), and Listen-Together Jam rooms.
See docs/ARCHITECTURE.md for the full architectural specification (wire contracts, auth & OAuth email-linking invariants, Redis rate limiter, E2EE sync model, Jam clock sync, schema, and telemetry).
- Protobuf + gRPC (
kopuzer-proto): Typedtonic+prostservices compiled with pure-Rustprotox(no systemprotocneeded), with gRPC reflection and standard gRPC health checks. - Authentication:
- Email + password hashed with Argon2id (OWASP parameters, non-blocking worker pool).
- OAuth logins for Google, Apple, and Facebook (supporting both OAuth2 authorization code / PKCE and native mobile SDK
id_token/access_token). - Cross-service email matching: Automatically links Google, Apple, Facebook, and password logins into the same user account when both sides carry verified emails.
- Optional Passkeys (WebAuthn / FIDO2): Passwordless registration and sign-in backed by
webauthn-rsand Redis challenges. - Short-lived JWT access tokens + single-use rotating refresh tokens stored hashed in PostgreSQL.
- Redis IP Rate Limiting:
- 3 failed login attempts per IP trigger a 1-hour cooldown (
RESOURCE_EXHAUSTEDwithretry-aftermetadata). - Counter resets immediately upon a successful login.
- 3 failed login attempts per IP trigger a 1-hour cooldown (
- E2EE Op-Log Sync (
SyncService): Append-only encrypted deltas deduplicated by(device_id, client_seq), liveWatchOpsstream via Redis Pub/Sub, and encrypted snapshots for compaction or queue handoff. - Anywhere Remote Control (
RemoteControlService): Bidirectional device tunnels + Redis Pub/Sub relay so devices can control each other across any network with E2EE payloads. - Listen-Together Jam Rooms (
JamService): Short invite codes, server-authoritative clock sync (JamClockPing/JamClockPong), portable cross-backend track descriptors, and collaborative or host-controlled playback policies. - Observability (Default OFF): OpenTelemetry OTLP trace exporter (
OTEL_ENABLED=falseby default) and Prometheus/metricsendpoint ready for Grafana, Tempo, and Prometheus.
cp .env.example .env
# Edit JWT_SECRET and optional OAuth credentials in .env
docker compose up -dTo include Grafana, Prometheus, Tempo, and the OpenTelemetry Collector locally:
OTEL_ENABLED=true PROMETHEUS_METRICS_ENABLED=true docker compose --profile telemetry up -dEndpoints:
- gRPC:
localhost:50051 - HTTP health / OAuth callback:
http://localhost:8080/healthz,/readyz,/oauth/{provider}/callback - Prometheus metrics (when enabled):
http://localhost:8080/metrics - Grafana (with
--profile telemetry):http://localhost:3000(admin/admin)
helm install kopuzer ./charts/kopuzer \
--set secrets.databaseUrl="postgres://kopuzer:pass@postgres:5432/kopuzer" \
--set secrets.redisUrl="redis://redis:6379" \
--set secrets.jwtSecret="$(openssl rand -hex 32)"Enable OpenTelemetry + Prometheus ServiceMonitor for Grafana:
helm upgrade kopuzer ./charts/kopuzer \
--reuse-values \
--set config.telemetry.otelEnabled=true \
--set config.telemetry.prometheusMetricsEnabled=true \
--set config.telemetry.otlpEndpoint="http://otel-collector.observability.svc.cluster.local:4317" \
--set serviceMonitor.enabled=trueSet repository secrets DOCKERHUB_USERNAME and DOCKERHUB_TOKEN in GitHub Actions to publish multi-arch (linux/amd64, linux/arm64) images automatically via .github/workflows/docker.yml.
cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace