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

@contentstack/live-preview-utils

v4.4.0

Published

Contentstack provides the Live Preview SDK to establish a communication channel between the various Contentstack SDKs and your website, transmitting live changes to the preview pane.

Downloads

120,164

Readme

@contentstack/live-preview-utils

npm License: MIT

The Live Preview Utils package runs on your website and establishes a communication channel between the page and Contentstack. This enables live content updates, edit controls, and Visual Editor UI within the preview surface.

This SDK is not a replacement for Contentstack delivery SDKs. Instead, it acts as a client-side bridge for preview and Visual Editor functionality.

Where this SDK runs

The SDK works across multiple Contentstack preview and editing experiences:

  • Live Preview: Preview entries while your site loads inside the preview panel.
  • Timeline: Preview how your site appears across future dates and scheduled updates using the same Live Preview setup.
  • Visual Editor: Enable WYSIWYG editing with your site inside an iframe. Use mode: "builder" so “Start Editing” targets Visual Editor; the SDK still works when the same site is opened in Live Preview.
  • Studio: Use alongside Studio to structure pages from reusable components, bind CMS data, and preview changes in real time. It is designed to work with Live Preview and Visual Editor on your connected site.

Requirements

  • Browser: Initialize only on the client (window must exist). Avoid calling init during server-side rendering.
  • SSR vs CSR: Defaults assume SSR-friendly behavior. For client-side rendering, pass stackSdk and set ssr: false as described in the config reference.

Installation

npm install @contentstack/live-preview-utils

Load from a CDN (advanced)

Pin the version to match your app (update 4.3.0 when you upgrade):

<script type="module" crossorigin="anonymous">
  import ContentstackLivePreview from "https://esm.sh/@contentstack/[email protected]";

  ContentstackLivePreview.init({
    stackDetails: {
      apiKey: "your-stack-api-key",
    },
  });
</script>

[!TIP] If you initialize the SDK using this snippet, do not initialize it again in your app bundle on the same page.

Quick start

Initialize the SDK to enable communication between your site and Contentstack:

import ContentstackLivePreview from "@contentstack/live-preview-utils";

ContentstackLivePreview.init({
  stackDetails: {
    apiKey: "your-stack-api-key",
  },
});

See the init configuration properties in docs/live-preview-configs.md for every option you can pass to init.

Configuration

You can configure the SDK using the following options:

Full tables and examples: docs/live-preview-configs.md.

Methods and properties

  • onLiveEdit: Trigger actions on live edits
  • onEntryChange: Listen for entry updates
  • hash: Access preview state identifier
  • config: Includes runtime context (for example Live Preview / Timeline preview, Visual Editor, or independent)

The configs table of contents also lists setConfigFromParams and getGatsbyDataFormat for deeper workflows.

Advanced: stripping the SDK at build time

Set PURGE_PREVIEW_SDK or REACT_APP_PURGE_PREVIEW_SDK to "true" during build to exclude preview code from production bundles.

Note: This reduces bundle size by replacing the SDK with a lightweight stub in production.

Resources

Documentation and learning

Developers

Content managers

Studio

Academy