Set up the client library

Get familiar with the Ocelloids Client SDK.

This guide will introduce you to the Ocelloids Client TypeScript SDK external link . You can follow it by either cloning a quickstart repository or initializing a new project.

You will need Bun external link to follow this guide. If you don’t have Bun installed, please install it external link .

Quickstart Repository

Hint

Explore the examples/ directory in the quickstart project external link to find various usage scenarios.

We provide a quickstart repository with a bootstraped project for your convenience.

Clone the repository
bun create github.com/sodazone/quickstart-ocelloids-services
Important

Replace <YOUR_API_KEY> with your API key in the command below. If you don’t have one, go to Get API Key .

OC_API_KEY=<YOUR_API_KEY> bun run index.ts
All set! 🎉 👏👏
Expected Output
{
  statusCode: 200,
  status: "ok",
  uptime: 31556952001.881527013,
}

Quickstart New Project

If you prefer to start a new project follow these steps.

  1. Create your project directory
mkdir ocelloids-quickstart && cd ocelloids-quickstart
  1. Initialize the project
Initialize package.json
bun init -y
  1. Add the client library dependency
bun add @sodazone/ocelloids-client
  1. Create a simple client script

Replace the contents of index.ts with the following code.

index.ts
import { OcelloidsClient } from "@sodazone/ocelloids-client";

const client = new OcelloidsClient({
  apiKey: process.env.OC_API_KEY
});

client.health()
  .then(console.log)
  .catch(console.error);
Simple health check
  1. Run the client
Important

Replace <YOUR_API_KEY> with your API key in the command below. If you don’t have one, go to Get API Key .

OC_API_KEY=<YOUR_API_KEY> bun run index.ts
All set! 🎉 👏👏
Expected Output
{
  statusCode: 200,
  status: "ok",
  uptime: 31556952001.881527013,
}

Documentation

Refer to the Ocelloids Typescript Client Library documentation site external link .