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

@scarletdb/sdk

v0.2.0

Published

Official TypeScript SDK for Scarlet DB - The modern Backend-as-a-Service platform

Readme

@scarletdb/sdk

Official TypeScript SDK for Scarlet DB - The modern Backend-as-a-Service platform.

Installation

npm install @scarletdb/sdk
# or
pnpm add @scarletdb/sdk
# or
yarn add @scarletdb/sdk
# or
bun add @scarletdb/sdk

Quick Start (Server)

import { createScarlet } from '@scarletdb/sdk'

const scarlet = createScarlet({
  projectId: 'YOUR_PROJECT_ID',
  apiKey: process.env.SCARLET_API_KEY!,
  url: 'https://api.scarletdb.space',
})

const { rows } = await scarlet.from('users').select().limit(10).execute()
console.log(rows)

Quick Start (Browser)

Do not ship secret API keys to the browser. Use a publishable key to mint short-lived tokens, and enable proof-of-possession.

import { createScarlet } from '@scarletdb/sdk'

const scarlet = createScarlet({
  projectId: 'YOUR_PROJECT_ID',
  url: 'https://api.scarletdb.space',
  publishableKey: 'pk_***************',
  enableDpop: true,
})

const { rows } = await scarlet.from('users').select().limit(10).execute()
console.log(rows)

Features

📊 Data API

Fluent query builder for CRUD operations on your database tables.

// Select with filters
const activeUsers = await scarlet
  .from('users')
  .select('id', 'name', 'email')
  .where({ active: true })
  .orderBy('created_at', 'desc')
  .limit(20)
  .execute();

// Insert single row
const { row: newUser } = await scarlet.from('users').insert({
  name: 'Jane',
  email: '[email protected]',
});

// Update with filters
await scarlet.from('users')
  .where({ id: userId })
  .update({ last_login: new Date() });

// Delete with filters
await scarlet.from('users').where({ id: userId }).delete();

📁 Storage

Upload, download, and manage files in cloud storage.

// Upload a file
const uploaded = await scarlet.storage.upload('avatars', file, { randomId: true });
console.log(uploaded.url);

// List files in bucket
const files = await scarlet.storage.list('avatars');

// Delete a file
await scarlet.storage.delete('avatars', 'old-avatar.png');

📧 Email

Send transactional emails with custom domains.

// Send an email
await scarlet.email.send({
  from: '[email protected]',
  to: '[email protected]',
  subject: 'Welcome to MyApp!',
  html: '<h1>Welcome!</h1><p>Thanks for signing up.</p>',
});

// List configured domains
const domains = await scarlet.email.listDomains();

🤖 AI Queries

Natural language to SQL conversion powered by AI.

// Query with natural language
const result = await scarlet.ai.query('Show me all users who signed up last week');

console.log(result.sql);    // Generated SQL
console.log(result.data);   // Query results

Configuration

const scarlet = createScarlet({
  projectId: 'YOUR_PROJECT_ID',
  url: 'https://api.scarletdb.space',
  apiKey: process.env.SCARLET_API_KEY!,
  timeout: 30000,
})

Error Handling

import { createScarlet, ScarletError } from '@scarletdb/sdk';

try {
  const scarlet = createScarlet({
    projectId: 'YOUR_PROJECT_ID',
    apiKey: process.env.SCARLET_API_KEY!,
  })
  await scarlet.from('users').insert({ email: 'invalid' });
} catch (error) {
  if (error instanceof ScarletError) {
    console.error('Scarlet Error:', error.message);
    console.error('Status:', error.status);
    console.error('Code:', error.code);
  }
}

TypeScript Support

Full TypeScript support with generics for type-safe queries:

interface User {
  id: number;
  name: string;
  email: string;
  created_at: Date;
}

// Type-safe queries
const { rows } = await scarlet.from<User>('users').select().execute()
// rows is typed as User[]

License

MIT