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

@ikirugai/adapt-server

v0.1.5

Published

Server-side primitives for Adaptation — defineSurface, session helpers, route-handler factories, DSL, generic patch applier.

Downloads

588

Readme

@ikirugai/adapt-server

npm Live demo Source

Server-side primitives for Adaptation. defineSurface() to declare what's adaptable in your app, route-handler factories for the 13 Adapt API endpoints, a domain-generic patch applier, and a Postgres-backed session helper.

npm install @ikirugai/adapt-server @ikirugai/adapt-react

See it live at adapt.ikirugai.com — four demo apps wired up exactly the way described below.

Quickstart

1. Declare your surface

// src/adaptation.config.ts
import { defineSurface } from "@ikirugai/adapt-server";

export const surface = defineSurface({
  id: "my-app",
  description: "A SaaS dashboard.",
  flags: {
    dark_mode:  { description: "Force dark colour scheme." },
    dense_mode: { description: "Compact spacing throughout." }
  },
  targets: {
    header:  { description: "Top navigation bar." },
    sidebar: { description: "Left sidebar." }
  },
  sections: ["overview", "users", "billing"]
});

This declaration is fed to the soft-lane LLM prompt as the source of truth for what your renderer will honour.

2. Wire the route handlers

13 routes in total. Each one is two lines:

// src/app/api/adapt/cards/route.ts
import { createCardsHandlers } from "@ikirugai/adapt-server/handlers";
import { surface } from "@/adaptation.config";
export const { GET, POST } = createCardsHandlers({ surface });

Full route list:

| File | Factory | |-------------------------------------------------------|------------------------------------| | api/adapt/cards/route.ts | createCardsHandlers | | api/adapt/cards/[id]/route.ts | createCardByIdHandlers | | api/adapt/cards/[id]/bake/route.ts | createCardBakeHandler | | api/adapt/cards/[id]/redo/route.ts | createCardRedoHandler | | api/adapt/patches/route.ts | createPatchesHandlers | | api/adapt/library/route.ts | createLibraryHandler | | api/adapt/library/[id]/apply/route.ts | createLibraryApplyHandler | | api/adapt/bake-candidates/route.ts | createBakeCandidatesListHandler | | api/adapt/bake-candidates/[id]/bake/route.ts | createBakeCandidateBakeHandler | | api/adapt/bake-candidates/[id]/dismiss/route.ts | createBakeCandidateDismissHandler| | api/adapt/share/route.ts | createShareHandler | | api/adapt/stream/route.ts | createStreamHandler | | apply/[token]/route.ts | createApplyShareHandler |

npx @ikirugai/create-adapt-app scaffolds all 13 in one go.

3. Apply patches in your renderer

// src/app/page.tsx
import { getOrCreateSession, loadActivePatches, applyPatches } from "@ikirugai/adapt-server";
import { surface } from "@/adaptation.config";

export default async function Page() {
  const sid = await getOrCreateSession(surface.id);
  const patches = await loadActivePatches(sid);
  const ctx = applyPatches(patches);

  const isDark = ctx.flags.has("dark_mode");
  const isDense = ctx.flags.has("dense_mode");
  // …render based on ctx.flags / ctx.layoutVariants / ctx.itemFilters / etc.
}

Backend services required

This package is the client-side-of-server primitives. The worker, runner, and Slack-approver services that produce patches and execute hard-lane code edits are separate, BSL-1.1-licensed engine apps distributed via Docker images / signed contracts.

Until those ship: use the hosted backend at adapt.ikirugai.com, which already runs the engine for four live demo apps (News, Shop, Journal, Console). Pricing + signup land there when ready.

Peer dependencies

  • next >= 15
  • react >= 18

License

MIT © Ikirugai