Back to selected work

image-craft-service · Case study

Image transforms on infrastructure you control

A self-hosted image API that brings upload and remote-image transforms, caching, batch work, and operational controls into one service.

  • Node.js
  • Fastify
  • Sharp
  • TypeScript

Challenge

Image processing often pulls file handling, format negotiation, cache policy, and background work into product code. Remote URL support also needs strong boundaries around what the server is allowed to fetch.

Approach

  • Provide a single transform API for uploaded files and public remote URLs, with resize, crop, conversion, and quality options.
  • Use TTL and size-bounded caching, request coalescing, ETags, and optional S3-compatible storage to control repeated work and storage placement.
  • Offer optional Redis-backed batch jobs with streamed ZIP downloads for multi-image workloads.
  • Bound processing concurrency and input/output sizes, and apply SSRF defenses before fetching remote sources.
  • Keep client integration flexible with TypeScript and Python clients, a CLI, and a React image component.

What the implementation shows

  • The documented API supports JPEG, PNG, WebP, and AVIF output plus Accept-based format selection.
  • Security controls include signed URLs, scoped API keys, exact-origin CORS, and public-address checks for remote images.
  • The repository provides Docker and monitoring starting points alongside the API and client examples.
Explore the source on GitHub