@clawhash/netlify
v1.1.0
Published
Netlify Function adapter for clawhash — serves GET /avatar/:hash as SVG
Readme
@clawhash/netlify
Netlify Function adapter for clawhash. Serves deterministic crustacean avatars as SVG over HTTP.
Install
npm install @clawhash/core @clawhash/crustacean @clawhash/netlifySetup
- Add redirect rules to your
netlify.toml:
[[redirects]]
from = "/avatar/*"
to = "/.netlify/functions/avatar"
status = 200- Create
netlify/functions/avatar.mjs:
export { default } from '@clawhash/netlify';- Deploy. Avatars are served at
/avatar/:hash.
Routes
GET /avatar/:hash -> SVG, 200px
GET /avatar/:hash?size=64 -> SVG, 64px (clamped 16-512)
GET /avatar/:hash.svg -> explicit SVG extensionResponse headers
| Header | Value |
|--------|-------|
| Content-Type | image/svg+xml |
| Cache-Control | public, max-age=31536000, immutable |
| X-Clawhash-Palette | soviet | ocean | rust | void | brine |
| X-Clawhash-Seed | The resolved seed string |
| Access-Control-Allow-Origin | * |
HTML usage
<img src="https://your-clawhash.netlify.app/avatar/hal-9000" width="64" height="64" />License
MIT
