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

@intelligo-dev/next

v1.2.0

Published

The Next.js adapter: the one Intelligo package that imports next/*, binding request context, auth routes and Route Handler guards.

Readme

@intelligo-dev/next

The Next.js adapter: the one Intelligo package that imports next/*, binding request context, auth routes and Route Handler guards.

Part of Intelligo, an application framework and operational platform for vertical AI SaaS products. Every @intelligo-dev/* package is released at one version and shares one database schema; pnpm dlx @intelligo-dev/cli create my-app installs the set an application needs. Documentation: intelligo.dev/docs/packages/next.

Install

pnpm add @intelligo-dev/next

next and better-auth are peers: the adapter binds into the copies your application already has.

Use

Tell the framework where a request's headers come from — once, from the composition root:

// lib/intelligo.ts
import {
  setBackgroundTaskRunner,
  setRequestContextSource,
} from "@intelligo-dev/core/request-context";
import { nextBackgroundTasks, nextRequestContext } from "@intelligo-dev/next";

setRequestContextSource(nextRequestContext);
setBackgroundTaskRunner(nextBackgroundTasks);

nextBackgroundTasks hands the work the framework starts without awaiting it — auth emails, a new workspace's bootstrap, notification emails — to Next's after(), so a serverless host keeps the function alive until it finishes.

Mount Better-Auth's HTTP handlers:

// app/api/auth/[...all]/route.ts
export { GET, POST } from "@intelligo-dev/next/auth";

Guard a Route Handler. The wrapper resolves the caller first and answers a failed check itself — 401 without a session, 403 without a workspace or the role, with { "error": <code> } as the body. What the handler throws propagates unchanged:

// app/api/invoices/route.ts
import { withRole } from "@intelligo-dev/next/route";

export const GET = withRole(
  ["owner", "admin"],
  async (request, { workspace }) =>
    Response.json(await listInvoices(workspace.id))
);

withAuth needs only a session, withWorkspace an active workspace. Next's own second argument — a dynamic segment's params — arrives third, typed by the wrapper's parameter (Next's generated RouteContext<"/api/invoices/[id]"> fits there too):

// app/api/invoices/[id]/route.ts
export const DELETE = withWorkspace<{ params: Promise<{ id: string }> }>(
  async (request, { workspace }, { params }) => {
    const { id } = await params;
    await deleteInvoice(workspace.id, id);
    return new Response(null, { status: 204 });
  }
);

ActionResult<T> is the shape a Server Action returns to its form — { success: true, data } or { success: false, error } — shared by every registry item's actions:

import type { ActionResult } from "@intelligo-dev/next";

The subpaths are separate so that binding the request context does not load the configured Better-Auth server instance.

Why a package

Every other @intelligo-dev/* package has to be usable from a queue worker, a Hono API, a test, or a product built on something that is not Next. Keeping every next/* import in one package — and having an architecture test refuse it anywhere else — is what makes that true.

Licence

Apache-2.0