Getting Started

Shovel is a framework for building and deploying ServiceWorker applications. Write your application once using web standards, then deploy it anywhere—Node.js, Bun, or Cloudflare Workers.

Create a Project

The fastest way to start is with shovel create:

npm create shovel my-app
cd my-app
npm install
npm run dev

This scaffolds a new project with your choice of template (hello-world, api, static-site, or full-stack).

Manual Setup

Or set up manually:

npm install @b9g/shovel @b9g/router

Create a ServiceWorker entry point:

// src/server.ts
import {Router} from "@b9g/router";

const router = new Router();

router.route("/").get(() => {
  return new Response("Hello from Shovel!");
});

self.addEventListener("fetch", (event) => {
  event.respondWith(router.handle(event.request));
});

Run in development mode:

npx shovel develop src/server.ts

Your server is now running at http://localhost:7777.

Building for Production

npx shovel build src/server.ts

This creates an optimized build in the dist/ directory that you can deploy to your target platform.

Platforms

Shovel supports multiple deployment targets:

Example with a specific platform:

npx shovel develop src/server.ts --platform node

Next Steps