npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@kvrt/litebase-client-sdk

v0.1.5

Published

Official JavaScript/TypeScript SDK for Litebase

Readme

Litebase SDK

The official JavaScript/TypeScript SDK for Litebase - a lightweight alternative to Firebase and Supabase.

Installation

npm install @kvrt/litebase-client-sdk
# or
yarn add @kvrt/litebase-client-sdk
# or
pnpm add @kvrt/litebase-client-sdk

Quick Start

import { LitebaseClient } from '@kvrt/litebase-client-sdk'

// Initialize the client
const client = new LitebaseClient({
  apiKey: 'your-api-key',
  projectId: 'your-project-id',
  baseUrl: 'http://localhost:3000', // Optional, defaults to http://localhost:3000
})

// Connect for real-time features
await client.connect()

// Create a table
await client.createTable('tasks', {
  id: { type: 'uuid', primary: true },
  title: { type: 'string' },
  status: { type: 'string' },
  created_at: { type: 'timestamp', default: 'now()' },
})

// Insert data
const [task] = await client.insert('tasks', [
  {
    title: 'My first task',
    status: 'pending',
  },
])

// Query data
const tasks = await client.query('tasks', {
  orderBy: { created_at: 'desc' },
})

// Subscribe to real-time updates
const unsubscribe = client.subscribe('tasks', (event) => {
  console.log('Task updated:', event.data)
})

// Cleanup subscription when done
unsubscribe()

Features

  • Project Management
  • Table Creation and Schema Management
  • Data Operations (CRUD)
  • Real-time Subscriptions via WebSocket
  • Type-safe API with TypeScript
  • Automatic Error Handling and Reconnection

API Reference

Initialization

const client = new LitebaseClient({
  apiKey: string;      // Your API key
  projectId?: string;  // Project ID (required for most operations)
  baseUrl?: string;    // Custom API URL (defaults to http://localhost:3000)
});

// Connect WebSocket for real-time features
await client.connect();

Project Management

// Get project details
const project = await client.getProject()

// List all projects
const projects = await client.listProjects()

// Create a new project
const newProject = await client.createProject('My Project')

Table Management

// Create a table with schema
const table = await client.createTable('tasks', {
  id: { type: 'uuid', primary: true },
  title: { type: 'string' },
  description: { type: 'string', nullable: true },
  status: { type: 'string' },
  created_at: { type: 'timestamp', default: 'now()' },
})

// List tables
const tables = await client.listTables()

// Get table details
const table = await client.getTable('tasks')

Data Operations

// Query data with filters and ordering
const results = await client.query('tasks', {
  where: { status: 'pending' },
  orderBy: { created_at: 'desc' },
  limit: 10,
  offset: 0,
})

// Insert data with returning fields
const [task] = await client.insert('tasks', [
  {
    title: 'New task',
    status: 'pending',
  },
])

// Update data
const updated = await client.update(
  'tasks',
  { status: 'completed' },
  { where: { id: task.id } }
)

// Delete data
const deleted = await client.delete('tasks', {
  where: { id: task.id },
})

Real-time Subscriptions

// Subscribe to all changes on a table
const unsubscribe = client.subscribe('tasks', (event) => {
  console.log('Event type:', event.type) // 'INSERT' | 'UPDATE' | 'DELETE'
  console.log('Changed data:', event.data)
})

// Subscribe with filters
const filteredUnsubscribe = client.subscribe(
  'tasks',
  (event) => {
    console.log('Pending task changed:', event.data)
  },
  { where: { status: 'pending' } }
)

// Cleanup subscriptions when done
unsubscribe()
filteredUnsubscribe()

Error Handling

The SDK includes built-in error handling and automatic WebSocket reconnection:

try {
  await client.query('non_existent_table')
} catch (error) {
  if (error.code === 'TABLE_NOT_FOUND') {
    console.error('Table does not exist')
  }
}

// WebSocket connection status
client.onConnectionChange((status) => {
  console.log('Connection status:', status)
})

Development

# Install dependencies
npm install

# Run tests
npm test

# Build
npm run build

# Watch mode
npm run dev

License

MIT