veR2

Installation

Requirements

  • Node.js 22 or newer. The SDK's engine is runtime-agnostic, but the published packages target Node today.
  • A Cloudflare R2 bucket, plus an API token for it (see R2 credentials below).

SDK

npm i @ver2/sdk @aws-sdk/client-s3

@aws-sdk/client-s3 is an optional peer dependency. It is only needed for @ver2/sdk/s3, the R2 storage driver. The in-memory store at @ver2/sdk/memory needs nothing extra, which makes it handy in tests.

The package has three entry points:

ImportWhat it gives you
@ver2/sdkcreateVer2, the Ver2 client, errors, types
@ver2/sdk/s3S3ObjectStore, the driver for R2
@ver2/sdk/memoryMemoryObjectStore, an in-memory store for tests

CLI

npm i -g @ver2/cli
ver2 --help

Or run it without installing:

npx @ver2/cli --help

From source

git clone https://github.com/JBuxo/ver2.git
cd ver2
npm install
npm run build
node cli/dist/index.js --help

R2 credentials

veR2 talks to R2 through its S3-compatible API, so it needs an R2 API token:

  1. In the Cloudflare dashboard, open R2 and note your account ID.
  2. Go to Manage API tokens → Create API token.
  3. Give it Object Read & Write permission, scoped to the bucket you want to version.
  4. Copy the access key ID and secret access key. The secret is shown only once.

You now have the four values veR2 needs: account ID, bucket name, access key ID and secret access key.

Next: Quickstart: SDK or Quickstart: CLI.