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

unsurf

v0.2.0

Published

Turn any website into a typed API

Readme

unsurf

Turn any website into a typed API.

surf the web → unsurf it

What it does

An agent visits a site, captures every API call happening under the hood, and gives you back:

  • OpenAPI spec — every endpoint, typed
  • TypeScript client — ready to import
  • Execution paths — step-by-step recipes to repeat actions

No reverse engineering. No docs. No browser needed after the first pass.

How it works

Agent                     unsurf                        Target Site
  │                          │                               │
  │  scout(url, task)        │                               │
  │─────────────────────────▶│                               │
  │                          │  browser + network capture    │
  │                          │──────────────────────────────▶│
  │                          │◀──────────────────────────────│
  │                          │                               │
  │  { openapi, client,      │                               │
  │    paths, endpoints }    │                               │
  │◀─────────────────────────│                               │
  │                          │                               │
  │  worker(path, data)      │  replay API directly          │
  │─────────────────────────▶│──────────────────────────────▶│
  │  { result }              │◀──────────────────────────────│
  │◀─────────────────────────│                               │

Scout explores. Worker executes. Heal fixes things when they break.

Quick start

As a library

npm install unsurf
import { scout, worker, heal } from "unsurf";
import { makeSchemaInferrer, makeOpenApiGenerator } from "unsurf";
import { Browser, Store, SchemaInferrer, OpenApiGenerator } from "unsurf";

Self-hosted (Cloudflare Worker)

Deploy to Cloudflare

Or manually:

git clone https://github.com/acoyfellow/unsurf
cd unsurf
bun install
CLOUDFLARE_API_TOKEN=your-token ALCHEMY_PASSWORD=your-password bun run deploy

Live instance: https://unsurf.coy.workers.dev

MCP Server

The live instance exposes an MCP endpoint at:

https://unsurf.coy.workers.dev/mcp

Connect from Claude Desktop, Cursor, or any MCP client using the Streamable HTTP transport.

Tools

scout

Explore a site. Map its API.

{
  "tool": "scout",
  "input": {
    "url": "https://example.com",
    "task": "find the contact form and map how it submits"
  }
}

Returns captured endpoints with inferred schemas, an OpenAPI spec, and replayable paths.

worker

Execute a scouted path. Skips the browser — replays the API calls directly.

{
  "tool": "worker",
  "input": {
    "path_id": "example-com-contact-form",
    "data": {
      "name": "Jane Doe",
      "email": "[email protected]",
      "message": "Hello"
    }
  }
}

heal

Site changed? Path broken? Heal re-scouts, diffs, patches, retries.

{
  "tool": "heal",
  "input": {
    "path_id": "example-com-contact-form",
    "error": "Form field 'email' not found"
  }
}

Built with

Why Effect

Every operation in unsurf can fail. Browsers crash. Sites change. Networks drop. APIs rate-limit.

| Problem | Effect solution | |---|---| | Browser container leaks | Scope + acquireRelease — guaranteed cleanup | | Transient failures | Schedule.exponential + retry — automatic backoff | | Different error types need different handling | Schema.TaggedError + catchTag — typed error routing | | Swapping browser/store in tests | Layer + Context.Tag — inject different implementations | | Hundreds of CDP network events | Stream — filter, group, process without buffering | | LLM provider outages | ExecutionPlan — OpenAI → Anthropic fallback | | Data validation + OpenAPI generation | Schema — one definition, five outputs |

Architecture

unsurf/
├── alchemy.run.ts                # Infrastructure as code (D1, R2, Worker, Browser)
├── tsup.config.ts                # Build config for NPM package
├── src/
│   ├── index.ts                  # NPM package barrel export
│   ├── cf-worker.ts              # Cloudflare Worker entry point
│   ├── Api.ts                    # HttpApi definition
│   ├── ApiLive.ts                # HttpApiBuilder implementation
│   ├── domain/                   # Effect Schema definitions
│   │   ├── Endpoint.ts           # CapturedEndpoint
│   │   ├── Path.ts               # ScoutedPath + PathStep
│   │   ├── NetworkEvent.ts       # CDP event schema
│   │   ├── Errors.ts             # Tagged errors
│   │   └── Site.ts               # Site metadata
│   ├── db/                       # Drizzle schema + queries
│   │   ├── schema.ts             # Drizzle table definitions
│   │   └── queries.ts            # Typed query helpers
│   ├── services/                 # Effect services
│   │   ├── Browser.ts            # CF browser rendering
│   │   ├── Store.ts              # D1 (via Drizzle) + R2
│   │   ├── SchemaInferrer.ts     # JSON → Schema
│   │   └── OpenApiGenerator.ts   # Endpoints → OpenAPI
│   ├── tools/                    # MCP tool implementations
│   │   ├── Scout.ts
│   │   ├── Worker.ts
│   │   └── Heal.ts
│   ├── ai/                       # LLM scout agent (planned)
│   └── lib/                      # Utilities
│       └── url.ts                # URL pattern normalization
├── migrations/                   # Drizzle-generated SQL migrations
├── drizzle.config.ts
├── test/
├── package.json
└── tsconfig.json

Infrastructure

No YAML. No TOML. Just TypeScript.

// alchemy.run.ts
import alchemy from "alchemy"
import { Worker, D1Database, Bucket, BrowserRendering } from "alchemy/cloudflare"

const app = await alchemy("unsurf", {
  password: process.env.ALCHEMY_PASSWORD,
})

const DB = await D1Database("unsurf-db", {
  migrationsDir: "./migrations",
})

const STORAGE = await Bucket("unsurf-storage")

const BROWSER = BrowserRendering()

export const WORKER = await Worker("unsurf", {
  entrypoint: "./src/index.ts",
  bindings: { DB, STORAGE, BROWSER },
  url: true,
})

await app.finalize()

Self-hosted

Deploy to your own Cloudflare account. Your data stays yours.

bun run deploy

License

MIT