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

synapse-framework

v2.0.0

Published

AI-Native TypeScript Framework for Autonomous Agents - Contract-First APIs with Zod schemas

Readme

Synapse

AI-Native TypeScript Framework for Autonomous Agents

Synapse treats AI agents as first-class citizens. It maximizes "Locality of Behavior" and provides structured, compiler-driven feedback loops for self-healing code generation.

Features

  • Contract-First Development - Every route requires Zod schemas for input/output
  • Single-File Architecture - Route, Schema, Handler, and Tests in one file
  • Auto-Generated Manifest - synapse.manifest.json with full JSON schemas
  • Auto-Generated SDK - Type-safe client.ts for API consumption
  • AI Diagnostics - Structured error prompts with fix_instruction
  • Guard System - Explicit, visible security requirements
  • Middleware Pipeline - Composable request/response processing
  • WebSocket Support - Real-time communication with same guard system
  • OpenAPI/Swagger - Auto-generated API documentation
  • Plugin Architecture - Extensible plugin system
  • Testing Utilities - Built-in test client and assertions

Quick Start

# Install dependencies
bun install

# Start development server
bun run dev

# Create a new feature
bun run create products

# Seed database
bun run seed

# List all routes
bun run routes

# Check project health
bun run doctor

Define a Route

import { z } from "zod";
import { Synapse } from "./synapse";

const app = new Synapse({ port: 3000 });

// Using convenience methods
app.post("/users", {
    description: "Create a new user",
    input: z.object({
        name: z.string().min(1),
        email: z.string().email(),
    }),
    output: z.object({
        id: z.string(),
        name: z.string(),
        email: z.string(),
    }),
    handler: async ({ input }) => ({
        id: crypto.randomUUID(),
        name: input.name,
        email: input.email,
    }),
});

app.serve();

Middleware

import { cors, requestId, loggerMiddleware } from "./middleware";

const app = new Synapse({ port: 3000 });

// Add middleware
app.use(requestId());
app.use(loggerMiddleware());
app.use(cors({ origin: "*" }));

// Custom middleware
app.use(async (ctx, next) => {
    console.log(`[${ctx.method}] ${ctx.path}`);
    return next();
});

WebSocket

import { z } from "zod";
import { AuthGuard } from "./guards";

app.ws.route({
    path: "/chat/:room",
    guards: [AuthGuard],
    messageSchema: z.object({ text: z.string() }),
    onOpen: (ctx) => {
        ctx.socket.subscribe(ctx.data.path);
    },
    onMessage: (ctx, message) => {
        ctx.socket.publish(ctx.data.path, JSON.stringify(message));
    },
});

Plugins

import { healthCheckPlugin, definePlugin } from "./plugin";

// Use built-in plugin
await app.register(healthCheckPlugin);

// Define custom plugin
const myPlugin = definePlugin("my-plugin", "1.0.0")
    .description("My custom plugin")
    .routes(myRoutes)
    .middleware(myMiddleware)
    .build();

await app.register(myPlugin);

API Documentation

After starting the server, access:

Project Structure

synapse.ts       # Core framework
index.ts         # Entry point
env.ts           # Environment validation
synapse.db.ts    # Drizzle ORM setup
schema.ts        # Database tables
guards.ts        # Auth guards
middleware.ts    # Request/response middleware
websocket.ts     # WebSocket support
openapi.ts       # OpenAPI generation
plugin.ts        # Plugin system
testing.ts       # Test utilities
logger.ts        # Structured logging
response.ts      # Response helpers
diagnostics.ts   # Error-to-prompt engine
cli.ts           # CLI tools
features/        # Single-file features
docs/            # Documentation

CLI Commands

| Command | Description | |---------|-------------| | bun run dev | Start dev server with hot reload | | bun run start | Start production server | | bun run create <name> | Scaffold a new feature | | bun run seed | Run database seeders | | bun run routes | List all registered routes | | bun run doctor | Check project health | | bun run test | Run tests |

Documentation

See docs/llm-handbook.md for token-efficient AI reference.

License

MIT