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

@feedbakkr/sdk

v0.1.0

Published

Lightweight SDK for submitting messages to Feedbakkr

Downloads

108

Readme

@feedbakkr/sdk

Lightweight SDK for submitting messages to Feedbakkr. Works in browsers, Node.js, and edge runtimes (Cloudflare Workers, Vercel Edge, etc.).

Installation

npm install @feedbakkr/sdk

Quick start

import { createFeedbakkrClient } from "@feedbakkr/sdk";

const feedbakkr = createFeedbakkrClient({
  apiKey: "fbk_sk_live_your-secret-key",
});

const result = await feedbakkr.submit({
  channelId: "your-channel-id",
  fields: {
    name: "Jane Doe",
    email: "[email protected]",
    message: "Love the new feature!",
  },
});

console.log(result.id); // Message ID

Usage

Server-side (recommended)

Use a secret key (fbk_sk_*) from your server. Secret keys must not be exposed to the browser.

import { createFeedbakkrClient } from "@feedbakkr/sdk";

const feedbakkr = createFeedbakkrClient({
  apiKey: process.env.FEEDBAKKR_SECRET_KEY!,
});

// In your API handler:
const result = await feedbakkr.submit({
  channelId: "01ABC...",
  fields: { name: req.body.name, email: req.body.email },
});

Browser / client-side

Use a client key (fbk_ci_*) from the browser. The request Origin header is validated against your channel's allowed origins.

import { createFeedbakkrClient } from "@feedbakkr/sdk";

const feedbakkr = createFeedbakkrClient({
  apiKey: "fbk_ci_live_your-client-key",
});

const result = await feedbakkr.submit({
  channelId: "01ABC...",
  fields: { name: "Jane", message: "Hello!" },
});

Direct function imports

If you prefer not to use the client wrapper:

import { submitServerMessage, submitClientMessage } from "@feedbakkr/sdk";

const result = await submitServerMessage(
  { apiKey: "fbk_sk_live_..." },
  { channelId: "01ABC...", fields: { name: "Jane" } },
);

Error handling

All errors are thrown as FeedbakkrError with a kind property:

import { FeedbakkrError } from "@feedbakkr/sdk";

try {
  await feedbakkr.submit({ channelId: "...", fields: {} });
} catch (err) {
  if (err instanceof FeedbakkrError) {
    switch (err.kind) {
      case "api":
        // API returned an error (err.status, err.code, err.details)
        console.error(`API error ${err.status}: ${err.code} - ${err.message}`);
        break;
      case "network":
        // Fetch/network failure
        console.error("Network error:", err.message);
        break;
      case "config":
        // Invalid configuration (missing apiKey, channelId, etc.)
        console.error("Config error:", err.message);
        break;
    }
  }
}

API reference

createFeedbakkrClient(config)

Creates a configured client. The key prefix determines the submission flow:

  • fbk_ci_* keys use the client/browser flow
  • fbk_sk_* keys use the server flow

| Option | Type | Default | Description | |-----------|----------------|-----------------------------|-----------------------------| | apiKey | string | required | Your Feedbakkr API key | | baseUrl | string | https://api.feedbakkr.com | API base URL | | fetch | typeof fetch | globalThis.fetch | Custom fetch implementation |

client.submit(input)

Submit a message to a channel.

| Field | Type | Description | |-------------|---------------------------|------------------------------------------| | channelId | string | Target channel ID | | fields | Record<string, unknown> | Field values matching the channel schema |

Returns SubmitMessageResult:

| Field | Type | Description | |------------------|----------------------------|------------------------------------------| | id | string | Message ID (ULID) | | environment | "dev" \| "live" | Environment the message was submitted to | | channelId | string | Channel ID | | lifecycleState | "active" \| "quota_held" | Message lifecycle state | | createdAt | string | ISO 8601 timestamp |

Type generation

Use @feedbakkr/cli to generate TypeScript types from your channel schemas, then pass typed fields to the SDK:

import type { ContactFormFields } from "./generated/contact-form";

await feedbakkr.submit({
  channelId: "01ABC...",
  fields: { name: "Jane", email: "[email protected]" } satisfies ContactFormFields,
});

Runtime compatibility

  • Browser: Full support. Uses fetch API.
  • Node.js: v18+ (native fetch). For older versions, pass a fetch polyfill.
  • Edge runtimes: Full support (Cloudflare Workers, Vercel Edge, Deno, Bun).

License

MIT