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

@creativekit/client

v1.0.13

Published

Browser-safe CreativeKit SDK (no secrets required)

Downloads

583

Readme

@creativekit/client

Browser-safe CreativeKit SDK using presigned URLs

✅ No credentials needed - talks to YOUR backend only


Quick Start

npm install @creativekit/client
import { CreativeKitClient } from "@creativekit/client";

const client = new CreativeKitClient({
  backendUrl: "/api/creatives", // YOUR backend, not CreativeKit API
});

// Upload a file
const result = await client.upload(file, "audio:podcast-aac", (progress) => {
  console.log(`${progress.percent.toFixed(1)}% - ${progress.message}`);
});

console.log("Creative:", result.id, result.status);

How It Works

1. Client → Your Backend: "Give me upload URL"
2. Your Backend → CreativeKit API: Create creative (using server SDK)
3. Client → Storage: Upload directly to presigned URL
4. Client → Your Backend: "Commit creative"

Your backend needs 5 endpoints:

  • POST /api/creatives - Create and return upload URL
  • POST /api/creatives/:id/commit - Commit upload
  • GET /api/creatives/:id - Get status
  • GET /api/creatives/:id/events - SSE stream for live updates (optional but recommended)
  • GET /api/creatives/profiles - List profiles

Key Methods

// Simple upload (automatic flow)
const result = await client.upload(file, profile, onProgress);

// Manual control (advanced)
const request = await client.requestUpload(profile, metadata);
await client.uploadFile(request.uploadUrl, file, request.uploadHeaders);
await client.commit(request.creativeId);

// Stream live status updates via SSE
const stream = client.streamEvents(creativeId, {
  onUpdate: (update) => {
    console.log(`Status: ${update.status}, Progress: ${update.progress}`);
  },
  onError: (error) => console.error("Stream error:", error),
  onClose: () => console.log("Stream closed"),
});
// Later: stream.close();

// Other methods
const creative = await client.getCreative(id);
const profiles = await client.listProfiles();
client.cancelUpload();

React Example

import { CreativeKitClient } from "@creativekit/client";
import { useState, useEffect } from "react";

const client = new CreativeKitClient({ backendUrl: "/api/creatives" });

function UploadForm() {
  const [progress, setProgress] = useState(0);
  const [creativeId, setCreativeId] = useState<string | null>(null);

  const handleUpload = async (file: File) => {
    const result = await client.upload(file, "audio:podcast-aac", (p) => {
      setProgress(p.percent);
    });
    setCreativeId(result.id);
    console.log("Done!", result);
  };

  // Stream live updates after upload
  useEffect(() => {
    if (!creativeId) return;

    const stream = client.streamEvents(creativeId, {
      onUpdate: (update) => {
        console.log(`Status: ${update.status}, Progress: ${update.progress}`);
        if (update.progress) {
          setProgress(85 + update.progress * 15); // 85-100%
        }
      },
      onError: (error) => console.error("Stream error:", error),
      onClose: () => console.log("Stream closed"),
    });

    return () => stream.close();
  }, [creativeId]);

  return (
    <div>
      <input type="file" onChange={(e) => handleUpload(e.target.files![0])} />
      <progress value={progress} max={100} />
    </div>
  );
}

📖 Full Documentation

See the main SDK documentation for:

  • Backend setup examples
  • Complete API reference
  • Full examples (Express, Next.js, NestJS)
  • AWS-style pattern explanation
  • Troubleshooting guide

Security

  • ✅ Never accesses CreativeKit API directly
  • ✅ No credentials in browser
  • ✅ Only talks to YOUR backend
  • ✅ You control access with your auth

License

MIT