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

@jitforms/js

v0.1.0

Published

Core JavaScript/TypeScript SDK for JitForms — form submission with honeypot, captcha, typed errors. Zero dependencies.

Readme

@jitforms/js

Lightweight JavaScript/TypeScript SDK for JitForms. ~2KB gzipped, zero dependencies.

Installation

npm install @jitforms/js

Quick Start

import { createJitForm } from '@jitforms/js';

const form = createJitForm({ formHash: 'abc123' });

const result = await form.submit({
  name: 'John Doe',
  email: '[email protected]',
  message: 'Hello!',
});

if (result.ok) {
  console.log('Submitted!', result.submission);
  if (result.redirectUrl) {
    window.location.href = result.redirectUrl;
  }
} else {
  console.error(result.errors);
}

API

createJitForm(config)

Creates a form instance with the given configuration. Returns an object with a submit(data) method.

submitForm(config, data)

Standalone function for one-off submissions.

Configuration

| Option | Type | Default | Description | |---|---|---|---| | formHash | string | required | Form hash identifier | | baseUrl | string | 'https://jitforms.com' | Base URL of JitForms instance | | honeypot | boolean \| string | false | Enable honeypot spam protection. Pass true for default field name (_honeypot) or a custom field name. | | captchaToken | string | - | Captcha token to include with submission | | headers | Record<string, string> | - | Custom headers to include | | timeout | number | 10000 | Request timeout in milliseconds |

Result Type

The submit method returns a Promise<JitFormResult> which is a discriminated union:

// Success (HTTP 201)
{ ok: true; submission: JitFormSubmission; redirectUrl?: string }

// Error (HTTP 422 or other)
{ ok: false; status: number; message: string; errors: Record<string, string[]> }

Examples

With Honeypot Protection

const form = createJitForm({
  formHash: 'abc123',
  honeypot: true, // adds hidden '_honeypot' field
});

With Custom Honeypot Field

const form = createJitForm({
  formHash: 'abc123',
  honeypot: 'website_url', // custom field name
});

With Captcha

const token = await getCaptchaToken(); // from your captcha provider

const form = createJitForm({
  formHash: 'abc123',
  captchaToken: token,
});

File Uploads

When any value is a File or FileList, the SDK automatically switches from JSON to multipart/form-data.

const fileInput = document.querySelector<HTMLInputElement>('#file');

const result = await form.submit({
  name: 'Jane',
  attachment: fileInput.files[0],
});

Self-Hosted Instance

const form = createJitForm({
  formHash: 'abc123',
  baseUrl: 'https://forms.yoursite.com',
});

Error Handling

const result = await form.submit({ email: 'invalid' });

if (!result.ok) {
  // result.errors is Record<string, string[]>
  // e.g. { email: ['The email field must be a valid email address.'] }
  for (const [field, messages] of Object.entries(result.errors)) {
    console.log(`${field}: ${messages.join(', ')}`);
  }
}

Timeout Handling

import { createJitForm, JitFormError } from '@jitforms/js';

const form = createJitForm({
  formHash: 'abc123',
  timeout: 5000,
});

try {
  const result = await form.submit({ name: 'John' });
} catch (error) {
  if (error instanceof JitFormError) {
    console.error('Request timed out');
  }
}

CORS Note

The JitForms server does not configure CORS headers. This SDK is designed to be used from the same origin as your JitForms instance, or from server-side environments (Node.js, edge functions) where CORS does not apply.

License

MIT