Cloudflare Hono Template Commands
Specialized commands for building edge-first applications with Cloudflare Workers and Hono.
Overview
The Cloudflare template provides 10 commands optimized for edge computing, serverless APIs, and Cloudflare's ecosystem of services.
Available Commands
API Development
add-api-route- Create RESTful API endpoints with Honoadd-middleware- Add custom middleware for request processingimplement-queue- Set up queue processing with Cloudflare Queues
Storage & Data
add-r2-storage- Configure R2 object storage for filessetup-database- Set up D1 SQLite database
Infrastructure
add-worker-cron- Schedule recurring tasks with Cron Triggerssetup-analytics- Integrate Cloudflare Analyticssetup-auth- Implement authentication (JWT, OAuth)
Deployment
deploy-worker- Deploy to Cloudflare Workersdeploy- Full deployment pipeline
Usage Examples
Creating an API
bash
/template add-api-route /api/users GET,POST,PUT,DELETE
/template add-middleware rate-limiting
/template add-middleware corsSetting Up Storage
bash
/template add-r2-storage user-uploads
/template setup-database user-dataAuthentication Setup
bash
/template setup-auth jwt
/template add-middleware auth-requiredDeployment
bash
/template deploy-worker production
/template setup-analyticsKey Features
Edge-First Architecture
All commands generate code optimized for edge runtime:
- Minimal cold starts
- Global distribution
- Low latency responses
Cloudflare Services Integration
Commands integrate seamlessly with:
- Workers KV for session storage
- R2 for object storage
- D1 for SQL databases
- Queues for async processing
- Analytics for monitoring
Type Safety
- Full TypeScript support
- Hono's type-safe routing
- Generated types for all services
Best Practices
- Start with API Routes: Define your API structure first
- Add Middleware Early: Security and CORS from the beginning
- Use R2 for Files: Don't store files in KV
- Monitor Performance: Enable analytics early
- Test Locally: Use
wrangler devfor local testing
Common Workflows
Building a REST API
bash
/template add-api-route /api/auth/login POST
/template add-api-route /api/auth/logout POST
/template setup-auth jwt
/template add-middleware auth-requiredFile Upload System
bash
/template add-r2-storage uploads
/template add-api-route /api/upload POST
/template add-middleware file-size-limitBackground Processing
bash
/template implement-queue email-queue
/template add-worker-cron cleanup-job "0 2 * * *"Integration with Core Prompts
Use Cloudflare commands with core Orchestre prompts:
bash
# Plan the architecture
/orchestrate "Build image processing API"
# Implement with template commands
/template add-api-route /api/images/process POST
/template add-r2-storage processed-images
/template implement-queue image-processing
# Review and document
/review
/document-feature "Image processing pipeline"