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 🙏

© 2025 – Pkg Stats / Ryan Hefner

shopify-hydrogen-instafeed

v1.0.0

Published

A lightweight React component to embed Instagram feeds in Shopify Hydrogen storefronts.

Downloads

198

Readme

shopify-hydrogen-instafeed

A lightweight, performance-optimized React component to embed Instagram feeds into your Shopify Hydrogen storefronts.

This package handles the complex logic of lazy-loading external scripts, managing Shopify's customerPrivacy API, and ensuring Content Security Policy (CSP) compliance so you can focus on designing a beautiful storefront.

✨ Features

  • 🛍️ Hydrogen & Remix Ready: Built specifically for Shopify Hydrogen storefronts.
  • ⚡ Performance Optimized: Uses lazy loading to fetch scripts only when Shopify is initialized, preventing main-thread blocking.
  • 🔒 CSP Compliant: Built-in support for nonce to work seamlessly with Shopify Oxygen's strict security policies.
  • 🎨 Flexible Styling: Accepts custom classes and inline styles to match your brand.
  • 💻 Developer Friendly: Fully typed with TypeScript.

📦 Installation

  1. Install the package via npm or yarn:
npm install shopify-hydrogen-instafeed
# or
yarn add shopify-hydrogen-instafeed
  1. Configure content security policies. In file entry.server.tsx add following CSP. These needs to be added as shopify-forms is dependent on these external libraries
{
  defaultSrc: [
    'self',
    'https://js.hcaptcha.com',
    'https://fonts.shopifycdn.com',
    'https://newassets.hcaptcha.com'
  ],
  connectSrc: [
    'self',
    'https://instafeed.nfcube.com/feed/v6?limit=12&account=emerald-art-studio.myshopify.com&fu=0&fid=0&hash=d2a14583a519115cb6dbbf20de180105&locale=en&handle=',
    'https://scontent.cdninstagram.com',
    'https://video.cdninstagram.com',
  ],
  imgSrc: [
    self,
    'https://instafeed.nfcube.com/',
    'https://scontent.cdninstagram.com',
  ],
  mediaSrc: [
    "'self'",
    'data:',
    'https://cdn.shopify.com',
    'https://cdn.nfcube.com',
    'https://instafeed.nfcube.com',
    'https://scontent.cdninstagram.com',
    'https://video.cdninstagram.com',
    ],
}
  1. Usage

To use the feed, import the Instafeed component. You must provide the script source (from your Instagram Feed app settings) and a nonce (for security).

import { Instafeed } from 'shopify-hydrogen-instafeed';
import { useNonce } from '@shopify/hydrogen';

export default function InstagramSection() {
  const nonce = useNonce();

  //This is just for example

  const INSTAFEED_SCRIPT_URL = "https://cdn.nfcube.com/instafeed-[example.js]?shop=[example-shop.myshopify.com]";

  return (
    <section className="py-10">
      <h2 className="text-2xl font-bold mb-4">Follow us on Instagram</h2>
      <Instafeed 
        scriptSrc={INSTAFEED_SCRIPT_URL} 
        nonce={nonce} 
        className="my-custom-instafeed-wrapper"
      />
    </section>
  );
}

📝 Notes

  • You must pass Shopify’s nonce, otherwise Oxygen will block the script via CSP.

  • The scriptSrc must come directly from the Instagram Feed app you use (e.g., Nfcube, Instafeed Pro, etc.).

  • This works with both Hydrogen 2024+ and Remix-powered Hydrogen.

❤️ Contributing

  • Feel free to open issues or PRs to improve the package.