layout | logo | description | buttons | selected_projects | |||
---|---|---|---|---|---|---|---|
landing |
<img src="assets/img/logo.svg" alt="Logo" width="172" height="172">
|
Tools for writing HTTP servers in [__Worker Runtimes__](https://workers.js.org/){:.external} such as [__Cloudflare Workers__](https://workers.cloudflare.com).
|
[Get Started](#how-to-use){:.btn.btn-primary} [Examples](/examples){:.btn.btn-default style="font-weight:normal"}
|
|
Worker Tools are a collection of TypeScript libraries for writing web servers in Worker Runtimes such as Cloudflare Workers and Deno Deploy.
- Table of Contents {:toc .large-only}
- 🧭 Worker Router{:.flip-title} --- Complete routing solution that works across CF Workers, Deno and Service Workers
- 🔋 Worker Middleware{:.flip-title} --- A suite of standalone HTTP server-side middleware with TypeScript support
- 📄 Worker HTML{:.flip-title} --- HTML templating and streaming response library
- 📦 Storage Area{:.flip-title} --- Key-value store abstraction across Cloudflare KV, Deno and browsers.
- 🆗 Response Creators{:.flip-title} --- Factory functions for responses with pre-filled status and status text
- 🎏 Stream Response{:.flip-title} --- Use async generators to build streaming responses for SSE, etc...
- 🥏 JSON Fetch{:.flip-title} --- Drop-in replacements for Fetch API classes with first class support for JSON.
- 🦑 JSON Stream{:.flip-title} --- Streaming JSON parser/stingifier with 1st class support for WHATWG/web streams.
- 🧱 Structured JSON{:.flip-title} --- Stringify and parse JavaScript values according to Structured Clone Algorithm
- 🍪 Request Cookie Store{:.flip-title} --- An implementation of the Cookie Store API for use in request handlers.
- ⏱ Extendable Promise{:.flip-title} --- A promise that can be delayed/extended by calling
waitUntil
.
Worker Tools also includes a number of polyfills that help bridge the gap between different Worker Runtimes:
- ✏️ HTML Rewriter{:.flip-title} --- Cloudflare's HTML Rewriter for use in Deno, browsers, etc...
- 📍 Location Polyfill{:.flip-title} --- A
Location
polyfill for Cloudflare Workers. - 🦕 Deno Fetch Event Adapter{:.flip-title} --- Dispatches global
fetch
events using Deno’s native HTTP server.
Worker Tools also maintains a number of (web-) services:
- ⚙️ workers.js.org --- Educational site about the state of Worker Runtimes.
- 🦕 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{:.flip-title}.
Deno users can import Worker Tools directly from GitHub as they are written in TypeScript with fully qualified import specifiers:
import * as shed from 'https://ghuc.cc/worker-tools/shed/index.ts'
For other Runtimes 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{:.flip-title} is the entire collection of Worker Tools under a single roof, which doubles as a complete web framework built for Worker Runtimes. {:.note title="FYI"}
Worker Tools currently doesn't have TodoMVC or similar demo projects, but it has two full web services running in the wild that are Open Source and can be used for reference.
-
ghuc.cc{:.flip-title} An entire web service in a single file that can be deployed to Cloudflare Workers or Deno Deploy (with some extra work). TBD
-
Worker News{:.flip-title} A Hacker News clone that scraps the site via HTML Rewriter and renders custom streaming HTML via Worker Tools. TBD
Worker Tools are meant to work across Worker Runtimes such as Cloudflare Workers, Deno Deploy and Service Workers in the browser via frontend bundlers. They are not meant to be used with NodeJS. 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 Runtimes.