Logo

Worker Tools

Tools for writing HTTP servers in Worker Environments such as Cloudflare Workers.

Get Started Guides

Tools for writing HTTP servers in Worker Environments such as Cloudflare Workers.

Worker Tools are a collection of TypeScript libraries for writing web servers in Worker Environments such as Cloudflare Workers and Deno Deploy.

Tools

  • 🧭 Worker Router — Complete routing solution that works across CF Workers, Deno and Service Workers
  • 🔋 Worker Middleware — A suite of standalone HTTP server-side middleware with TypeScript support
  • 📄 Worker HTML — HTML templating and streaming response library
  • 📦 Storage Area — Storage abstractions for Cloudflare’s KV and Deno
  • ↩️ Response Creators — Factory functions for responses with pre-filled status and status text
  • 🏞 Stream Response — Use async generators to build streaming responses for SSE, etc…
  • 🥏 JSON Fetch — Drop-in replacements for Fetch API classes with first class support for JSON.
  • 🍪 Request Cookie Store — An implementation of the Cookie Store API for use in request handlers.

Worker Tools also includes a number of polyfills that help bridge the gap between different Worker Environments:

Worker Tools also maintains a number of (web-) services:

  • ⚙️ workers.js.org — Educational site about the state of Worker Environments.
  • 🦕 ghuc.cc — Import modules directly from GitHub into Deno with a familiar API.

Worker Tools can be used independently or as a web framework via Shed.

How to Use

Deno users can import Worker Tools directly from GitHub as they are written in TypeScript with fully qualified import specifiers:

import { WorkerRouter } from 'https://ghuc.cc/worker-tools/shed/index.ts'

For other environments such as module bundlers, webpack or esbuild, Worker Tools are distributed as node-ified modules that can be installed via npm and behave like regular npm modules

npm install @worker-tools/shed

Shed is the entire collection of Worker Tools under a single roof, which doubles as a complete web framework built for Worker Environments.

Questions

What niche do Worker Tools fill?

Worker Tools are meant to work across Worker Environments such as Cloudflare Workers, Deno Deploy and Service Workers in the browser via frontend bundlers. They are not meant to be used with NodeJS1. Similar frameworks to Worker Tools typically target either just Deno, just Cloudflare Workers, and usually make no mention of Service Workers.

Worker Tools are “Web Standards Adjacent”, meaning it prioritizes and/or mimic web standards based APIs where possible. The goal is to minimize the number of API patterns frontend developers have to learn when they move into backend development via Worker Environments.

  1. They might work in the future if NodeJS decides to implement a variety of web APIs, such as Web Cryptography (see workers.js.org for a full breakdown). Select modules such as Extendable Promise might work in NodeJS today. ↩︎