pergam

skill
Security Audit
Warn
Health Warn
  • License — License: MIT
  • Description — Repository has a description
  • Active repo — Last push 0 days ago
  • Low visibility — Only 6 GitHub stars
Code Pass
  • Code scan — Scanned 12 files during light audit, no dangerous patterns found
Permissions Pass
  • Permissions — No dangerous permissions requested

No AI report is available for this listing yet.

SUMMARY

Permanent versioned URLs for HTML reports, dashboards, and specs your AI generates — works with Claude Code, Cursor, Codex. Self-hostable in one docker compose, MIT, no telemetry.

README.md

📜 pergam

Immutable parchment for what your AI builds.

A tiny self-hostable service — or a hosted endpoint — that turns every HTML report, dashboard, or design doc your AI generates into a permanent, versioned URL your team can actually open.


License: MIT
Version
GitHub stars

Python
Postgres
Docker
Claude Code

Try it live → · Docs · Claude Code skill · API health


pergam — terminal showing the post-pergam Claude Code skill producing a stable URL

🤔 Why pergam

Your AI generates beautiful HTML — reports, dashboards, design docs, plans. Then those artifacts vanish into chat scrollback. You lose the URL, you lose the version, you lose the trail.

pergam fixes that. One prompt → one shareable, permanent URL. Versioned. Immutable. No accounts, no telemetry, no SaaS lock-in. Self-host it in a docker compose up, or use the hosted service for quick public links.

✨ Features

  • 📦 Publish HTML via one POST, get a stable URL back.
  • 🕰️ Versioned — every logical id keeps full history. v1, v2, … all reachable forever.
  • 🔒 Immutable — pergams can't be edited or deleted, only superseded with a new version.
  • 🧭 Visible versions — every pergam opens under a slim bar with its title, type, tags, author and v3 of 5, a version selector with each version's note, and a notice on older versions linking to the current one. /{id}/diff/v2..v5 shows what changed between two versions, section by section.
  • 🤖 AI-native — ships with a Claude Code skill so your agent can press "ship" and hand back a link without you babysitting curl.
  • 🪞 Built-in viewer — on pergam.dev, a sandboxed iframe with strict CSP: Mermaid + jsDelivr allowed, everything else blocked. A self-hosted server frames each version under its version bar the same way: sandboxed in an opaque origin, with the hosted viewer's CSP, so a published script cannot reach the API.
  • 🏷️ Typed and tagged — a type per pergam from a configurable list (PERGAM_TYPES, five by default) plus free-form tags. Filter the index by type, author or tag; pin what matters, archive what doesn't.
  • 🧹 Lint before publishing — POST /lint reports external resources, broken TOC anchors and malformed Mermaid blocks with their line and column, and stores nothing; the skill runs it before every self-hosted publish.
  • 🔎 Searchable — ?q= searches titles and the visible text of every pergam, with highlighted snippets.
  • 📡 Atom feed — /feed.atom follows new publications, filtered by tag or author.
  • 🚚 Portable — /{id}/export and POST /import move a pergam to another server with its id, versions, dates, tags and notes; the skill promotes one between named servers in one command.
  • 🧩 JSON API — /api/pergams lists, filters, pages and counts like the index; /api/pergams/{id} returns one pergam with its versions.
  • 🔐 Owners behind your proxy — with TRUST_PROXY_USER=1 the author comes from an authenticating reverse proxy (X-Forwarded-User), and only a pergam's owner and the collaborators they list can add versions or edit it.
  • 🐳 Self-hostable — a few small Python modules, one Postgres database, one docker compose up.
  • ☁️ Also hosted — pergam.dev for public 1-year shares. Zero setup, drag-and-drop.
  • 🪶 Tiny stack — Python stdlib + psycopg for the server. A tiny edge worker for the hosted variant. No framework, no build step.

⚡ Quickstart

Two paths, depending on whether you want full history or just a quick public link.

🐳 Self-host (versioned, durable, MIT)

git clone https://github.com/diesilveira/pergam
cd pergam
docker compose up -d --build
curl http://localhost:1111/healthz       # → {"ok":true}

Publish your first pergam:

curl -sS -X POST http://localhost:1111/pergam \
  -H 'Content-Type: application/json' \
  -d '{"title":"Hello","html":"<h1>hi</h1>","type":"otro","author":"[email protected]"}'

You'll get a view_url back — open it in a browser. That's the whole loop. ✨

☁️ Hosted (zero setup, 1-year TTL)

Drag any .html onto pergam.dev and you get a public link. No account, no key. Same thing via the API:

curl -sS -X POST https://api.pergam.dev/share \
  -H 'Content-Type: application/json' \
  -d '{"title":"Hello","html":"<h1>hi</h1>"}'

Response: {"token": "…", "view_url": "https://pergam.dev/s/…", "expires_at": "…"}.

🤖 Claude Code skill

Install the post-pergam skill once and any project gets a "publish this as a pergam" verb:

git clone https://github.com/diesilveira/pergam
cp -r pergam/skills/post-pergam ~/.claude/skills/

Inside any project, ask Claude:

"armá un pergam de X y publicalo"

The skill auto-picks the server and backend: a server the user names ("publish it on team") from ~/.config/pergam/servers.json, else $PERGAM_URL, else the file's default, else hosted:

  • https://api.pergam.dev → hosted (Flow A, 1-year TTL)
  • Any other URL, like http://localhost:1111 → self-hosted (Flow B, versioned), with an optional CA bundle per server for private TLS

See skills/post-pergam/SKILL.md for the full contract — when to bump a version, the type taxonomy, and the HTML guidelines for what the AI should produce.

🧱 Architecture

┌─────────────┐      ┌──────────────────┐      ┌──────────────┐
│   Client    │ ───→ │      pergam      │ ───→ │   Postgres   │
│ (AI / curl) │      │ (Python, stdlib) │      │  (4 tables)  │
└─────────────┘      └──────────────────┘      └──────────────┘
  • One Python process, no framework — just http.server + psycopg.
  • Four Postgres tables: immutable pergams (id, version, …) with a composite key, pergam_meta (id, tags, archived, pinned, origin, collaborators) for what belongs to the id rather than to a version, pergam_text with each version's extracted text and full-text search document, and pergam_note with the optional note of each version. Latest version per id resolved on read through the pergams_latest view.
  • Framed documents: the view page loads each version in an iframe from /{id}/v{n}/content and talks to it only through a postMessage bridge, so the frame is sandboxed without allow-same-origin and /content carries the hosted viewer's CSP (no connection, form or frame to the API, frame-ancestors limited to the server), with a CSP sandbox directive for when it is opened on its own.
  • Hosted side is a separate ~200 LOC subset: token-based, TTL-bound, no versioning. See web/worker/ for a reference deployment on Cloudflare Workers + KV.

Full schema, request flow, and config knobs → DOCS.md.

📖 Docs

Topic Where
🔌 Full API reference DOCS.md § API
🕰️ Versioning model DOCS.md § Versioning
⚙️ Configuration DOCS.md § Configuration
🚢 Deployment guide DOCS.md § Deployment
🤖 Claude Code skill skills/post-pergam/SKILL.md
☁️ Hosted variant (example: Cloudflare) web/worker/
🌐 Landing source web/public/

🤝 Contributing

Issues and PRs welcome. Open an issue first for non-trivial changes — happy to chat about it before you put time in.

If pergam is the shape of what you wanted, starring the repo is the highest-signal way to tell me. ⭐

📝 License

MIT — do whatever, no warranty.


Built by diesilveira.dev · Live at pergam.dev · v1.0.0

Reviews (0)

No results found