Skip to content

@varity-labs/sdk Installation

Varity Team Core Contributors Updated March 2026

Get the Varity SDK installed and configured in your project.

Terminal window
npm install @varity-labs/sdk
  1. Import the SDK

    import { db, resolveCredentials } from '@varity-labs/sdk';
  2. Use the database

    // Create a collection and add data
    const users = db.collection('users');
    await users.add({ name: 'Alice', email: 'alice@example.com' });
    // Query data
    const result = await users.get({ limit: 10 });
  3. Check credential status (optional)

    import { resolveCredentials, isUsingDevCredentials } from '@varity-labs/sdk';
    const creds = resolveCredentials();
    console.log('Using dev credentials:', isUsingDevCredentials());

Varity manages all credentials automatically. No environment variables are needed to start developing.

The SDK is written in TypeScript. Recommended tsconfig.json settings:

tsconfig.json
{
"compilerOptions": {
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"esModuleInterop": true
}
}

The SDK supports tree-shaking. Import only what you need.

// Good - imports only what's needed
import { db, resolveCredentials } from '@varity-labs/sdk';
// Avoid - imports the entire package
import * as VaritySDK from '@varity-labs/sdk';

Approximate bundle sizes:

  • Full SDK: ~50KB gzipped
  • Core only: ~20KB gzipped