JSPM

@triplit/client

0.3.63
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 51135
  • Score
    100M100P100Q155460F
  • License AGPL-3.0-only

Package Exports

  • @triplit/client
  • @triplit/client/worker-client
  • @triplit/client/worker-client-operator

Readme

Triplit Client

@triplit/client is the official library running Triplit in the client and syncing with a Triplit server.

Official documentation is hosted here

Installation

You can install @triplit/client using npm, pnpm, yarn, or bun:

npm i @triplit/client
pnpm add @triplit/client
yarn add @triplit/client
bun add @triplit/client

Basic Usage

Here's a simple example of how to use @triplit/client:

import { Client } from '@triplit/client';

const client = new Client({
  /* configuration */
});

// Fetch data
const data = client.fetch(client.query('todos').build());

// Insert data
await client.transact(async (tx) => {
  await tx.insert('todos', {
    text: 'New Todo',
    tagIds: new Set(['tag1', 'tag2']),
  });
  await tx.insert('tags', {
    text: 'New Todo',
    tagIds: new Set(['tag1', 'tag2']),
  });
});

Documentation

For more information and examples of @triplit/client in action, please refer to the official Triplit documentation.

Framework Bindings

Framework Package Docs
Svelte @triplit/svelte Svelte Docs
React @triplit/react React Docs