Photos CDN API

Node.js API Sandbox

Zero-SDK Edge Optimized Dynamic Image Delivery Platform

ArangoDB Collections
R2 Objects Cached
ArangoDB Queue
Latest Match

Dynamic Request Sandbox

Test Scenarios (Semantic Presets):
W
H
Quick Presets

Client-Side Delivery Response

HTTP Status
Execution Time
X-Similarity-Score
X-Async-Generated
Cache-Control
Evaluated Match Document

Decoded Blurhash (32x32 DCT grid)

LQIP
Serving Low-Quality Placeholder
CDN Response
Open Raw Edge CDN Redirect URL

ArangoDB: Images Collection Vector Storage

Stores image metadata along with 128-dimensional dense vectors (using gemini-embedding-2)

SELECT A RECORD TO INSPECT VECTORS
Key / ID
Preview
Prompt Context
Seed
No records found matching this category.
Seeding or loading documents...
Vector Inspector
Semantic Prompt

Seed: Storage: Cloudflare R2
Dense Embeddings Index (10-dim Vector)

ArangoDB: Native DB-Backed Queue Engine

A high-performance database-backed queue processing engine. Triggers direct Gemini image generation and optimizes resolutions dynamically when similarity drops below 0.85.

Queue is currently empty

Execute a semantic request in the playground with a low similarity match to trigger background tasks!

srcset Endpoint & Respond-Async

GET /api/cdn/srcset returns a ready-to-use srcset payload for native browser lazy loading. Add Prefer: respond-async header to get a non-blocking 202 response with a poll URL.

srcset Tester

Response

similarity: Polling every 3s...

Default src

Key / Format

srcset


                  

sizes

Ready-to-use HTML


                  

Async Job:

Poll URL:

Fallback image served while generating. Result auto-updates when ready.

Integration Examples


fetch('/api/cdn/srcset?text=sunset+beach&output=webp')
  .then(r => r.json())
  .then(({ src, srcset, sizes, alt }) => {
    img.src = src;
    img.srcset = srcset;
    img.sizes = sizes;
    img.alt = alt;
    img.loading = 'lazy';
  });


const res = await fetch('/api/cdn/srcset?text=sunset+beach', {
  headers: { 'Prefer': 'respond-async' }
});
if (res.status === 202) {
  const { jobId, fallback } = await res.json();
  const pollUrl = res.headers.get('Location');
  // Show fallback image immediately
  img.src = fallback.src;
  // Poll for real result
  const poll = setInterval(async () => {
    const r = await fetch(pollUrl);
    if (r.status === 200) {
      const data = await r.json();
      img.srcset = data.srcset;
      img.src = data.src;
      clearInterval(poll);
    }
  }, 3000);
}

System Configuration Store

Manage third-party integrations and storage engines. All variables below are fetched from and stored directly in the ArangoDB Settings collection.

Semantic Embedding Engine

Used to extract unit-length dense 128-dimensional semantic vectors using the state-of-the-art gemini-embedding-2 model.

On-Demand Text-to-Image Generation

Provider fallback chain: Gemini → Cloudflare AI → Pollinations.ai (free) → HuggingFace → source image

Uses gemini-2.5-flash-image for image generation.

Uses stable-diffusion-xl-lightningstable-diffusion-xl-base-1.0.

Uses FLUX.1-schnellstable-diffusion-xl-base-1.0. Pollinations.ai (#3) is always free with no key.

Fallback Image Providers

Used when no matching image exists in the database. Chain order: Pexels → Unsplash → static.photos → Picsum → classic seeds.

Free tier: 200 req/hr. Get key ↗

Free tier: 50 req/hr. Get key ↗

High-res wallpapers. Get key ↗

Editors-choice photos. Free tier: 100 req/min. Get key ↗

Cloudflare R2 Object Storage

Public domain mapped to your R2 bucket. Uploaded variants are served as {cdnDomain}/{resolution}/{key}.jpg.

Used to sign dynamic image uploads on Edge CDN nodes using AWS SigV4 chunked signing algorithms.

Settings persisted successfully in ArangoDB!

Request Execution Flow (Step-by-Step Lifecycle)

1. Interception

Parse URI parameters natively. Verify format, seed, & categorization.

2. Vector Evaluation

Formulate prompt vector via Worker AI. Query ArangoDB AQL cursor.

3. Async Worker

If Similarity < 0.85, enqueue KV Job. Generate, upload R2, map vector.

4. Delivery & Edge

Render Blurhash metadata OR 302 Redirect to optimized Cloudflare Image Resizing CDN.

Live Output Logs

Auto-scrolling
Waiting for pipeline requests...