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

domainconnect

v1.0.0

Published

Domain Connect JavaScript Utilities

Readme

Domain Connect Library

Currently only contains the tyepscript source code, and only tested in bun.

Installation

bun i domainconnect

Quick Start

For example, you want to set a DNS record link.netcup.gifts to U301 URL Shortener.

import {
    discoverDomainConnectSettings,
    buildSyncTemplateUrl,
    buildSyncTemplateUrlQueryString
} from "domainconnect"

const userInputDomain = 'netcup.gifts'
const userInputSubdomain = 'link'
const cnameVerificationPrefix = '<cname_verification_prefix_string>'

const settings = await discoverDomainConnectSettings(userInputDomain)

if (!settings || !settings.urlSyncUX) {
    throw new Error('Domain is not managed by cloudflare')
}
const templateUrl = buildSyncTemplateUrl({
    urlSyncUX: settings.urlSyncUX,
    providerId: 'u301.com',
    serviceId: 'bender'
})
// read private key from database or file
// const privateKey = await Bun.file('./cert/private_key.pem').text()
const queryString = buildSyncTemplateUrlQueryString({
    privateKey,
    domain: userInputDomain,
    host: userInputSubdomain,
    cname: cnameVerificationPrefix
})
console.log(templateUrl + queryString)

The final URL be like: https://dash.cloudflare.com/domainconnect/v2/domainTemplates/providers/u301.com/services/bender/apply?key=_dcpubkeyv1&state=750148&domain=netcup.gifts&host=link&cname=%3Ccname_verification_prefix_string%3E&sig=gLFPKleHGci67bj9%2BqPO9Oo5sS2jokt9npescL%2Fc%2BISNdfm0jHFaxLjxfLf17QJ%2BxqGkRRpPpRwp7fJRi9xrZ%2BY7Xxhdmb4OS%2FrYuUFOpzpA0XMpfFB45RWEX3Pg2HAkekRqKqUsgxloASFL%2BuX4hJqGvyB9LZnMGRaO3m2ZxALQfrZrn4kEAZiaZFUSdEWvem6OiGrGpeDttlAnPztHgQ42Vfg175shgH49Bt%2F%2B66XAsvaPbiBLFeDJEgHDlbi7pKzuDHQQsTjxAxC91%2FAq9u9H%2Fx2ABaD1mfa4vBgq2l00P2n32UT276kf1zu3gtpqYSMTSkCmvoCYH0R6ay%2F3aQ%3D%3D

Redirect to the URL and let user authorize it.

https://img.netcup.gifts/blog/202503/xNZr3F.jpg

Utilities

discoverDomainConnectSettings(domain: string) Looks up the domain connect settings for the specified domain, for example:

const settings = await discoverDomainConnectSettings('netcup.gifts')
/**
 Settings be like
{
  providerId: "cloudflare.com",
  providerName: "cloudflare",
  providerDisplayName: "Cloudflare",
  urlSyncUX: "https://dash.cloudflare.com/domainconnect",
  urlAPI: "https://api.cloudflare.com/client/v4/dns/domainconnect",
}
 */

Returns null if the domain is not hosted on Cloudflare. Currently only supports Cloudflare.

buildSyncTemplateUrl

if (!settings.urlSyncUX) {
    throw new Error('Domain is not managed by cloudflare')
}
const templateUrl = buildSyncTemplateUrl({
    urlSyncUX: settings.urlSyncUX,
    providerId: 'u301.com',
    serviceId: 'bender'
})
// templateUrl be like: https://dash.cloudflare.com/domainconnect/v2/domainTemplates/providers/u301.com/services/bender/apply?

buildSyncTemplateUrlQueryString

Append the query string to the template URL.

const queryString = buildSyncTemplateUrlQueryString({
    privateKey,
    domain: 'netcup.gifts',
    host: 'www'
})

createKeyPair

Generate a RSA private key and public key.

const { privateKey, publicKey } = await createKeyPair()
console.log(privateKey)
console.log(publicKey)

it equals to the command lines below

openssl genpkey -algorithm RSA -out private_key.pem -pkeyopt rsa_keygen_bits:2048
openssl rsa -pubout -in private_key.pem -out public_key.pem 

splitToDnsTextRecords

Split the public key into multiple DNS text records. _dcpubkeyv1.example.com You can set txt records for each item.

// publicKey is a string contains the public key -----BEGIN PUBLIC KEY----- ... -----END PUBLIC KEY-----
const records = splitToDnsTextRecords(publicKey)
console.log(records)

License

MIT