2 JS Sdk Installation
Anton Nesterov edited this page 2026-02-22 22:54:39 +01:00

JS SDK Installation

Install and configure the VSKI SDK for JavaScript

VSKI Package Registry

VSKI packages are hosted on our custom registry. To install @vski/sdk or other VSKI packages, you must add our registry to your npm configuration.

Adding the VSKI Registry

npm

⚠️ VSKI NPM Packages ONLY HOSTED on git.vski.sh!:

Create or update .npmrc in your project root:

cat > .npmrc << 'EOF'
@vski:registry=https://git.vski.sh/api/packages/x/npm/
EOF

Or manually add to your existing .npmrc:

echo "@vski:registry=https://git.vski.sh/api/packages/x/npm/" >> .npmrc

yarn

For Yarn 1.x and 2.x:

cat > .yarnrc.yml << 'EOF'
npmScopes:
  "@vski":
    npmRegistryServer: "https://git.vski.sh/api/packages/x/npm/"
EOF

For Yarn 3.x (Berry):

yarn config set npmScopes.@vski.npmRegistryServer https://git.vski.sh/api/packages/x/npm/

pnpm

Add to .npmrc:

echo "@vski:registry=https://git.vski.sh/api/packages/x/npm/" > .npmrc
pnpm config set @vski:registry https://git.vski.sh/api/packages/x/npm/

Installation

Once the registry is configured, install the SDK:

npm install @vski/sdk

Or with Yarn:

yarn add @vski/sdk

Or with pnpm:

pnpm add @vski/sdk

Project Setup

Importing the SDK

import { VskiClient } from "@vski/sdk";

Initialize Client

const client = new VskiClient("http://localhost:3000");

Configure Authentication

// Login as admin with email and password
const auth = await client.admins.authWithPassword(
  "admin@rocketbase.dev",
  "password123",
);
client.setToken(auth.token);

// Or use API key
client.setToken("your-api-key");

Multi-Database Support

// Set the active database
client.db("my-database").collection("posts").getList(1, 20);

// Or use the setDb method (legacy)
client.setDb("my-database");
const posts = await client.collection("posts").getList(1, 20);

Available Packages

The following packages are available from the VSKI registry:

Package Description
@vski/sdk Core VSKI client SDK
@vski/workflow-functional Workflow utilities and helpers

Troubleshooting

Package Not Found

If you see "package not found" errors:

  1. Verify .npmrc (or .npmrc) contains the registry line
  2. Clear npm cache: npm cache clean --force
  3. Delete node_modules and package-lock.json
  4. Reinstall: npm install

E404 from Registry

If you see E404 errors when installing:

  1. Verify the package name is correct
  2. Check the registry URL: npm config get @vski:registry
  3. Ensure you have internet access to git.vski.sh

TypeScript Errors

If TypeScript cannot find the module:

  1. Verify @vski/sdk is in your package.json dependencies
  2. Check your tsconfig.json includes the correct moduleResolution
  3. Restart your TypeScript language server

Package Management

Updating Packages

npm update @vski/sdk

Checking Installed Version

npm list @vski/sdk

Uninstalling

npm uninstall @vski/sdk

CI/CD Configuration

GitHub Actions

name: Install VSKI SDK
run: |
  echo "@vski:registry=https://git.vski.sh/api/packages/x/npm/" >> $HOME/.npmrc
  npm install @vski/sdk

GitLab CI

install_dependencies:
  script:
    - echo "@vski:registry=https://git.vski.sh/api/packages/x/npm/" >> $npmrc
    - npm ci

Vercel

{
  "installCommand": "echo '@vski:registry=https://git.vski.sh/api/packages/x/npm/' >> $VERCEL_HOME/.npmrc && npm install"
}