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

@jhsdc/create-dynamic-link

v1.0.0

Published

Scaffolds the Builder.io DynamicLink component and its /dynamiclink redirect route into a Next.js App Router project

Downloads

101

Readme

@jhsdc/create-dynamic-link

Scaffolds the DynamicLink component and its /dynamiclink redirect route straight into your Next.js App Router project — shadcn-style. There's no runtime npm dependency to keep updated; the CLI copies editable source files into your own repo so you can adapt them to your project.

Pairs with @jhsdc/builder-input-types — the DynamicLink component renders the value produced by that plugin's CMSLink field editor.

Usage

From the root of your Next.js project:

npx @jhsdc/create-dynamic-link

This writes:

  • components/DynamicLink/ (or src/components/DynamicLink/ if a src/ directory exists) — the DynamicLink component, its Builder.io Gen2 registration, and a small self-contained theme system it depends on.
  • app/dynamiclink/[model]/[type]/[id]/route.ts (or under src/app/ — same detection rule) — the redirect handler.

Existing files are left alone on repeat runs. Pass --force to overwrite, or --app-dir=<path> / --components-dir=<path> to override the detected locations.

npx @jhsdc/create-dynamic-link --force
npx @jhsdc/create-dynamic-link --app-dir=apps/web/app --components-dir=apps/web/components/DynamicLink

What gets copied

components/DynamicLink

| File | Purpose | | --- | --- | | index.tsx | The DynamicLink component. Renders a Next.js <Link>, resolving a CMSLinkProps value (from the CMSLink input) to either a raw URL or, for a model reference, /dynamiclink/{model}/builder/{referenceId}. | | DynamicLink.builder.registration.tsx | A RegisteredComponent[] you can pass to your Builder.io Gen2 SDK registration list (@builder.io/sdk-react). | | theme.ts, ThemeContext.tsx, useTheme.ts, ThemeProvider.tsx | A minimal theme system (light/dark/etc.) used only when inheritTheme={false} is passed explicitly. Delete these and simplify index.tsx if you don't need themed variants — DynamicLink otherwise renders a plain <Link> with no theme wrapper. | | types.ts | CMSLinkProps (the shape produced by the CMSLink input) and Stylable. |

app/dynamiclink/[model]/[type]/[id]/route.ts

A GET route handler that resolves a Builder.io content reference to its live URL and issues a 307 redirect. DynamicLink links to this route whenever an editor picks "link to content" instead of typing a raw URL, so the link keeps working even if the target's slug changes later — the route looks up the current value at request time.

Why this exists as a copied file, not an import: Next.js App Router discovers routes by file path under your project's app/ directory — that file-based convention can't be satisfied by an npm package alone, and where a URL should redirect to for a given model (slug, handle, a raw url field, or something else) is inherently specific to your content models. You're expected to open the generated file and edit MODEL_CONFIG.

const MODEL_CONFIG: Record<string, ModelConfig> = {
  article: { field: "slug", toPath: (slug) => `/blogs/${slug}` },
  event: { field: "handle", toPath: (handle) => `/events/${handle}` },
  // add an entry for every model DynamicLink should be able to deep-link to
};

Models not listed fall back to reading a url field directly off the entry.

Required environment variable: NEXT_PUBLIC_BUILDER_API_KEY — the same public API key your Builder.io SDK client already uses. The route queries https://cdn.builder.io/api/v3/graphql/{apiKey} directly, so no additional server-side secret is needed.

Peer requirements

The copied component/route source expects these to already be installed in your project (not bundled, not auto-installed):

  • react, react-dom
  • next (App Router)
  • @builder.io/sdk-react (for the RegisteredComponent type used by the registration file — only needed if you use the Gen2 registration export)