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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@renderfast/client

v0.0.2

Published

TypeScript SDK for RenderFast API

Downloads

190

Readme

@renderfast/client

Official TypeScript SDK for the RenderFast API - generate dynamic OG images programmatically.

Installation

npm install @renderfast/client
# or
pnpm add @renderfast/client
# or
yarn add @renderfast/client

Quick Start

import { createClient, getApiTemplates, postApiGenerate } from '@renderfast/client';

// Create a client instance
const client = createClient({
  baseUrl: 'https://renderfa.st',
  headers: {
    Authorization: 'Bearer YOUR_API_KEY'
  }
});

// List your templates
const { data: templates } = await getApiTemplates({ client });
console.log(templates);

// Generate an image from a template
const { data: image, error } = await postApiGenerate({
  client,
  body: {
    templateId: 'your-template-id',
    layers: {
      title: { text: 'Hello World' },
      subtitle: { text: 'Generated with RenderFast' }
    }
  }
});

if (error) {
  console.error('Generation failed:', error);
} else {
  // image is a PNG buffer
  console.log('Image generated successfully');
}

API Reference

Templates

// List all templates
const { data } = await getApiTemplates({ client });

// Get a single template
const { data } = await getApiTemplatesById({ client, path: { id: 'template-id' } });

// Create a template
const { data } = await postApiTemplates({
  client,
  body: {
    name: 'My Template',
    jsonData: { /* template JSON */ }
  }
});

// Update a template
const { data } = await putApiTemplatesById({
  client,
  path: { id: 'template-id' },
  body: { name: 'Updated Name' }
});

// Delete a template
await deleteApiTemplatesById({ client, path: { id: 'template-id' } });

// Clone a template
const { data } = await postApiTemplatesByIdClone({
  client,
  path: { id: 'template-id' }
});

Image Generation

// Generate image (authenticated)
const { data } = await postApiGenerate({
  client,
  body: {
    templateId: 'template-id',
    layers: {
      title: { text: 'Dynamic Title' },
      image: { image_url: 'https://example.com/photo.jpg' }
    },
    scale: 1 // optional: 0.5 for half size, 2 for double
  }
});

// Public render endpoint (for OG images)
const { data } = await getApiRender({
  client,
  query: {
    template: 'template-id',
    title: 'Page Title',
    scale: 1
  }
});

Uploads

// List uploads
const { data } = await getApiUploads({ client });

// Upload a file
const { data } = await postApiUploads({
  client,
  body: {
    name: 'my-image.png',
    base64: 'data:image/png;base64,...',
    category: 'image'
  }
});

// Get upload URL
const { data } = await getApiUploadsByIdUrl({ client, path: { id: 'upload-id' } });

// Delete upload
await deleteApiUploadsById({ client, path: { id: 'upload-id' } });

Starter Templates

// List public starter templates
const { data } = await getApiTemplatesStarter({ client });

// Get starter template categories
const { data } = await getApiTemplatesStarterCategories({ client });

Features

  • Fully typed TypeScript client
  • Auto-generated from OpenAPI spec
  • Fetch-based HTTP client (works everywhere)
  • Works in Node.js, Bun, Deno, and browsers
  • Tree-shakeable exports

Error Handling

All functions return { data, error } objects:

const { data, error } = await getApiTemplates({ client });

if (error) {
  // error is typed based on possible error responses
  console.error('Request failed:', error);
  return;
}

// data is typed based on success response
console.log('Templates:', data);

TypeScript Support

All types are exported for use in your application:

import type {
  PostApiTemplatesData,
  PostApiGenerateData,
  GetApiTemplatesResponses
} from '@renderfast/client';

Documentation

For complete API reference, visit: https://renderfa.st/docs

License

MIT