hono-r2-integration

Integrate Cloudflare R2 storage into Hono TypeScript apps on Workers.

2|Updated Dec 5, 2025
One-click install
npx skills add https://github.com/AgentiveCity/SkillFactory --skill hono-r2-integration
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hono-r2-integration
Source: https://github.com/AgentiveCity/SkillFactory/tree/main/.claude/skills/hono-r2-integration
Command: npx skills add https://github.com/AgentiveCity/SkillFactory --skill hono-r2-integration

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Designing, setting up, or refactoring Cloudflare R2 object storage usage in Hono + TypeScript apps running on Cloudflare Workers/Pages involves bucket bindings, upload/download flows, signed URLs, and folder-like organization. This can be intricate and error-prone. This Skill streamlines the integration, ensuring safe and efficient R2 usage.

Core Features & Use Cases

  • Automated R2 Binding & Typing: Wire R2 bucket bindings into Hono apps (c.env.BUCKET) and ensure type-safe access via a shared Env interface.
  • Upload & Download Flows: Design and implement secure upload/download/delete flows from Hono routes, handling content types, metadata, and secure key naming.
  • Structured Storage Services: Create service modules encapsulating R2 operations, with key naming conventions (e.g., users/<userId>/avatars) and optional presigned URL patterns.

Quick Start

Store user uploads in R2 from this Hono API, add endpoints to upload and download files using Cloudflare R2, and organize R2 keys by user/tenant in my Workers app.

Frequently Asked Questions about hono-r2-integration

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I upload files to Cloudflare R2 from a Hono backend?

Upload files to Cloudflare R2 from Hono by binding an R2 bucket in your wrangler.toml, accessing it via `c.env.BUCKET` in typed Hono routes, and implementing multipart form handling with content-type detection. The Skill provides structured upload flows with secure key naming and metadata support.

Can I organize files in Cloudflare R2 with folder-like structure?

Cloudflare R2 uses flat key namespacing, but you can organize files with folder-like prefixes (e.g., `users/<userId>/avatars`). This Skill implements key naming conventions and prefix-based organization patterns to simulate folder hierarchies within R2 object storage.

What's the best way to set up R2 bindings and type safety in a Hono + TypeScript app?

Define a strict `Env` interface with your R2 BUCKET binding in Hono's typed context. This Skill streamlines binding configuration, provides type-safe environment access across routes, and ensures compile-time safety for R2 operations in Workers/Pages apps.

How do I implement download and delete operations for R2 objects in Hono routes?

Implement download and delete flows by creating service modules that encapsulate R2 operations and exposing them through Hono route handlers. This Skill provides patterns for secure object retrieval, deletion, and content-type handling within Worker constraints.

Does Hono work with Cloudflare R2 on Workers and Pages?

Yes, Hono runs on Cloudflare Workers and Pages and integrates directly with R2 bindings. This Skill handles R2 integration specifically for Hono + TypeScript apps deployed to the Cloudflare platform, including presigned URL patterns and strict environment typing.

What are the limitations of presigned URLs and R2 access within Worker constraints?

Cloudflare Workers have specific request/response limits and execution timeouts that affect large file operations and presigned URL generation. This Skill documents patterns for working within Worker constraints while maintaining secure R2 access and efficient upload/download flows.