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 🙏

© 2025 – Pkg Stats / Ryan Hefner

uklad

v0.0.2

Published

Reserved to Yandex cloud functions framework

Readme

Uklad

Framework for Yandex Cloud Functions with TypeScript and Zod validation.

Features

  • Type-safe - Full TypeScript support with Zod schemas
  • Automatic validation - Input/output validation through Zod
  • Auto-generated documentation - Beautiful HTML docs from schemas
  • CORS support - Built-in CORS handling
  • JSON Schema compatible - Automatic conversion from Zod to JSON Schema

Installation

npm install uklad

Quick Start

See full example in examples/calculator.ts

import { Action, ActionDispatcher } from "uklad";
import { z } from "zod";

// Define schemas
const inputSchema = z.object({
  name: z.string().min(1),
  age: z.number().min(0).max(150),
});

const outputSchema = z.object({
  message: z.string(),
  timestamp: z.number(),
});

// Create action
const greetAction = new Action({
  name: "Greet User",
  code: "greet",
  description: "Greets a user by name and age",
  inputSchema,
  outputSchema,
  handler: async (payload, event) => {
    return {
      message: `Hello, ${payload.name}! You are ${payload.age} years old.`,
      timestamp: Date.now(),
    };
  },
});

// Create dispatcher
const dispatcher = new ActionDispatcher({
  title: "My API",
  description: "API with auto-generated documentation",
  cors: true,
  allowedOrigins: ["*"],
  actions: {
    greet: greetAction,
  },
});

// Export for Yandex Cloud Functions
export const handler = dispatcher.handler;

Examples

Check the examples/ directory for complete working examples:

  • calculator.ts - Mathematical calculator with multiple operations, precision control, and rounding modes

To run an example:

npx tsx examples/calculator.ts

Development

Build

Build the project to generate JavaScript and TypeScript declaration files:

npm run build

This will:

  • Compile TypeScript to JavaScript (ES modules)
  • Generate .d.ts type declaration files
  • Generate source maps for debugging
  • Output everything to dist/ directory

Clean Build

Remove the dist/ directory and rebuild:

npm run build:clean

Project Structure

uklad/
├── src/              # TypeScript source files
│   ├── action.ts
│   ├── actionDispatcher.ts
│   ├── index.ts
│   ├── interfaces.ts
│   └── docsGen/      # Documentation generator
├── dist/             # Compiled JavaScript + .d.ts files (generated)
├── package.json
└── tsconfig.json

API Reference

Action

Create a new action with Zod schemas:

const action = new Action({
  name: string;           // Display name
  code: string;           // Unique identifier
  description?: string;   // Optional description
  inputSchema: ZodObject; // Zod schema for input
  outputSchema: ZodObject;// Zod schema for output
  handler: Function;      // Handler function
});

ActionDispatcher

Create a dispatcher to handle HTTP requests:

const dispatcher = new ActionDispatcher({
  title: string;                  // API title
  description?: string;           // API description
  cors: boolean;                  // Enable CORS
  allowedOrigins?: string[];      // CORS origins
  allowedHeaders?: string[];      // CORS headers
  actions: Record<string, Action>;// Actions map
});

HTTP Methods

  • GET - Returns auto-generated HTML documentation
  • POST - Executes actions with JSON body: { action: "code", payload: {...} }
  • OPTIONS - CORS preflight (if CORS enabled)

Documentation

When you send a GET request to your function endpoint, you'll see auto-generated HTML documentation with:

  • All available actions
  • Input/output schemas with constraints
  • Examples with cURL commands
  • Interactive copy-to-clipboard for code snippets

TypeScript Support

The library exports full TypeScript types:

import type { 
  Action, 
  ActionDispatcher,
  YFunctionEvent,
  YFunctionContext 
} from "uklad";

License

MIT © iMkhl