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

@synkro/next

v0.2.3

Published

Next.js integration for @synkro/core

Readme

@synkro/next

Next.js integration for @synkro/core.

Installation

npm install @synkro/next @synkro/core @synkro/ui

Quick Start

1. Create the synkro instance

// lib/synkro.ts
import { createSynkro, createDashboardHandler } from "@synkro/next";

export const synkro = createSynkro({
  transport: "redis",
  connectionUrl: process.env.REDIS_URL || "redis://localhost:6379",
  events: [
    {
      type: "order.created",
      handler: async ({ requestId, payload }) => {
        console.log(`Order created: ${requestId}`, payload);
      },
    },
  ],
  workflows: [
    {
      name: "ProcessOrder",
      steps: [
        { type: "ValidateOrder", handler: validateOrderHandler },
        {
          type: "ProcessPayment",
          handler: processPaymentHandler,
          retry: { maxRetries: 3 },
        },
        { type: "ConfirmOrder", handler: confirmOrderHandler },
      ],
    },
  ],
});

export const dashboardHandler = createDashboardHandler(synkro, {
  basePath: "/synkro",
});

The instance is lazily initialized on the first call and cached as a singleton across requests. In development, the singleton is stored on globalThis to survive Next.js HMR.

2. Publish events from route handlers

// app/api/orders/route.ts
import { synkro } from "@/lib/synkro";

export async function POST(request: Request) {
  const body = await request.json();
  const requestId = await synkro.publish("ProcessOrder", body);
  return Response.json({ requestId }, { status: 201 });
}

3. Mount the dashboard

// app/synkro/[[...path]]/route.ts
import { dashboardHandler } from "@/lib/synkro";

export { dashboardHandler as GET };

The dashboard is now available at /synkro.

4. Define handlers in separate files

// handlers/validate-order.handler.ts
import type { HandlerCtx } from "@synkro/core";

export const validateOrderHandler = async ({
  requestId,
  payload,
}: HandlerCtx) => {
  console.log(`Validating order ${requestId}...`, payload);
};

API

createSynkro(options)

Creates a lazy-initializing synkro client. Accepts the same options as Synkro.start() from @synkro/core.

Returns a SynkroClient with the following methods:

| Method | Description | | -------------------------------------- | -------------------------------------------------- | | publish(event, payload?, requestId?) | Publish an event or start a workflow | | on(eventType, handler, retry?) | Register an event handler at runtime | | introspect() | Get metadata about registered events and workflows | | getEventMetrics(eventType) | Get received/completed/failed counts for an event | | getInstance() | Get the underlying Synkro instance | | stop() | Disconnect and clean up |

createDashboardHandler(synkro, options?)

Creates a Next.js route handler for the @synkro/ui dashboard.

| Option | Type | Default | Description | | ---------- | -------- | ------- | ---------------------------------------------- | | basePath | string | "/" | URL path prefix where the dashboard is mounted |

Next.js Configuration

Add ioredis to serverExternalPackages in your Next.js config when using the Redis transport:

// next.config.ts
const nextConfig = {
  serverExternalPackages: ["ioredis"],
};

export default nextConfig;

License

MIT