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

firestarter-sdk

v2.1.7

Published

TypeScript SDK for Pipe Network decentralized storage - Clean, explicit, and framework-agnostic

Readme

Firestarter SDK

TypeScript client for Pipe Network decentralized storage.

Simple, explicit, and framework-agnostic. Build decentralized storage into your JavaScript applications with straightforward API calls.

Installation

npm install firestarter-sdk

Quick Start

import { PipeClient } from 'firestarter-sdk';

const client = new PipeClient();

// 1. Login or create account
const account = await client.login('myusername', 'mypassword');
// or: await client.createAccount('myusername', 'mypassword');

// 2. Upload a file
const file = new File([...], 'document.pdf');
const result = await client.uploadFile(account, file, 'document.pdf', {
  onProgress: (percent) => console.log(`${percent}%`)
});

// 3. Download file (use original filename!)
const data = await client.downloadFile(account, 'document.pdf');

Core Features

Account Management

// Create new account
const account = await client.createAccount(username, password);

// Login to existing account
const account = await client.login(username, password);

// Check balance
const balance = await client.getBalance(account);
// Returns: { sol: number, pipe: number, publicKey: string }

File Operations

// Upload
const result = await client.uploadFile(account, file, 'filename.txt', {
  onProgress: (percent) => console.log(`Progress: ${percent}%`)
});

// Download (IMPORTANT: use original filename, not blake3 hash)
const data = await client.downloadFile(account, 'filename.txt');

// Delete
await client.deleteFile(account, fileId);

Token Operations

// Exchange SOL for PIPE tokens
const pipeAmount = await client.exchangeSolForPipe(account, 0.1); // 0.1 SOL

Usage Patterns

With Wallet Address (Deterministic)

Generate the same account from a wallet address every time:

import { generateCredentialsFromAddress } from 'firestarter-sdk';

const creds = generateCredentialsFromAddress(walletAddress);

// Try login, create if doesn't exist
let account;
try {
  account = await client.login(creds.username, creds.password);
} catch (e) {
  account = await client.createAccount(creds.username, creds.password);
}

With localStorage Persistence

Save credentials so users don't re-login every time:

import { PipeAccountStorage } from 'firestarter-sdk';

const storage = new PipeAccountStorage();

let account = storage.load();
if (!account) {
  account = await client.login(username, password);
  storage.save(account);
}

React Hooks

import { useFileUpload, useBalance } from 'firestarter-sdk';

function MyComponent({ account }) {
  const { upload, uploading, progress } = useFileUpload(account);
  const { balance, loading } = useBalance(account);

  return (
    <div>
      <p>PIPE Balance: {balance?.pipe}</p>
      <input
        type="file"
        onChange={(e) => upload(e.target.files[0], e.target.files[0].name)}
      />
      {uploading && <p>Uploading: {progress}%</p>}
    </div>
  );
}

With Privy Integration

import { usePrivy, useWallets } from '@privy-io/react-auth';
import { PipeClient, generateCredentialsFromAddress } from 'firestarter-sdk';

function App() {
  const { authenticated } = usePrivy();
  const { wallets } = useWallets();
  const [pipeAccount, setPipeAccount] = useState(null);

  const connectStorage = async () => {
    const creds = generateCredentialsFromAddress(wallets[0].address);
    try {
      const account = await client.login(creds.username, creds.password);
      setPipeAccount(account);
    } catch (e) {
      const account = await client.createAccount(creds.username, creds.password);
      setPipeAccount(account);
    }
  };

  return authenticated && <button onClick={connectStorage}>Connect Storage</button>;
}

Local File Tracking

Pipe Network doesn't provide a file listing API. Track uploads locally:

import { PipeFileStorage } from 'firestarter-sdk';

const fileStorage = new PipeFileStorage();

// After upload
const result = await client.uploadFile(account, file, 'example.txt');
fileStorage.addFile(result);

// List files
const files = fileStorage.listFiles();

// Remove file
fileStorage.removeFile(fileId);

Error Handling

import { PipeApiError, PipeValidationError } from 'firestarter-sdk';

try {
  await client.login(username, password);
} catch (error) {
  if (error instanceof PipeApiError) {
    console.error('API error:', error.status, error.message);
  } else if (error instanceof PipeValidationError) {
    console.error('Validation error:', error.message);
  }
}

TypeScript Types

interface PipeAccount {
  username: string;
  password: string;
  userId: string;
  userAppKey: string;
  accessToken?: string;
  refreshToken?: string;
  tokenExpiry?: number;
}

interface Balance {
  sol: number;
  pipe: number;
  publicKey: string;
}

interface UploadResult {
  fileId: string;        // blake3 hash
  fileName: string;      // original filename (use this for downloads!)
  size: number;
  blake3Hash: string;
  uploadedAt: Date;
}

Examples

See examples/ for complete working code:

When to Use SDK vs Direct API

| Use SDK When... | Use Direct API When... | |---------------------|----------------------------| | ✅ Building JavaScript/TypeScript app | ✅ Using another language (Python, Go, Rust) | | ✅ Want automatic JWT token management | ✅ Need custom authentication flow | | ✅ Need React hooks | ✅ Using different framework | | ✅ Want typed errors & responses | ✅ Prefer raw HTTP responses |

API Reference

See API_REFERENCE.md for detailed HTTP endpoint documentation.

Design

  • Explicit API - Clear, straightforward method calls
  • Developer Control - You manage authentication and state
  • Framework Agnostic - Works in Node.js, React, Vue, Svelte, vanilla JS
  • TypeScript First - Full type safety and IntelliSense support

License

MIT

Links

Firestarter SDK:

  • NPM Package: https://www.npmjs.com/package/firestarter-sdk
  • GitHub: https://github.com/0xmigi/firestarter-sdk
  • Issues: https://github.com/0xmigi/firestarter-sdk/issues

Pipe Network:

  • Website: https://pipe.network/
  • Documentation: https://docs.pipe.network/
  • CLI Tool: https://github.com/PipeNetwork/pipe