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

@rawdash/nextjs

v0.15.0

Published

Rawdash client SDK for Next.js App Router (Server Components and Server Actions)

Downloads

2,417

Readme

@rawdash/nextjs

npm version license

Rawdash SDK for the Next.js App Router.

What it is

@rawdash/nextjs extends @rawdash/client with Next.js-specific behavior: the http function tags widget requests with Next.js cache tags so they can be invalidated via revalidateTag, and createRawdashClient wraps a data source so triggerSync automatically revalidates widget data in Server Components after the sync completes.

Use this package when your rawdash server runs separately from your Next.js app. For an in-process setup (engine in the same Next.js process), use @rawdash/client's inProcess directly.

Install

npm install @rawdash/nextjs

Requires Next.js 14+.

Quick example

// lib/rawdash.ts
import { createRawdashClient, http } from '@rawdash/nextjs';

export const rawdash = createRawdashClient(
  http({
    baseUrl: process.env.RAWDASH_URL!,
    apiKey: process.env.RAWDASH_API_KEY,
  }),
);
// app/dashboard/page.tsx
import { rawdash } from '@/lib/rawdash';

export default async function DashboardPage() {
  const widgets = await rawdash.getWidgets('engineering');

  return (
    <div>
      {widgets.map((w) => (
        <div key={w.id}>{/* render widget */}</div>
      ))}
    </div>
  );
}

In app/actions.ts:

'use server';

import { rawdash } from '@/lib/rawdash';

export async function syncDashboard() {
  // Triggers sync, polls /sync/state until it settles (succeeded or failed),
  // then calls revalidateTag('rawdash') so the Server Components re-fetch
  // widget data on next request. Throws on sync failure.
  await rawdash.triggerSync();
}

Don't block SSR on a sync. triggerSync (and ensureFresh) wait for the sync to settle, which can take up to ~30s. Calling either from a Server Component would block every page render. Use them in Server Actions, cron-triggered routes, or webhooks — and let pages render against whatever's cached.

Switching between in-process and HTTP

// lib/rawdash.ts
import { inProcess } from '@rawdash/client';
import { createRawdashClient } from '@rawdash/nextjs';
import { http } from '@rawdash/nextjs';

const source =
  process.env.NODE_ENV === 'production'
    ? http({ baseUrl: process.env.RAWDASH_URL! })
    : inProcess(localEngine);

export const rawdash = createRawdashClient(source);

API

http(options): DataSource

Next.js-aware variant of http from @rawdash/client. Adds the 'rawdash' cache tag to all widget fetch requests so they can be invalidated with revalidateTag('rawdash'). Accepts the same options as @rawdash/client's http.

createRawdashClient(dataSource): DataSource

Wraps any DataSource with Next.js behavior: triggerSync polls /sync/state until the sync settles (transitions to succeeded or failed), then calls revalidateTag('rawdash') to bust Server Component caches. Throws on failed or if the sync doesn't settle within 30s. ensureFresh is also tagged to revalidate after a sync. All other methods are passed through unchanged.

Links

License

Apache-2.0