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

@backflow.sdk/client

v0.1.0

Published

Tenant SDK for Backflow API (user-facing resources only)

Readme

@backflow/sdk

Auto-generated TypeScript SDK for Backflow API.

Installation

npm install @backflow/sdk

Quick Start

import { createBackflow } from '@backflow/sdk';

const bf = await createBackflow({
  apiKey: 'bf_live_xxx',
  tenantId: 'my-tenant-id',
});

// Typed resource methods
await bf.files.upload(file, { entityType: 'project', entityId: 'proj-123' });
await bf.workflows.execute({ steps: [...] });
await bf.tenant.secrets.set('API_KEY', 'secret-value');

// Dynamic resources for tenant-specific routes
await bf.resource('projects').list();
await bf.resource('classes').create({ name: 'Yoga' });

Configuration

interface BackflowConfig {
  apiKey?: string;                      // For server-to-server auth
  getAuthToken?: () => Promise<string>; // For browser/dynamic auth
  tenantId: string;                     // Required
  endpoint?: string;                    // Defaults to https://api.backflow.dev
}

With Firebase Auth (Browser)

import { createBackflow } from '@backflow/sdk';
import { getAuth } from 'firebase/auth';

const bf = await createBackflow({
  tenantId: 'my-tenant-id',
  getAuthToken: async () => {
    const user = getAuth().currentUser;
    return user?.getIdToken() || '';
  }
});

Typed Resources

Files

// Single file upload
const result = await bf.files.upload(file, {
  entityType: 'project',
  entityId: 'proj-123',
});

// Multiple files
const results = await bf.files.uploadMultiple(files, {
  entityType: 'project',
  entityId: 'proj-123',
});

// List files
const files = await bf.files.list('project', 'proj-123');

// Get signed URL
const { url } = await bf.files.getSignedUrl('bucket', 'path/to/file.pdf');

// Delete
await bf.files.delete('bucket', 'path/to/file.pdf');
await bf.files.deleteByEntity('project', 'proj-123');

Workflows

// Execute workflow
const execution = await bf.workflows.execute({
  steps: [
    { id: 'fetch', action: 'api_call', params: { url: '...' } },
    { id: 'analyze', action: 'llm_call', params: { prompt: '...' } },
  ],
});

// Subscribe to progress (WebSocket)
const unsubscribe = bf.workflows.subscribe(execution.id, {
  onProgress: (event) => console.log('Step:', event.stepId, event.status),
  onComplete: (result) => console.log('Done:', result),
  onError: (err) => console.error(err),
});

// Control
await bf.workflows.pause(execution.id);
await bf.workflows.resume(execution.id);
await bf.workflows.cancel(execution.id);
await bf.workflows.retry(execution.id);

// List & history
const { data } = await bf.workflows.list({ limit: 10 });
const { history } = await bf.workflows.getHistory(execution.id);

Tenant & Secrets

// Get/update config
const config = await bf.tenant.getConfig();
await bf.tenant.updateConfig({ settings: { theme: 'dark' } });

// Secrets management
await bf.tenant.secrets.set('STRIPE_KEY', 'sk_xxx', {
  provider: 'stripe',
  description: 'Production API key',
});

const secrets = await bf.tenant.secrets.list();
await bf.tenant.secrets.rotate('STRIPE_KEY', 'sk_new_xxx');
await bf.tenant.secrets.delete('OLD_KEY');

Embeddings

// Embed document
const result = await bf.embeddings.embedDocument({
  document: 'Your document text...',
  documentId: 'doc-123',
  contentType: 'article',
});

// Batch embed
const batchResult = await bf.embeddings.embedBatch([
  { document: 'Doc 1...', documentId: 'doc-1' },
  { document: 'Doc 2...', documentId: 'doc-2' },
]);

// Search
const { results } = await bf.embeddings.search('doc-123', 'query text', 5);

// Semantic search across all docs
const { results } = await bf.embeddings.semanticSearch('find similar content');

// Delete
await bf.embeddings.delete('doc-123');

LLM

// Chat
const response = await bf.llm.chat([
  { role: 'user', content: 'Hello!' }
], { model: 'gpt-4', temperature: 0.7 });

// Simple completion
const response = await bf.llm.complete('Explain quantum computing');

// List models
const { models } = await bf.llm.models();

Usage

const myUsage = await bf.usage.getMyUsage();
const userUsage = await bf.usage.getUserUsage('user-123');
const summary = await bf.usage.getSummary('user-123');

Dynamic Resources

For tenant-defined routes (projects, users, teams, etc.):

// Use resource() for any endpoint
const projects = await bf.resource('projects').list();
const project = await bf.resource('projects').get('proj-123');
await bf.resource('projects').create({ name: 'New Project' });
await bf.resource('projects').update('proj-123', { name: 'Updated' });
await bf.resource('projects').delete('proj-123');

// Nested resources
await bf.resource('teams/team-123/members').list();

Raw Requests

// Direct HTTP methods
const data = await bf.get('/custom/endpoint', { param: 'value' });
await bf.post('/custom/endpoint', { body: 'data' });
await bf.put('/custom/endpoint', { body: 'data' });
await bf.patch('/custom/endpoint', { body: 'data' });
await bf.delete('/custom/endpoint');

License

ISC