OptStuff

What is OptStuff?

OptStuff is a secure image optimization API that resizes, compresses, and converts images on-the-fly with signed URL security and multi-tenant support.

OptStuff is a secure, high-performance image optimization API designed for developers and teams who need to deliver optimized images at scale with fine-grained access control.

Point your image URLs through OptStuff's API endpoint, and it delivers optimized images with the right format, size, and quality — all controlled via URL parameters.

Quick Example

Turn any image into an optimized, resized WebP — with one signed URL. Assume your OptStuff deployment is https://images.example.com and your project slug is my-blog:

GET https://images.example.com/api/v1/my-blog/w_800,q_80,f_webp/cdn.example.com/photo.jpg?key=pk_...&sig=...&exp=<future-unix-timestamp>

In this URL:

  • https://images.example.com is your OptStuff deployment endpoint
  • my-blog is your project slug
  • cdn.example.com/photo.jpg is the source image URL without protocol

Generate it server-side in a few lines:

import { generateOptStuffUrl } from "@/lib/optstuff-core";

const url = generateOptStuffUrl(
  "https://cdn.example.com/photo.jpg",
  { width: 800, quality: 80, format: "webp" },
  86400,
);

Key Features

  • On-the-fly Optimization — Resize, format conversion (WebP, AVIF), and quality adjustment via URL parameters
  • Signed URL Security — HMAC-SHA256 signatures prevent unauthorized access
  • Multi-tenant Architecture — Teams → Projects → API Keys hierarchy
  • Domain Whitelisting — Control allowed image sources and referer domains
  • Encrypted Key Storage — AES-256-GCM encryption for API keys at rest
  • Rate Limiting — Configurable per-minute and per-day limits per API key
  • Usage Analytics — Request logs, bandwidth tracking, and top images statistics

How It Works

  1. Create a Project — Set up a project in the dashboard
  2. Generate an API Key — Get your public/secret key pair
  3. Sign URLs — Use the secret key to sign image request URLs server-side
  4. Make Requests — Send signed requests to the OptStuff API
  5. Get Optimized Images — Receive optimized images with caching headers

Use Cases

ScenarioHow OptStuff Helps
Web ApplicationsServe appropriately sized images for different screens; convert to modern formats (WebP, AVIF)
Content DeliveryIntegrate with your CDN for edge-cached, optimized images
E-commerceThumbnail generation, zoom-ready images, consistent catalog dimensions
User-Generated ContentResize, compress, and convert user uploads to web-friendly formats

Technical Specifications

SpecificationDetails
EncryptionAES-256-GCM with HKDF key derivation
SigningHMAC-SHA256
Image EngineIPX (powered by Sharp)
Supported Input FormatsJPEG, PNG, WebP, AVIF, GIF
Supported Output FormatsJPEG, PNG, WebP, AVIF
CachingAggressive cache headers for CDN compatibility

Pricing

OptStuff is designed to run on serverless infrastructure at minimal cost. For a full breakdown of the per-request cost structure and pricing strategy, see Cost Analysis & Pricing Strategy.

Explore the Docs

Last updated on

On this page