Get started
Cloudflare Image Hosting

Cloudflare Image Hosting

Deploy a serverless image hosting service on Cloudflare Workers with R2 storage, KV metadata, custom domain support, file management, and hotlink protection.
#Produtividade#Design#Produto
Avaliação
São necessárias mais avaliações
Vendas
1
Como usar
Baixar

Cloudflare Image Hosting

Deploy a production-ready, serverless image hosting service on Cloudflare Workers with R2 object storage, KV metadata, custom domain support, file management, and hotlink protection.

This Agent Skill helps developers, indie hackers, bloggers, and small teams build their own image hosting service without running a VPS, database server, or traditional backend.

What This Agent Does

Cloudflare Image Hosting provides a practical deployment playbook for creating a self-hosted image hosting system using Cloudflare's serverless stack.

It guides users through:

  • Creating a Cloudflare Workers-based image hosting service
  • Storing uploaded images in Cloudflare R2
  • Using Cloudflare KV for metadata or lightweight state
  • Configuring custom image domains
  • Setting up upload endpoints and public image URLs
  • Adding file management and basic admin workflows
  • Applying hotlink protection and safe access rules
  • Choosing between a standalone Worker deployment and integration into an existing Astro site

Key Capabilities

1. Serverless Image Hosting

Build an image hosting service that runs on Cloudflare Workers and stores files in R2. No VPS, no Docker server, and no database maintenance required.

2. R2 Object Storage Integration

Use Cloudflare R2 as the image storage backend. R2 is well suited for blogs, documentation sites, personal portals, and small-to-medium traffic content sites.

3. KV Metadata Support

Use Cloudflare KV for lightweight metadata, configuration, or file index storage when needed.

4. Custom Domain Support

Configure a branded image domain such as:

https://img.example.com/image-key.jpg

This makes the hosted images suitable for blogs, CMS systems, documentation sites, and public-facing projects.

5. File Management Workflow

The skill covers practical management patterns for uploaded images, including naming, storage paths, public URL generation, and basic operational checks.

6. Hotlink Protection

Add basic anti-hotlinking logic to prevent uncontrolled third-party embedding and bandwidth abuse.

7. Two Deployment Modes

The skill supports two common architectures.

Mode A: Standalone Worker

Best for users who want a dedicated image hosting service shared by multiple sites.

Typical use cases:

  • Personal image hosting service
  • Blog image CDN
  • Shared image storage for multiple websites
  • Lightweight public file hosting

Mode B: Embedded Astro Integration

Best for users who already have an Astro site deployed on Cloudflare and want image upload endpoints inside the existing project.

Typical use cases:

  • Astro blog with image uploads
  • Decap CMS media integration
  • Personal tech portal
  • Static site with server-side upload endpoints

Who This Is For

This Agent Skill is useful for:

  • Developers who want a self-hosted image hosting solution
  • Bloggers who need stable image URLs
  • Indie hackers building personal or product sites
  • Teams using Cloudflare Workers and R2
  • Astro users who want image upload support
  • Users replacing third-party image hosting platforms
  • People who prefer serverless infrastructure over VPS maintenance

Example Use Cases

Personal Blog Image Hosting

Create a dedicated image domain for blog posts and documentation images.

https://img.example.com/blog/cover-image.webp

CMS Media Upload Backend

Connect image upload endpoints to a CMS workflow such as Decap CMS or a custom admin panel.

Static Site Asset Hosting

Host images separately from the main website while keeping the infrastructure simple and cheap.

Multi-Site Image Storage

Use one Cloudflare R2 bucket and Worker endpoint to serve images across multiple small sites.

Architecture Overview

A typical standalone deployment looks like this:

User / Admin UI
      ↓
Cloudflare Worker Upload API
      ↓
Cloudflare R2 Bucket
      ↓
Public Image URL via Custom Domain

An embedded Astro deployment looks like this:

Astro Site
  ├─ Static Frontend
  ├─ /api/image-upload
  └─ Cloudflare Adapter
        ↓
   Cloudflare Worker Runtime
        ↓
   R2 Bucket + KV Namespace

External Service Requirements

Users need to prepare the following services before using this Agent Skill:

  • Cloudflare account
  • Cloudflare Workers access
  • Cloudflare R2 object storage
  • Cloudflare KV namespace access
  • Wrangler CLI
  • Node.js runtime for local development and deployment

Optional requirements:

  • Custom domain managed by Cloudflare
  • Astro project if using embedded Astro mode
  • Decap CMS or another CMS if using CMS upload integration

What Users Will Learn

After using this Agent Skill, users should understand how to:

  • Create and bind R2 buckets to Workers
  • Configure KV namespaces
  • Deploy a Worker with Wrangler
  • Route a custom domain to the Worker
  • Generate stable public image URLs
  • Implement upload endpoints
  • Handle CORS for browser-based uploads
  • Integrate image uploads into an Astro site
  • Avoid common Cloudflare Pages and Worker routing mistakes

Why Use This Instead of a Traditional Image Host

Traditional image hosting services can be convenient, but they often introduce vendor lock-in, bandwidth pricing surprises, limited control, or branding constraints.

This setup gives users:

  • Direct control over storage
  • Cloudflare edge delivery
  • Custom domain support
  • Serverless operations
  • No VPS maintenance
  • Simple deployment model
  • Easy integration with developer workflows

Limitations

This Agent Skill is a deployment and operations guide. It does not include a managed hosted service.

Users are responsible for:

  • Their own Cloudflare account
  • Their own domain and DNS configuration
  • Their own R2 storage costs if usage exceeds free tier limits
  • Securing any private admin upload interface
  • Following Cloudflare's current platform limits and terms

Recommended Tags

cloudflare
workers
r2
image-hosting
serverless
devops
storage
automation

Suggested Agent Card

Title

Cloudflare Image Hosting

Short Description

Deploy a serverless image hosting service on Cloudflare Workers with R2 storage, KV metadata, custom domain support, file management, and hotlink protection.

Category

Developer Tools / DevOps / Cloud Infrastructure

Monetization Recommendation

Download model, one-time purchase.

Suggested first listing price:

$9.99

Setup Summary

The typical flow is:

1. Create Cloudflare R2 bucket
2. Create KV namespace if metadata is needed
3. Configure Wrangler project bindings
4. Implement or adapt the Worker upload endpoint
5. Deploy with Wrangler
6. Configure custom domain route
7. Test upload and public image access
8. Add hotlink protection if needed

Verification Checklist

Users can verify the deployment by checking:

  • Worker deploys successfully with Wrangler
  • R2 bucket is bound to the Worker
  • KV namespace is bound if used
  • Upload endpoint accepts a test image
  • Public image URL returns HTTP 200
  • Custom domain resolves correctly
  • CORS preflight works for browser uploads
  • Hotlink protection does not block allowed domains

Support Notes

Common issues this Agent Skill helps troubleshoot:

  • R2 binding name mismatch
  • KV namespace ID mismatch
  • Worker deployed but custom domain not routing
  • Browser upload blocked by CORS
  • Cloudflare Pages static hosting returning 404 for API routes
  • Astro dynamic routes accidentally prerendered
  • CMS upload endpoint using the wrong base URL

Summary

Cloudflare Image Hosting is a practical Agent Skill for deploying a lightweight, serverless image hosting stack on Cloudflare. It is best suited for developers who want ownership, low operating cost, custom domains, and a simple Cloudflare-native workflow for hosting images.


APIs externas

Cloudflare Account · Wrangler CLI · Node.js · Domain