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

@mandujs/core

v0.9.25

Published

Mandu Framework Core - Spec, Generator, Guard, Runtime

Readme

Installation

bun add @mandujs/core

Typically used through @mandujs/cli. Direct usage is for advanced use cases.

Module Structure

@mandujs/core
├── spec/      # Spec schema and loading
├── generator/ # Code generation
├── guard/     # Architecture checking and auto-correction
├── runtime/   # Server and router
└── report/    # Guard report generation

Spec Module

Route manifest schema definition and loading.

import { loadManifest, RoutesManifest, RouteSpec } from "@mandujs/core";

// Load and validate manifest
const result = await loadManifest("spec/routes.manifest.json");

if (result.success && result.data) {
  const manifest: RoutesManifest = result.data;
  manifest.routes.forEach((route: RouteSpec) => {
    console.log(route.id, route.pattern, route.kind);
  });
}

Lock File

import { writeLock, readLock } from "@mandujs/core";

// Write lock file
const lock = await writeLock("spec/spec.lock.json", manifest);
console.log(lock.routesHash);

// Read lock file
const existing = await readLock("spec/spec.lock.json");

Generator Module

Spec-based code generation.

import { generateRoutes, GenerateResult } from "@mandujs/core";

const result: GenerateResult = await generateRoutes(manifest, "./");

console.log("Created:", result.created);
console.log("Skipped:", result.skipped);  // Existing slot files

Template Functions

import {
  generateApiHandler,
  generateApiHandlerWithSlot,
  generateSlotLogic,
  generatePageComponent
} from "@mandujs/core";

// Generate API handler
const code = generateApiHandler(route);

// API handler with slot
const codeWithSlot = generateApiHandlerWithSlot(route);

// Slot logic file
const slotCode = generateSlotLogic(route);

Guard Module

Architecture rule checking and auto-correction.

import {
  runGuardCheck,
  runAutoCorrect,
  GuardResult,
  GuardViolation
} from "@mandujs/core";

// Run check
const result: GuardResult = await runGuardCheck(manifest, "./");

if (!result.passed) {
  result.violations.forEach((v: GuardViolation) => {
    console.log(`${v.rule}: ${v.message}`);
  });

  // Run auto-correction
  const corrected = await runAutoCorrect(result.violations, manifest, "./");
  console.log("Fixed:", corrected.steps);
  console.log("Remaining violations:", corrected.remainingViolations);
}

Guard Rules

| Rule ID | Description | Auto-correctable | |---------|-------------|------------------| | SPEC_HASH_MISMATCH | Spec and lock hash mismatch | ✅ | | GENERATED_MANUAL_EDIT | Manual edit to generated file | ✅ | | HANDLER_NOT_FOUND | Handler file not found | ❌ | | COMPONENT_NOT_FOUND | Component file not found | ❌ | | SLOT_NOT_FOUND | Slot file not found | ✅ |

Runtime Module

Server startup and routing.

import {
  startServer,
  registerApiHandler,
  registerPageLoader
} from "@mandujs/core";

// Register API handler
registerApiHandler("getUsers", async (req) => {
  return { users: [] };
});

// Register page loader
registerPageLoader("homePage", () => import("./pages/Home"));

// Start server
const server = startServer(manifest, { port: 3000 });

// Stop
server.stop();

Report Module

Guard result report generation.

import { buildGuardReport } from "@mandujs/core";

const report = buildGuardReport(guardResult, lockPath);
console.log(report);  // Formatted text report

Types

import type {
  RoutesManifest,
  RouteSpec,
  RouteKind,
  SpecLock,
  GuardResult,
  GuardViolation,
  GenerateResult,
  AutoCorrectResult,
} from "@mandujs/core";

Requirements

  • Bun >= 1.0.0
  • React >= 18.0.0
  • Zod >= 3.0.0

Related Packages

License

MIT