phew.network

Run JavaScript code from Bluesky posts. Source

Examples

Hello World

Post | View & Run

export default {
  fetch(request) {
    return new Response("Hello from Bluesky!");
  }
}

SQLite Database

Post | View & Run

export default {
  async fetch(req, env) {
    await env.DB.exec(`CREATE TABLE IF NOT EXISTS c(n INT);INSERT INTO c VALUES(1)`)
    const r = await env.DB.prepare("SELECT COUNT(*)c FROM c").first()
    return new Response(`Hits: ${r.c}`)
  }
}

Importing from Other Posts

A library post exports a function:

export function greet(name) { return `Hello ${name}` }

Another post imports and uses it: View & Run

import { greet } from 'at://maxmcd.bsky.social/3mdxxvwx4r227';

export default {
  fetch(request) {
    return new Response(greet("World"));
  }
}

Usage

Visit /:handle/:rkey to view and run code from a post.

Direct execution: /:handle/:rkey/~run

Request logs: /:handle/:rkey/~logs

Features