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

usefastlane-api

v1.1.1

Published

TypeScript SDK for Fastlane AI content generation API

Readme

Fastlane API SDK

TypeScript SDK for the Fastlane AI content generation API.

Installation

bun add usefastlane-api
# or
npm install usefastlane-api

Quick Start

import { FastlaneClient } from "usefastlane-api";

const client = new FastlaneClient("fsln_live_your_api_key");

Examples

Pop a Blitz (Content Generation)

const blitz = await client.popBlitz();
console.log(blitz.contentId);
console.log(blitz.suggestion.contentType); // "slideshow" | "wall-of-text" | "green-screen" | "video-hook"
console.log(blitz.swipesRemaining);

// Poll for content readiness
let content = await client.getContentById(blitz.contentId);
while (content.status === "BUILDING") {
  await new Promise(r => setTimeout(r, 5000));
  content = await client.getContentById(blitz.contentId);
}

if (content.status === "CREATED") {
  console.log(content.files); // Array of URLs
  console.log(content.thumbnailUrl);
}

Get/Update Preferences

// Get current preferences
const prefs = await client.getPreferences();
console.log(prefs.slideshowWeight); // 25

// Update single field (no queue flush)
await client.updatePreferences({ ownMediaPercentage: 75 });

// Update content type weights (triggers queue flush)
await client.updatePreferences({
  slideshowWeight: 40,
  wallOfTextWeight: 30,
  greenScreenWeight: 20,
  videoHookWeight: 10,
  remixPercentage: 60,
});

Manage Angles

// List all angles
const angles = await client.getAngles();
angles.forEach(a => console.log(`${a.title}: ${a.description}`));

// Create new angle
const newAngle = await client.createAngle({
  title: "Behind the scenes",
  description: "Show how the product gets built day-to-day",
  targetAudience: "Engineers considering our toolchain",
});

// Update angle
await client.updateAngle(newAngle._id, { isActive: false });

// Delete angle
await client.deleteAngle(newAngle._id);

List Connections

const connections = await client.getConnections();
connections.forEach(conn => {
  console.log(`${conn.platform}: @${conn.platformUsername}`);
  console.log(`  Expires: ${new Date(conn.tokenExpiry).toISOString()}`);
});

Content Library

// List content with filtering
const content = await client.getContent({
  limit: 20,
  type: "slideshow",
  status: "CREATED",
});

content.data.forEach(c => {
  console.log(`${c._id} - ${c.type} - ${c.status}`);
});

if (content.pagination.hasMore) {
  const nextPage = await client.getContent({ cursor: content.pagination.cursor });
}

// Get single content item
const item = await client.getContentById("content_123");

// Delete content
await client.deleteContent("content_123");

Schedule Content

const post = await client.scheduleContent("content_123", {
  platform: "tiktok",
  utc_datetime: "2026-05-01T18:00:00Z",
  caption: "Check this out!",
  // connectionId optional if only one connection exists for platform
});

console.log(post.postId);

Manage Posts

// List posts
const posts = await client.getPosts({
  status: "SCHEDULED",
  limit: 10,
});

// Get single post
const post = await client.getPostById("post_123");

// Cancel scheduled posts
const result = await client.cancelPosts(["post_1", "post_2", "post_3"]);
console.log(`Cancelled ${result.cancelled} posts`);

Analytics

const metrics = await client.getPostAnalytics([
  "post_123",
  "post_456",
  "post_789",
]);

metrics.data.forEach(m => {
  if (m.notFound) {
    console.log(`${m._id}: Not found`);
  } else {
    console.log(`${m._id}: ${m.views} views, ${m.likes} likes, ${m.comments} comments`);
    console.log(`  Posted: ${new Date(m.postedAt!).toISOString()}`);
    console.log(`  URL: ${m.postUrl}`);
  }
});

Error Handling

import { FastlaneApiError } from "usefastlane-api";

try {
  const result = await client.popBlitz();
} catch (error) {
  if (error instanceof FastlaneApiError) {
    console.log(error.code);    // e.g., "not_found", "blitz_quota_exceeded", "rate_limited"
    console.log(error.status);  // HTTP status code
    console.log(error.message); // Human-readable message
    console.log(error.details);  // Optional details object
  }
  throw error;
}

Common Error Codes

| Code | Description | |------|-------------| | unauthorized | Invalid or revoked API key | | not_found | Resource doesn't exist or queue empty | | bad_request | Invalid request body or parameters | | blitz_quota_exceeded | Daily swipe cap reached | | rate_limited | Per-workspace rate limit exceeded | | connection_ambiguous | Multiple connections - specify connectionId | | content_has_linked_posts | Delete posts before deleting content | | content_still_building | Wait for content to finish building |

Using with Custom Axios Instance

import axios from "axios";
import { FastlaneClient } from "usefastlane-api";

const customAxios = axios.create({
  timeout: 30000,
});

const client = new FastlaneClient("fsln_live_your_key", customAxios);

TypeScript Types

All types are exported and can be imported directly:

import type {
  BlitzResponse,
  Preferences,
  ContentItem,
  Post,
  PostMetrics,
  Platform,
  ContentType,
} from "usefastlane-api";

Development

# Install dependencies
bun install

# Run tests
bun test

# TypeScript check
bun run tsc --noEmit