Rusty Beam

DOM-Enabled Web Server

Overview

Rusty Beam is a powerful Fastly Compute@Edge application that extends the HTTP Range header to support CSS selectors. This enables RESTful operations (GET, POST, PUT, DELETE) on specific DOM elements within HTML documents, transforming how you interact with web content at the edge.

Key Innovation: Use CSS selectors in HTTP Range headers to target specific parts of HTML documents, enabling surgical updates to web content without modifying entire files.

Core Features

CSS Selector Ranges

Target specific DOM elements using familiar CSS selectors in HTTP Range headers.

Range: selector=#content
Range: selector=.article h1
Range: selector=table tr:first-child

RESTful Operations

Support for all HTTP methods on selected elements:

  • GET: Retrieve partial content
  • POST: Append after element
  • PUT: Replace element content
  • DELETE: Remove element

Plugin Architecture

Extensible plugin system with transformers and handlers for authentication, authorization, content transformation, and more.

Edge Storage

Integration with Fastly KVStore for persistent storage at the edge, enabling dynamic content management.

Microdata Support

Automatic extraction and JSON-LD conversion of HTML microdata for structured data operations.

Template Processing

Liquid template support for dynamic content generation with POST-to-PUT transformations.

Quick Start

Prerequisites

  • Rust toolchain with WASM target support
  • Fastly CLI
  • A Fastly Compute@Edge service

Installation

# Clone the repository
git clone https://github.com/yourusername/bat-made-of-silver.git
cd bat-made-of-silver

# Build for WASM target
cargo build --target wasm32-wasi --release

# Deploy to Fastly
fastly compute publish

Basic Usage

Once deployed, you can start using CSS selectors in your HTTP requests:

# Get specific element
curl -H "Range: selector=#main-content" https://your-service.edgecompute.app/page.html

# Update element content  
curl -X PUT -H "Range: selector=h1" \
  -d "<h1>New Title</h1>" \
  https://your-service.edgecompute.app/page.html

# Delete element
curl -X DELETE -H "Range: selector=.sidebar" \
  https://your-service.edgecompute.app/page.html

Documentation

Explore the complete documentation to learn about all features and capabilities: