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

@assetflux.io/sdk

v1.0.0

Published

TypeScript/Node.js SDK for AssetFlux — asset management, manifest fetching, and rollout support

Downloads

92

Readme

AssetFlux TypeScript SDK

npm version License: BSD-3-Clause

Server-side TypeScript/Node.js SDK for AssetFlux. Fetch asset manifests, resolve CDN URLs, and manage gradual rollouts in your Node.js applications, SSR frameworks, or build pipelines.

Getting Started

1. Install

npm install @assetflux.io/sdk

2. Initialize

import { AssetFlux } from '@assetflux.io/sdk';

const result = await AssetFlux.init({
  projectId: 'af_your_project_id',
  apiKey: 'afk_your_sdk_key',
});

console.log(`Environment: ${result.environment}`);

3. Access the Manifest

const manifest = AssetFlux.getManifest();

for (const asset of manifest.assets) {
  console.log(`${asset.key}: ${asset.cdnUrl}`);
}

Usage

Get Manifest and Assets

const manifest = AssetFlux.getManifest();
const asset = manifest?.assets.find(a => a.key === 'home.hero.banner');

if (asset) {
  console.log(asset.cdnUrl);      // CDN URL for the active version
  console.log(asset.version.id);  // Version identifier
  console.log(asset.rollout);     // { percentage: 100 }
}

Force Refresh

const updated = await AssetFlux.refreshManifest();
console.log(`Refreshed: ${updated.assets.length} assets`);

Cache Statistics

const stats = AssetFlux.getManifestCacheStats();
console.log(stats);
// { hasCachedManifest: true, isExpired: false, ttlRemaining: 285000, assetCount: 12, ... }

Rollout Assignment

// Check if current device is in a rollout
const inRollout = AssetFlux.isInRollout(50); // 50% rollout
console.log(`In rollout: ${inRollout}`);

// Get full rollout details
const assignment = AssetFlux.getRolloutAssignment(25);
console.log(assignment);
// { identifier: '...', bucket: 42, isInRollout: false }

// Check specific asset rollout
const assetInRollout = AssetFlux.isAssetInRollout('home.hero.banner');

User-Based Rollout

await AssetFlux.init({
  projectId: 'af_...',
  apiKey: 'afk_...',
  config: {
    identifierType: 'user',
  },
});

// After user login
AssetFlux.setUserId('user_12345');

Custom HTTP Client

import { AssetFluxSDK, HttpClient } from '@assetflux.io/sdk';

const customClient: HttpClient = {
  async get(url, options) {
    const res = await myHttpLib.get(url, { headers: options?.headers });
    return { status: res.statusCode, data: res.body };
  },
};

const sdk = new AssetFluxSDK(customClient);
await sdk.init({ projectId: 'af_...', apiKey: 'afk_...' });

Configuration

await AssetFlux.init({
  projectId: 'af_...',
  apiKey: 'afk_...',
  config: {
    baseUrl: 'https://api.assetflux.io',   // API base URL
    cacheTTL: 300_000,                       // 5 minutes
    timeout: 10_000,                         // 10 seconds
    retryAttempts: 3,
    fallbackBehavior: 'cache',               // 'cache' | 'bundled' | 'error'
    identifierType: 'device',                // 'device' | 'user' | 'custom'
    backgroundRefresh: true,
    refreshInterval: 900_000,                // 15 minutes
    cacheDirectory: '/tmp/assetflux-cache',  // disk cache location
    debug: false,
  },
});

| Option | Type | Default | Description | |--------|------|---------|-------------| | baseUrl | string | https://api.assetflux.io | API base URL | | cacheTTL | number | 300000 (5m) | Manifest cache TTL in ms | | timeout | number | 10000 (10s) | Network request timeout in ms | | retryAttempts | number | 3 | Max retry attempts with exponential backoff | | fallbackBehavior | string | cache | Behavior when offline: cache, bundled, or error | | identifierType | string | device | Identifier for rollout: device, user, or custom | | backgroundRefresh | boolean | true | Enable background manifest refresh | | refreshInterval | number | 900000 (15m) | Background refresh interval in ms | | cacheDirectory | string? | OS default | Directory for disk-based manifest cache | | debug | boolean | false | Enable debug logging |

Requirements

  • Node.js >= 18.0

Documentation

Full documentation is available at docs.assetflux.io/typescript.

License

BSD 3-Clause. See LICENSE for details.