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.1.2

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

import { Scarlet } from '@scarletdb/sdk';

// Initialize with your project API key
const db = new Scarlet({
  apiKey: 'sk_live_your_api_key',
});

// Query data
const users = await db.from('users').select().limit(10);

// Insert data
await db.from('users').insert({
  name: 'John Doe',
  email: '[email protected]',
});

// Update data
await db.from('users').update({ active: true }).where({ id: 1 });

// Delete data
await db.from('users').delete().where({ id: 1 });

Features

📊 Data API

Fluent query builder for CRUD operations on your database tables.

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

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

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

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

📁 Storage

Upload, download, and manage files in cloud storage.

// Upload a file
await db.storage.upload('avatars', file);

// Get public URL
const url = db.storage.getPublicUrl('avatars', 'avatar.png');

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

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

📧 Email

Send transactional emails with custom domains.

// Send an email
await db.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 db.email.listDomains();

🤖 AI Queries

Natural language to SQL conversion powered by AI.

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

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

🔧 Raw SQL

Execute raw SQL queries when you need full control.

// Parameterized query (safe)
const result = await db.sql(
  'SELECT * FROM users WHERE created_at > $1 AND status = $2',
  [lastWeek, 'active']
);

// Access results
console.log(result.rows);
console.log(result.rowCount);

Configuration

const db = new Scarlet({
  // Required: Your project API key
  apiKey: 'sk_live_...',
  
  // Optional: Custom API URL (defaults to production)
  baseUrl: 'https://api.scarletdb.space',
  
  // Optional: Request timeout in ms (default: 30000)
  timeout: 30000,
});

Error Handling

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

try {
  await db.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 users = await db.from<User>('users').select();
// users is typed as User[]

License

MIT