Skip to content
upsetdevPublic

Latest commit

 

History

14 Commits

Folders and files

Repository files navigation

BlobCDN

Random SVG blob images you can embed with a single URL.

Deploy with Pyo

Run locally

Requires Go 1.25 or later.

go run .

The server listens on http://localhost:3000. Set PORT to use another port.

PORT=8080 go run .

Build and run a container:

docker build -t blobcdn .
docker run --rm -p 3000:3000 blobcdn

You can also run the published image:

docker run --rm -p 3000:3000 ghcr.io/upsetdev/blobcdn:latest

API

GET /blob.svg

Returns an SVG blob. All query parameters are optional.

Parameter Default Description
seed random Reproduce a specific blob. Any string.
extraPoints 4 Extra points on top of the base three.
randomness 6 How far points move from the center.
size 256 SVG width and height in pixels.
fill random color Hex color without #.
stroke none Hex color without #.
strokeWidth 0 Stroke width in pixels.
curl 'http://localhost:3000/blob.svg?seed=hello&size=128&fill=ff0000'

The Blob-Path response header holds a URL that reproduces that blob. Blob-Version is 1.0-dev, or <hostname>-<POP_ID> when POP_ID is set.

HEAD works the same way. Other methods return 405, and unknown paths return 404.

Examples

Example URL
Default blob https://blobcdn.com/blob.svg?seed=hello
Red blob https://blobcdn.com/blob.svg?seed=blobcdn&fill=ff4d6d&extraPoints=6
Outlined blob https://blobcdn.com/blob.svg?seed=42&fill=ffd166&stroke=333333&strokeWidth=4

Development

Run the tests:

go test ./...

Tests cover blob generation, SVG output, query parsing, and HTTP headers using recorded fixtures in testdata/golden.

Source layout:

  • main.go: entry point, PORT and POP_ID configuration.
  • internal/server: routes, headers, and response handling.
  • internal/blobs: seeded blob generation and SVG rendering.
  • internal/js: number and query string behavior.
  • internal/libm: math helpers used by blob generation.

License

MIT

Releases

Packages

Contributors

Languages