
cloudflare-workers-api
by onichandame
a zap-fast task management system with full privacy
SKILL.md
name: cloudflare-workers-api description: Build and deploy comprehensive Cloudflare Workers with SvelteKit API routes, D1 database, KV storage, and R2 object storage integration for production serverless applications. license: MIT scope: project
Cloudflare Workers API Development
When to use this skill
When implementing production-grade backend APIs using Cloudflare Workers with SvelteKit, including complex authentication patterns, database operations, session management, file storage integrations, and comprehensive error handling.
Overview
This skill provides comprehensive guidance for building serverless APIs with Cloudflare Workers and SvelteKit. The content is organized into focused sub-skills for progressive learning:
🏗️ Core Architecture
- Project structure and environment configuration
- API route patterns with SvelteKit
- TypeScript setup and type definitions
🔐 Authentication & Security
- Session-based authentication with KV storage
- Challenge-response authentication
- Security middleware patterns
🗄️ D1 Database Operations
- Schema management with Drizzle ORM
- Database client setup and utilities
- Advanced querying and pagination
📁 R2 Object Storage
- Presigned URL generation (AWS Signature v4)
- File management operations
- Upload/download API routes
🚨 Error Handling & Logging
- Comprehensive error handlers
- Structured logging patterns
- API error response standards
⚡ Performance & Testing
- Caching strategies
- API integration testing
- Production deployment best practices
Quick Start Guide
- Project Setup: Start with Core Architecture for proper project structure
- Authentication: Implement security patterns using the Authentication module
- Database: Add data persistence with D1 Database operations
- Storage: Integrate file handling with R2 Storage
- Production: Apply Performance & Testing patterns for deployment
Prerequisites
- Node.js 18+ and npm/yarn
- Cloudflare account with Workers, D1, KV, and R2 enabled
- SvelteKit project setup knowledge
- TypeScript proficiency
- Basic understanding of serverless concepts
Development Workflow
# Install dependencies
npm install @sveltejs/adapter-cloudflare drizzle-orm
# Set up Cloudflare bindings
# See architecture/ for detailed environment setup
# Run locally
npm run dev
# Deploy to production
npm run build
npx wrangler deploy
Key Benefits
- Production Ready: Battle-tested patterns for enterprise applications
- Type Safe: Full TypeScript coverage with comprehensive type definitions
- Secure: Zero-knowledge architecture with client-side encryption options
- Scalable: Built for high-traffic applications with proper caching strategies
- Maintainable: Modular structure following OpenCode skill factory patterns
Navigation Tips
- Each sub-skill is self-contained and can be loaded independently
- Progress sequentially from architecture to deployment
- Cross-references between modules for related concepts
- All code examples are production-tested and ready to implement
Get started with Core Architecture or jump to any specific module based on your needs.
Score
Total Score
Based on repository quality metrics
SKILL.mdファイルが含まれている
ライセンスが設定されている
100文字以上の説明がある
GitHub Stars 100以上
3ヶ月以内に更新がある
10回以上フォークされている
オープンIssueが50未満
プログラミング言語が設定されている
1つ以上のタグが設定されている
Reviews
Reviews coming soon