Skip to main content
The JavaScript SDK provides a TypeScript-first client for interacting with VectorAI DB over gRPC. This guide walks you through installing the SDK and verifying your setup.

Prerequisites

Before you begin, make sure you have the following installed.
RequirementVersion
Node.js18 or higher (LTS recommended)
npm9 or higher (or yarn 1.22+)
VectorAI DBRunning instance (default: localhost:50051)

Install the SDK

Add the VectorAI DB JavaScript SDK to your project using npm.
npm install @actian/cortex-client
Alternatively, use yarn:
yarn add @actian/cortex-client

Install from source

You can also install the SDK directly from the repository.
git clone https://github.com/ActianCorp/cortex.client.git
cd cortex.client/clients/node
npm install
npm run build

Verify installation

VectorAI DB required: To verify your installation, you need a running VectorAI DB instance. Follow the Docker installation guide to set one up.
Test that the SDK is installed correctly by connecting to the server over gRPC on localhost:50051 and running a health check. Save the following as health.ts and run it with npx ts-node health.ts.
import { CortexClient } from '@actian/cortex-client';

async function main() {
    // Connect to the VectorAI DB server
    const client = new CortexClient('localhost:50051');

    // Run a health check
    const health = await client.healthCheck();
    console.log(`Server: ${health.title} v${health.version}`);

    // Close the connection
    client.close();
}

main().catch(console.error);
If the connection is successful, then the output displays the server name and version.
Server: VectorAI DB v0.1.0

Project setup

Create a dedicated project directory for your VectorAI DB application. Then add the SDK to the project.
npm install @actian/cortex-client

Troubleshooting

If you run into problems during installation, check the table below for common issues and solutions.

Common issues

The following table lists common installation issues and their solutions.
IssueSolution
MODULE_NOT_FOUNDVerify the SDK is installed in the correct project. Run npm ls @actian/cortex-client.
gRPC connection errorsConfirm that VectorAI DB is running and accessible on the expected port.
Node.js version mismatchCheck your version with node --version. The SDK requires Node.js 18 or later.
TypeScript compilation errorsEnsure tsconfig.json targets ES2020 or later and enables esModuleInterop.

Next steps

Now that the SDK is installed, explore these resources to start building.

Quickstart

Build your first application with the JavaScript SDK.

Core concepts

Learn about collections, vectors, and payloads.

Tutorials

Follow step-by-step tutorials.