This file provides guidance to AI agents like Claude Code/WARP/Cursor/Codex when working with code in this repository.
VSS (Versioned Storage Service) is a server-side cloud storage solution for non-custodial Lightning Network wallets. It enables wallet state recovery and multi-device access. The project has two implementations: a production-ready Java version and a work-in-progress Rust version.
# Setup (first time)
gradle wrapper --gradle-version 8.1.1
# Build (skip tests if Docker not available)
./gradlew build -x test
# Build with tests (requires Docker for PostgreSQL testcontainers)
./gradlew build
# Run with PostgreSQL container
docker-compose up --build
# Generate protobuf objects (after proto changes)
./gradlew generateProto
# Generate jOOQ objects (after schema changes)
./gradlew generateJooq# Build
cargo build --release
# Run (requires PostgreSQL and config file)
cargo run -- server/vss-server-config.toml
# Run tests
cargo test --workspaceThe API is defined in proto/vss.proto using Protocol Buffers. Both implementations must adhere to this contract. The API exposes four operations via HTTP POST endpoints at /vss/:
getObject- Retrieve a key-value pairputObjects- Store/update key-value pairs (supports transactions)deleteObject- Delete a key-value pairlistKeyVersions- List keys with their versions (paginated)
Both implementations define a KvStore trait/interface:
- Java:
java/app/src/main/java/org/vss/KVStore.java - Rust:
rust/api/src/kv_store.rs
api/- Core types, traits (KvStore,Authorizer), error types, and test suiteimpls/- Backend implementations (PostgreSQL)auth-impls/- Authorization implementations (JWT)server/- HTTP server using hyper
org.vss.api- REST endpoints extendingAbstractVssApiorg.vss.impl.postgres- PostgreSQL backend using jOOQorg.vss.auth- Authorization (JwtAuthorizer,NoopAuthorizer)org.vss.exception- Custom exceptions (ConflictException,AuthException,NoSuchKeyException)
Single table vss_db with composite primary key (user_token, store_id, key). Schema files:
- Java:
java/app/src/main/java/org/vss/impl/postgres/sql/v0_create_vss_db.sql - Rust:
rust/impls/src/postgres/sql/v0_create_vss_db.sql
Config via java/app/src/main/resources/application.properties. All properties can be overridden by environment variables with the same name (e.g., vss.jdbc.url).
Config via TOML file (default: rust/server/vss-server-config.toml). All values can be overridden by environment variables prefixed with VSS_ (e.g., VSS_POSTGRESQL_HOST).
VSS supports two levels of versioning:
- Key-level versioning: Optimistic concurrency control per key. Use version
-1to skip version checks. - Global versioning: Store-wide sequence number for multi-device synchronization.