Jason Tudisco 689d14202b Add README for main project and each example
Main README covers quick start, API overview, and links to example READMEs.
Each example (paste, filemanager, can-sync, canfs) gets its own README
with setup instructions, architecture, and configuration details.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 14:45:20 -06:00
..

Paste

A minimal pastebin web app built on CAN Service. Type text and press Enter, or paste an image from your clipboard. Everything gets stored as a CAN asset.

Features

  • Text paste -- type and hit Enter to store a text snippet
  • Image paste -- Ctrl+V an image from your clipboard, or click the paperclip to attach a file
  • Auto-tagging -- use #hashtags in your text and they're extracted as CAN tags
  • Live refresh -- new pastes appear instantly via Server-Sent Events (including content arriving from P2P sync on another machine)

Running

Make sure CAN Service is running on port 3210 first:

# From the repo root
cargo run

Then start Paste:

cd examples/paste
cargo run

Opens automatically at http://127.0.0.1:3211.

How It Works

Paste is a thin proxy layer. The Rust backend serves a single-page HTML/JS frontend and forwards requests to the CAN Service API:

Paste Route Proxies To Purpose
POST /paste/text POST /api/v1/can/0/ingest Store text as a .txt asset
POST /paste/file POST /api/v1/can/0/ingest Store an uploaded file
GET /paste/list GET /api/v1/can/0/list?application=paste List paste assets
GET /paste/asset/{hash} GET /api/v1/can/0/asset/{hash} Download an asset
GET /paste/thumb/{hash} GET /api/v1/can/0/asset/{hash}/thumb/200/200 Image thumbnail
GET /paste/events GET /api/v1/can/0/events SSE stream for live updates

All pastes are tagged with application=paste so they're scoped separately from other CAN content.

Project Structure

src/
  main.rs    HTTP server: proxy handlers, tag extraction, SSE relay
  html.rs    Single-page frontend (HTML + CSS + JS, embedded as a string)