Skip to content

Installation

Install using package manager of choice:

Terminal window
npm install --save @dxos/client

Configuration

If using DXOS in a browser environment, set up your Vite config:

import { defineConfig } from 'vite';
import topLevelAwait from 'vite-plugin-top-level-await';
import wasm from 'vite-plugin-wasm';
export default defineConfig({
plugins: [topLevelAwait(), wasm()],
worker: {
format: 'es',
plugins: [topLevelAwait(), wasm()],
},
});

Create and initialize a Client:

import { Client } from '@dxos/client';
// Create a client.
const client = new Client();
const main = async () => {
// Initialize the client.
await client.initialize();
// Use the client here.
};
void main();

An options object can be passed to Client(). See configuration examples.

To begin manipulating data, we must create an identity, and join or create a space.