Repix
Built for developers
Default Presets
PRESETS env var.| Preset | Value | Use case |
|---|---|---|
xs | w=64,q=85 | Icons, favicons |
sm | w=128,q=85 | Small thumbnails |
md | w=256,q=85 | Cards, list items |
lg | w=512,q=85 | Gallery, detail views |
xl | w=1024,q=85 | Hero images, lightbox |
full | q=85 | Unresized, quality-only |
FAQ
How do I hide my image hosting domain?
Deploy Repix on your own domain (e.g. img.yourdomain.com). All image URLs will show your Repix domain—users see https://img.yourdomain.com/sm/path/to/image.jpg, not your S3, R2, or CDN origin. The source URL lives in the path, but the browser address bar and referrer show only your domain. Your storage backend stays hidden.
How do I prevent abuse?
Use several controls together: set ALLOW_CUSTOM_TRANSFORMS=false and define presets in PRESETS so only allowed transformations work. Lower IMAGE_MAX_WIDTH and IMAGE_MAX_HEIGHT (e.g. 1024) to cap output size. Reduce FETCH_TIMEOUT for slow or abusive origins. Set ALLOW_ORIGINAL_IMAGE=false to block unprocessed passthrough. Optionally restrict CORS_ORIGIN to your app's domain.
How do I make URLs clean?
Use presets instead of inline parameters. Compare https://img.yourdomain.com/sm/example.com/photo.jpg (clean) vs https://img.yourdomain.com/w=128,q=85/example.com/photo.jpg (verbose). Define short preset names in PRESETS for your common sizes and fits—e.g. thumb, card, hero—and use those in URLs.
I have many presets—how do I manage them?
Repix uses the PRESETS env var (JSON). Put it in .env for easier editing. For many presets, use a single-line JSON string or build it from a script:
# In .env
PRESETS='{"thumb":"w=200,h=200,fit=cover","card":"w=400,h=300,fit=cover","hero":"w=1200,h=600,fit=cover","avatar":"w=100,h=100,fit=cover,f=webp,q=85"}'
You can also keep a presets.json file and inject it: PRESETS=$(cat presets.json) before starting the server.
Can I use multiple image sources?
Yes. Repix fetches from any publicly accessible HTTPS URL. Use different domains in the path for each request: https://img.yourdomain.com/sm/cdn1.com/photo.jpg and https://img.yourdomain.com/sm/bucket.s3.amazonaws.com/other.png both work. SOURCE_PREFIX (default https://) is prepended to the path, so you can mix S3, R2, your CDN, and other origins in the same Repix instance. To restrict which origins are allowed, set SOURCE_HOSTNAME to a comma-separated list (e.g. cdn.example.com,images.example.com); when set, only those hostnames are accepted.

