- Rust 99.5%
- Dockerfile 0.5%
| deploy | ||
| src | ||
| .dockerignore | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| Cargo.toml.split-template | ||
| CLOUDFLARE.md | ||
| DEPLOYMENT-HETZNER.md | ||
| Dockerfile | ||
| LICENSE | ||
| LICENSE-EUPL-1.2.txt | ||
| README.md | ||
hashavatar.app
hashavatar.app is the public HTTP service built on top of the hashavatar crate.
It exposes deterministic avatar generation through stable URLs so the service can sit safely behind Cloudflare and serve cached results at the edge.
What It Does
- serves a landing page at
/ - exposes a health endpoint at
/healthz - exposes a query-based avatar API at
/v1/avatar - exposes a path-based avatar API at
/avatar/{kind}/{identity}/{format}
Supported formats:
webppngsvg
Supported avatar families:
catdogrobotfoxalien
Example URLs
Query API:
/v1/avatar?id=alice@example.com&kind=robot&background=white&format=webp&size=256
Path API:
/avatar/cat/alice@example.com/svg
/avatar/fox/alice@example.com/png
Why This Works Well Behind Cloudflare
Avatar responses are deterministic for the full request tuple:
- identity
- avatar kind
- background mode
- output format
- size
That makes aggressive edge caching appropriate.
The service already emits:
Cache-Control: public, max-age=86400, s-maxage=31536000, immutableCDN-Cache-Control: public, max-age=31536000, immutableCloudflare-CDN-Cache-Control: public, max-age=31536000, immutableETag
This gives browsers a shorter cache while allowing Cloudflare to keep hot avatar objects cached for a long time.
Running Locally
From inside public-website:
cargo run
Default bind:
0.0.0.0:8080
Environment variables:
PORTPUBLIC_WEBSITE_HOST
Running On Your Own Server
For self-hosting on Hetzner with Podman, see:
Deployment Shape
Typical setup:
- deploy the service to a public origin
- put Cloudflare in front of it
- cache only
/v1/avatarand/avatar/ - keep
/and other operational endpoints separate from aggressive asset caching - rate-limit the avatar endpoints at Cloudflare
Deployment helper files included here:
Operational Guidance
Recommended production practices:
- keep avatar sizes bounded
- enable HTTPS only
- restrict origin access to Cloudflare where possible
- normalize or document canonical URL usage
- monitor cache hit ratio and origin error rate
Related Project
This service is powered by the parent crate: