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

@degallery/next

v0.6.1-0

Published

Next.js integration for DeGallery. It provides a `next/image` renderer for the React gallery views and server helpers for loading gallery data during server rendering.

Readme

@degallery/next

Next.js integration for DeGallery. It provides a next/image renderer for the React gallery views and server helpers for loading gallery data during server rendering.

Install

pnpm add @degallery/next @degallery/react @degallery/sdk @tanstack/react-query

Use compatible versions of Next.js 15 or 16 and React 19.

Add the provider

Place GalleryProvider in a Client Component and use it from the root layout. The provider uses next/image for gallery images; private and expiring image URLs bypass the Next.js image optimizer so authenticated delivery continues to work.

// app/gallery-provider.tsx
'use client';

import { GalleryProvider } from '@degallery/next';

export function AppGalleryProvider({ children }: { children: React.ReactNode }) {
  return (
    <GalleryProvider
      apiUrl={process.env.NEXT_PUBLIC_DEGALLERY_API_URL!}
      mediaUrl={process.env.NEXT_PUBLIC_DEGALLERY_MEDIA_URL}
      publishableKey={process.env.NEXT_PUBLIC_DEGALLERY_PUBLISHABLE_KEY}
    >
      {children}
    </GalleryProvider>
  );
}

Add the provider to app/layout.tsx:

import { AppGalleryProvider } from './gallery-provider';

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <body><AppGalleryProvider>{children}</AppGalleryProvider></body>
    </html>
  );
}

Server-render a gallery

Use the server-only subpath from a Server Component. The initial gallery page is fetched on the server and rendered into the HTML, then the client view can continue loading pages and provide its interactive lightbox.

import { ServerGallery } from '@degallery/next/server';

export default async function GalleryPage({
  params,
}: {
  params: Promise<{ slug: string }>;
}) {
  const { slug } = await params;
  return (
    <ServerGallery
      apiUrl={process.env.NEXT_PUBLIC_DEGALLERY_API_URL!}
      mediaUrl={process.env.NEXT_PUBLIC_DEGALLERY_MEDIA_URL}
      galleryIdOrSlug={slug}
      limit={24}
    />
  );
}

For private galleries, pass a short-lived read token from a Server Component or server action. Never expose a private API key to a Client Component. getGallery is also exported for applications that need to render their own markup:

import { getGallery } from '@degallery/next/server';

const gallery = await getGallery({ apiUrl, galleryIdOrSlug: 'my-gallery' });

The default server fetch uses cache: 'no-store' because delivery URLs can be private or expire. A custom fetch implementation may provide application caching when that is appropriate.

Next.js image configuration

If your app uses Next.js image optimization for externally hosted public images, allow the hosts used by your galleries in next.config:

import type { NextConfig } from 'next';

const nextConfig: NextConfig = {
  images: {
    remotePatterns: [
      { protocol: 'https', hostname: 'images.unsplash.com' },
      { protocol: 'https', hostname: 'media.degallery.dev' },
      { protocol: 'https', hostname: 'res.cloudinary.com' },
    ],
  },
};

export default nextConfig;

Use the actual media and Cloudinary hostnames configured for your deployment. The gallery renderer supplies responsive sizing and image dimensions when available. Set the surrounding layout dimensions with CSS as usual.