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

@kozojs/core

v0.3.7

Published

High-performance TypeScript framework with type-safe client generation

Readme

@kozojs/core

🔥 Kozo - The fastest TypeScript framework that runs everywhere.

High-performance backend framework with native Zod validation, type-safe client generation, and edge runtime compatibility.

📊 Performance

  • 17,510 req/s — faster than Fastify (+33%) and NestJS (+324%)
  • Native C++ route matching via uWebSockets.js — zero JS dispatch overhead
  • Zero overhead serialization with fast-json-stringify
  • Edge-ready: Works on Node.js, Bun, Deno, and Cloudflare Workers

✨ Features

  • 🎯 Type-Safe Client Generation - Auto-generate typed SDK from your API
  • Zero Config - No decorators, no boilerplate
  • 🛡️ Zod Native - First-class Zod schema support
  • 🌍 Universal - Runs on any JavaScript runtime
  • 🚀 Fast - Optimized for performance with minimal overhead

🚀 Quick Start

npm install @kozojs/core zod
import { createKozo } from '@kozojs/core';
import { z } from 'zod';

const app = createKozo({ port: 3000 });

// Define schema
const UserSchema = z.object({
  id: z.string().uuid(),
  email: z.string().email(),
  name: z.string(),
});

// Create route with validation
app.get('/users/:id', {
  params: z.object({ id: z.string().uuid() }),
  response: UserSchema,
}, (c) => {
  return {
    id: c.params.id,
    email: '[email protected]',
    name: 'John Doe',
  };
});

await app.listen(3000);

🎯 Type-Safe Client Generation

Generate a fully typed client SDK with automatic type inference:

// server.ts
const app = createKozo();

app.get('/users', {
  query: z.object({ page: z.number() }),
  response: z.array(UserSchema),
}, handler);

// Generate client
const clientCode = app.generateClient({
  baseUrl: 'https://api.example.com',
  includeValidation: true, // Include Zod schemas for client-side validation
  validateByDefault: false, // Opt-in validation
});

// Save to file
writeFileSync('./client/api.ts', clientCode);

Usage in Frontend:

import { KozoClient } from './client/api';

const api = new KozoClient({
  baseUrl: 'https://api.example.com',
  validateRequests: true, // Enable runtime validation
});

// Fully typed! 🎉
const users = await api.users({ query: { page: 1 } });
//    ^? User[]

// TypeScript catches errors at compile time
const user = await api.usersById({ 
  params: { id: 'invalid' } // ❌ Type error: not a UUID
});

🛡️ Validation

Kozo uses Zod for schema validation with detailed error messages:

app.post('/users', {
  body: z.object({
    email: z.string().email(),
    name: z.string().min(2).max(50),
    age: z.number().min(18),
  }),
  response: UserSchema,
}, (c) => {
  // c.body is fully typed and validated
  const { email, name, age } = c.body;
  // Your logic here
});

Error Response (auto-formatted):

{
  "error": "Validation failed",
  "details": [
    {
      "path": ["email"],
      "message": "Invalid email"
    }
  ]
}

🌍 Runtime Compatibility

Kozo runs on all modern JavaScript runtimes:

// Node.js
import { createKozo } from '@kozojs/core';
const app = createKozo();
await app.listen(3000);

// Bun (faster JSON parsing)
const app = createKozo();
await app.listen(3000); // Automatically uses Bun optimizations

// Cloudflare Workers
export default {
  fetch: app.fetch,
};

// Deno
import { createKozo } from 'npm:@kozojs/core';

📈 Performance Comparison

| Framework | Req/s | Latency (GET) | |-----------|-------|---------------| | Kozo | 17,510 | 317 μs | | Fastify | 13,210 | 766 μs | | NestJS | 4,131 | 648 μs |

Benchmarked with autocannon — 10 concurrent connections, 10 seconds. Route matching done in C++ by uWS before any JS runs.

Why choose Kozo:

  • If you need maximum throughput → 33% faster than Fastify
  • If you want best DX + type safety → Zod-native, zero boilerplate
  • If you need type-safe client generation → built-in SDK codegen
  • If you need maximum portability → Works on Node.js, Bun, Deno, Edge

🔌 Middleware

app.use(async (c, next) => {
  console.log(`${c.req.method} ${c.req.url}`);
  await next();
});

🎨 Services (Dependency Injection)

const app = createKozo({
  services: {
    db: new DatabaseClient(),
    cache: new RedisClient(),
  }
});

app.get('/users', {}, (c) => {
  const users = await c.services.db.users.findMany();
  return users;
});

📚 API Reference

createKozo(config?)

Create a new Kozo application.

Options:

  • port?: number - Server port (default: 3000)
  • services?: Services - Dependency injection container

app.get(path, schema, handler)

Define a GET route.

Parameters:

  • path: string - Route path (supports :param)
  • schema: RouteSchema - Zod schemas for validation
    • params?: ZodSchema - Path parameters
    • query?: ZodSchema - Query string
    • response?: ZodSchema - Response body (enables fast serialization)
  • handler: (context) => any - Route handler

app.generateClient(options?)

Generate a type-safe client SDK.

Options:

  • baseUrl?: string - API base URL
  • includeValidation?: boolean - Include Zod schemas (default: true)
  • validateByDefault?: boolean - Enable validation by default (default: false)
  • defaultHeaders?: Record<string, string> - Default request headers

🏆 When to Use Kozo

Use Kozo if you:

  • ✅ Need edge deployment (Cloudflare Workers, Vercel Edge)
  • ✅ Want Bun compatibility
  • ✅ Love Zod and want native integration
  • ✅ Need type-safe client generation
  • ✅ Want zero-config DX

Don't use Kozo if you:

  • ❌ Only target Node.js and need absolute maximum speed
  • ❌ Already have a complex Fastify/Express setup
  • ❌ Don't care about type safety

📄 License

MIT

🤝 Contributing

Contributions welcome! See CONTRIBUTING.md


Made with ⚡ by the Kozo team

Powered by uWebSockets.js — native per-route C++ matching