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

wrangler-proxy

v2.2.7

Published

Wrangler Proxy for your favorite frameworks. Compatible with DrizzleORM

Downloads

108

Readme

wrangler-proxy

Download Version

Wrangler Proxy exposes Workers API to outside and integrate to your favorite frameworks. Compatible with DrizzleORM.

Quick links

Get Started

Install

npm i -D wrangler-proxy

Example wrangler.toml

name = "worker"
compatibility_date = "2023-07-02"

[[d1_databases]]
binding = "D1"
database_name = "D1"
database_id = "<d1-id>"

[[kv_namespaces]]
binding = "KV"
id = "<kv-id>"
preview_id = "<same-kv-id-as-above>"

[[services]]
binding = "WORKER"
service = "<worker-name>"
environment = "production"

Start proxy for dev

Remote mode

wrangler dev node_modules/wrangler-proxy/dist/worker.js --remote

Local mode

wrangler dev node_modules/wrangler-proxy/dist/worker.js

Example SvelteKit project

// file: app.d.ts

declare global {
  namespace App {
    interface Locals {
      D1: D1Database;
    }
    interface Platform {
      env?: {
        D1: D1Database;
      };
    }
  }
}

export {};
// file: src/hooks.server.ts

import { connectD1 } from 'wrangler-proxy';

export const handle = ({ event, resolve }) => {
  event.locals.D1 = event.platform?.env?.D1 ?? connectD1('D1');
  // or connectD1('D1', { hostname: 'custom-host-name' });
  // default hostname is `http://127.0.0.1:8787`
  return resolve(event);
};

Using wrangler-proxy to expose workers API

Init worker

npm create cloudflare@2 - .
// file: src/index.ts
import { createWorker } from 'wrangler-proxy';

export default createWorker();

Features

  • 😔 Need funding
  • 🤷 Not fully tested
  • ✅ Complete

D1

import { connectD1 } from 'wrangler-proxy';

| Function | Status | | ----------- | ------ | | prepare() | ✅ | | batch() | ✅ | | dump() | 😔 | | exec() | ✅ |

PreparedStatement

| Function | Status | | --------- | ------ | | first() | ✅ | | run() | ✅ | | all() | ✅ | | raw() | ✅ | | bind() | ✅ |

Service Bindings

import { connectServiceBinding } from 'wrangler-proxy';

| Function | Status | | ----------- | ------ | | fetch() | ✅ | | connect() | 😔 |

app.d.ts

// app.d.ts

declare global {
  namespace App {
    interface Locals {
      SB: Fetcher;
    }
    interface Platform {
      env?: {
        SB: Fetcher;
      };
    }
  }
}

hooks.server.ts

/// hooks.server.ts

import { connectServiceBinding } from 'wrangler-proxy';

export const handle = async ({ resolve, event }) => {
  event.locals.SB = event.platform?.env?.SB ?? connectServiceBinding('SB');
  return resolve(event);
};

Example usage

event.locals.SB.fetch('http://whatever.fake/send');

http://whatever.fake is required as a dummy hostname. Without a dummy hostname the fetch will fail.

KV

import { connectKV } from 'wrangler-proxy';

| Function | Status | | ------------------- | ------ | | put() | 🤷 | | get() | ✅ | | getWithMetadata() | 🤷 | | delete() | ✅ | | list() | 🤷 |

R2

import { connectR2 } from 'wrangler-proxy';

| Function | Status | | ------------------------- | ------ | | head() | 😔 | | get() | ✅ | | put() | ✅ | | createMultipartUpload() | 😔 | | resumeMultipartUpload() | 😔 | | delete() | ✅ | | list() | 😔 |

waitUntil

// file: app.d.ts
namespace App {
  interface Platform {
    context: {
      waitUntil(promise: Promise<any>): void;
    };
  }
}
// file: +page.server.ts
import { waitUntil } from 'wrangler-proxy';

export const actions = {
  default: ({ locals, platform }) => {
    waitUntil((async () => {})(), platform?.context);
    return { message: 'success' };
  },
};

Queues 😔

Hyperdrive 😔

Workers AI 😔

AI Gateway 😔

Stream 😔

Images 😔

Contributing

If you find this project helpful, consider supporting it by

or

Donating via PayPal

Your donation will help us implement your requested features faster.