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

@withwiz/cms-kit

v0.3.0

Published

Reusable CMS framework for Next.js + React admin panels — AdminShell, AdminManagerBase, middleware wrappers, image pipeline, and shared admin utilities.

Readme

English | 한국어

@withwiz/cms-kit

Performance Management System — a CMS framework package for building web admin panels with Next.js and React.

@withwiz/cms-kit consolidates the common admin layer (infrastructure, base services, shared UI components, hooks, utilities, and validators) used across Withwiz projects. Domain-specific code (news, performances, artists, etc.) stays in your application's src/, while this package provides the reusable scaffolding underneath.

Features

  • AdminManagerBase — three-pane (list / editor / preview) scaffold for admin pages
  • AdminShell — complete admin shell with authentication, sidebar, and layout
  • Middleware wrapperswithPublicApi / withAuthApi / withAdminApi, a Next.js–typed compatibility layer over @withwiz/toolkit
  • Base services — Prisma dependency injection, pagination, HTML sanitizer, R2 key collection/deletion
  • Image pipeline — automatic lg / md / sm / thumb WebP variant generation on R2 upload
  • Shared hooksuseAdminList, useAdminForm, useImageDropZone, useScrollReveal
  • Security hardening — DOMPurify-based sanitization, JSON-LD escaping, fail-fast JWT secret policy, safe rate-limit identity extraction
  • Config boundary — explicit setCmsConfig injection for brand, routes, JWT, sanitizer, storage, and rate-limit identity

Tech Stack

  • TypeScript (strict) — target: ES2022, module: ESNext
  • React 19 / Next.js 16 (peer dependencies, >=18 / >=15 supported)
  • Tiptap 3 (rich text editing)
  • Zod 4 (validation)
  • tsup (build) + Vitest (test)
  • Optional peers: @aws-sdk/client-s3, sharp, isomorphic-dompurify, sonner, @tanstack/react-virtual

Installation

npm install @withwiz/cms-kit
# or
pnpm add @withwiz/cms-kit
# or
yarn add @withwiz/cms-kit

@withwiz/toolkit is a peer dependency (>=0.8.0; the type declarations in 0.7.1 import packages that do not exist, so the JWT and middleware types cms-kit uses are not type-checked). Depending on your package manager and resolution strategy, you may need to install it explicitly:

npm install @withwiz/toolkit

For monorepo development the file: protocol is also supported:

{
  "dependencies": {
    "@withwiz/cms-kit": "file:packages/cms-kit"
  }
}

Entry Points

| Path | Description | |---|---| | @withwiz/cms-kit | Full barrel export | | @withwiz/cms-kit/components | AdminShell, AdminManagerBase, ImageDropUpload, ToggleSwitch, … | | @withwiz/cms-kit/hooks | useAdminList, useAdminForm, useImageDropZone, useScrollReveal | | @withwiz/cms-kit/infrastructure | Prisma proxy, middleware wrappers | | @withwiz/cms-kit/infrastructure/middleware | withPublicApi / withAuthApi / withAdminApi | | @withwiz/cms-kit/services | base-service, pagination | | @withwiz/cms-kit/types | PaginatedResult, SortOrder | | @withwiz/cms-kit/utils | adminFetch, r2-storage, image-variants, jwt, date, html-sanitizer | | @withwiz/cms-kit/validators | slugSchema, optionalUrlSchema |

Usage

1. Inject the Prisma client

The package does not know your Prisma schema; inject the client during application bootstrap.

// src/lib/prisma.ts
import { PrismaClient } from '@prisma/client';
import { setPrismaClient } from '@withwiz/cms-kit/infrastructure';

const prisma = new PrismaClient();
setPrismaClient(prisma);
export { prisma };

Calling the proxy before injection throws Error('Prisma client not initialized').

2. Configure the package boundary

Consumer-specific values (brand, routes, JWT secret, trusted sanitizer origins, storage public URL, rate-limit identity) are injected — never hard-coded.

import { setCmsConfig, createForwardedIdentityExtractor } from '@withwiz/cms-kit/utils';

setCmsConfig({
  brand: { brandLabel: 'ACME', navItems: [{ label: 'Home', href: '/x', glyph: 'H' }] },
  routes: { loginPath: '/signin', uploadEndpoint: '/files/upload' },
  jwt: { secret: process.env.MY_JWT_SECRET },
  sanitizer: { trustedIframeOrigins: ['https://www.loom.com/'] },
  storage: { publicBaseUrl: 'https://cdn.example.com' },
  // Required to enable rate limiting: without an identity extractor every
  // anonymous request would share one bucket (self-DoS), so it stays disabled.
  rateLimit: { identityExtractor: createForwardedIdentityExtractor({ trustedHops: 1 }) },
});

Resolution order (uniform across all surfaces):

  1. Explicit injection
  2. Legacy environment variables (current names preserved)
  3. Built-in defaults

Failures are lazy and surface at point of use, not on import. Missing JWT secret is a fail-fast error (no safe default for signing keys).

3. Build a manager page

Use AdminManagerBase plus the shared hooks to assemble a three-pane admin page with list, editor, and preview.

Scripts

npm run build       # tsup build → dist/
npm test            # vitest run
npm run test:watch  # vitest in watch mode

Dependency Rules

  • src/ (your app) → @withwiz/cms-kit/*
  • @withwiz/cms-kit@withwiz/toolkit/*
  • @withwiz/cms-kitsrc/ ✗ (keep the package independent)

See docs/architecture.md for the full layering diagram.

Documentation

License

MIT