📍 What are Cloudflare Workers?
Cloudflare Workers are serverless functions that run at the edge of Cloudflare's global network. Unlike traditional serverless platforms that run in specific regions, Workers execute in 200+ cities worldwide, providing unparalleled performance and global reach.
Key Benefits of Cloudflare Workers
- Zero Cold Starts - Always-on compute with sub-millisecond startup times
- Global Edge Network - Deploy to 200+ locations instantly
- Cost Effective - Pay only for execution time, not idle resources
- Developer Friendly - JavaScript/TypeScript runtime with familiar APIs
Cloudflare Workers vs. AWS Lambda
| Feature | Cloudflare Workers | AWS Lambda |
|---|---|---|
| Cold Start Latency | 0ms (always warm) | 100-5000ms |
| Global Locations | 200+ cities | ~20 regions |
| Runtime | V8 Isolate | Container-based |
| Free Tier | 100K requests/day | 1M requests/month |
🚀 Getting Started with Cloudflare Workers
Prerequisites
- Node.js 18+ installed
- Cloudflare account (free tier available)
- Basic JavaScript/TypeScript knowledge
Install Wrangler CLI
npm install -g wrangler
Authenticate with Cloudflare
wrangler auth login
Create Your First Worker
wrangler init my-first-worker
cd my-first-worker
Basic Worker Code
// src/index.js
export default {
async fetch(request, env, ctx) {
return new Response('Hello from Cloudflare Workers!', {
headers: { 'content-type': 'text/plain' },
});
},
};
Deploy Your Worker
wrangler deploy
⚙ï¸ Cloudflare Workers Runtime & APIs
Web APIs Support
Cloudflare Workers support a comprehensive set of Web APIs:
- Fetch API - Make HTTP requests
- Web Crypto API - Cryptographic operations
- Web Streams API - Stream processing
- URL API - URL parsing and manipulation
- Headers API - HTTP header management
Cloudflare-Specific APIs
- Cache API - Edge caching
- HTMLRewriter - HTML transformation
- WebSockets - Real-time communication
- Durable Objects - Stateful coordination
Example: Using Fetch API
export default {
async fetch(request, env, ctx) {
// Make an API call
const response = await fetch('https://api.example.com/data');
const data = await response.json();
return new Response(JSON.stringify(data), {
headers: { 'content-type': 'application/json' },
});
},
};
🗄️ D1 Database Integration
D1 is Cloudflare's serverless database, built on SQLite. It provides ACID transactions, relational data storage, and seamless integration with Workers.
Creating a D1 Database
# Create database
wrangler d1 create my-database
# Generate migration
wrangler d1 migrations create my-database create_users_table
Database Schema
-- migrations/0001_create_users_table.sql
CREATE TABLE users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
email TEXT UNIQUE NOT NULL,
name TEXT NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
Using D1 in Workers
export default {
async fetch(request, env, ctx) {
// Query the database
const { results } = await env.DB.prepare(
"SELECT * FROM users WHERE email = ?"
).bind('user@example.com').all();
return new Response(JSON.stringify(results), {
headers: { 'content-type': 'application/json' },
});
},
};
D1 Best Practices
- Use prepared statements to prevent SQL injection
- Implement connection pooling for high-traffic applications
- Use migrations for schema changes
- Monitor query performance with analytics
💾 KV Storage Guide
Cloudflare KV (Key-Value) is a global, low-latency key-value store that replicates data to all Cloudflare edge locations.
KV Operations
export default {
async fetch(request, env, ctx) {
const url = new URL(request.url);
if (request.method === 'PUT') {
// Store data
await env.MY_KV.put('key', 'value');
return new Response('Stored successfully');
}
if (request.method === 'GET') {
// Retrieve data
const value = await env.MY_KV.get('key');
return new Response(value || 'Not found');
}
return new Response('Method not allowed', { status: 405 });
},
};
KV Namespaces
# wrangler.toml
kv_namespaces = [
{ binding = "MY_KV", id = "your-kv-namespace-id" }
]
KV Use Cases
- Configuration - App settings and feature flags
- User Sessions - Session data storage
- Cache - Application-level caching
- Rate Limiting - Request throttling data
🚀 Deployment & Best Practices
Environment Configuration
# wrangler.toml
name = "my-worker"
main = "src/index.js"
compatibility_date = "2024-01-01"
[vars]
ENVIRONMENT = "production"
[[kv_namespaces]]
binding = "KV"
id = "your-kv-id"
[[d1_databases]]
binding = "DB"
database_name = "my-database"
database_id = "your-db-id"
Deployment Process
# Deploy to production
wrangler deploy
# Deploy to staging
wrangler deploy --env staging
Monitoring & Analytics
- Cloudflare Dashboard - Real-time metrics and logs
- Wrangler tail - Live log streaming
- Analytics Engine - Custom analytics and insights
Performance Optimization
- Minimize bundle size with code splitting
- Use caching strategies effectively
- Optimize database queries
- Implement proper error handling
🏢 Enterprise Implementation Comparison
Learn how leading companies implement Cloudflare Workers at scale. This interactive comparison shows real-world architectures, performance metrics, and implementation patterns.
| Company | Edge Delivery % | Architecture | Key Services |
|---|---|---|---|
|
🛍️
Shopify
|
100% | All-in Edge | Workers, Pages, KV |
|
💬
Discord
|
85-90% | Hybrid | CDN, Security, Workers |
|
⚙️
GitHub
|
95% | Hybrid | CDN, Security, DDoS |
|
📝
Notion
|
100% | All-in Edge | Workers, Pages, Durable Objects |
Workers Implementation Metrics
Key Architecture Patterns
🔄 Hybrid Approach
60% of implementations combine Cloudflare edge services with proprietary infrastructure for optimal performance and control.
🎯 All-in Strategy
40% run complete platforms on Cloudflare Workers, achieving 100% edge delivery with sub-second global response times.
🛡️ Security First
All implementations prioritize Cloudflare's enterprise security features including DDoS protection and bot management.
❓ Frequently Asked Questions
How do Cloudflare Workers compare to AWS Lambda?
Cloudflare Workers offer several advantages over AWS Lambda: zero cold starts (always warm), 200+ global locations vs Lambda's ~20 regions, and cost efficiency with pay-per-request pricing. Workers run in V8 isolates rather than containers, providing faster startup times and better performance for edge computing workloads.
What's the difference between KV and D1 storage?
KV (Key-Value) is optimized for high-read, low-write scenarios like caching, sessions, and configuration. D1 is a relational database perfect for complex queries, transactions, and structured data. Use KV for simple key lookups and D1 for SQL queries and relationships.
How do I handle authentication in Workers?
Use JSON Web Tokens (JWT) stored in encrypted cookies or Authorization headers. Validate tokens at the edge to reduce origin load. For session management, combine JWT with KV storage for fast lookups. Cloudflare Access provides enterprise SSO integration.
What's the best way to deploy Workers?
Use Wrangler CLI for development and GitHub Actions for CI/CD. Implement staging environments with preview deployments. Use Cloudflare Pages for full-stack applications combining Workers with static assets. Monitor performance with Cloudflare's analytics and set up alerts for errors.
⚡ Accelerate Development with Clodo Framework Automation
Building production-ready Cloudflare Workers applications requires extensive boilerplate code, consistent patterns, and reliable deployment processes. Manual development can take weeks for complex systems with multiple services. Clodo Framework eliminates this bottleneck through intelligent automation.
The Boilerplate Bottleneck
When building enterprise-scale applications, developers face repetitive tasks:
- 🔄 Service Scaffolding - Creating consistent project structures for 10+ services
- 🗄️ Database Setup - D1 migrations, schema definitions, and connection handling
- 💾 Storage Configuration - KV namespaces, R2 buckets, and cache strategies
- 🔐 Authentication & Security - JWT validation, rate limiting, CORS policies
- 📊 Monitoring & Logging - Structured logging, error tracking, performance metrics
- 🚀 Deployment Automation - Multi-environment configs, CI/CD pipelines, rollback strategies
Five Core Pillars of Clodo Framework
Clodo Framework is built on five foundational concepts that work together to eliminate boilerplate:
- 🔄 Automation - Input Collection → Code Generation → Configuration → Validation → Deployment. What takes days manually happens in minutes.
- 🎼 Orchestration - Manage multi-domain services with automatic dependency management, cross-service communication, and environment consistency across dev/staging/prod.
- ⚙️ Configuration - Convention over Configuration with sensible defaults for 80% of cases, plus environment-specific overrides and validation to prevent "works on my machine" issues.
- ✅ Validation - Pre-deploy checks, runtime validation, deployment verification, and continuous monitoring to catch issues before production.
- 📏 Consistency - Standardized code patterns, naming conventions, security standards, and auto-generated documentation across all services.
⚡ Get Code Validator Tools
Download our validator script to check code examples and validate your Cloudflare Workers setup
Quick Start by Experience Level
Whether you're new to Cloudflare Workers or managing enterprise deployments, Clodo adapts to your needs:
🌱 Newbie (First Time with Cloudflare Workers)
# Install and create your first service with interactive prompts
npm install -g @tamyla/clodo-framework
npx clodo-service create
# Follow the guided setup - no Cloudflare knowledge needed!
# Framework generates: database, API endpoints, deployment scripts, documentation
📚 Intermediate (Know Cloudflare Basics)
# Create a specific service type with your domain
npx clodo-service create --type data-service --name my-api --domain myapp.com
# Deploy with built-in validation
npx clodo-service validate
npx clodo-service deploy --environment production
🚀 Expert (Enterprise Orchestration)
import { MultiDomainOrchestrator } from '@tamyla/clodo-framework/orchestration';
// Programmatic multi-service orchestration
const orchestrator = new MultiDomainOrchestrator();
await orchestrator.deployMultiple([
{ path: './api', domain: 'api.example.com' },
{ path: './auth', domain: 'auth.example.com' },
{ path: './files', domain: 'files.example.com' }
]);
Intelligent Service Generation (28+ Files)
Clodo Framework generates production-ready services with 28+ pre-configured files, smart defaults, and environment-specific configurations:
Create a Complete API Service
# Generate a REST API service with authentication
npx clodo-service create --type data-service --name user-management --domain users.myapp.com
# Auto-generates:
# - Project structure with source and tests
# - Authentication middleware (JWT validation)
# - D1 database integration with migrations
# - CRUD endpoints with input validation
# - Error handling and logging
# - Unit and integration tests
# - Deployment configuration
# - Environment-specific configs (dev/staging/prod)
Multi-Service Architecture
// Orchestrate multiple services across domains
import { Clodo } from '@tamyla/clodo-framework';
const services = [
{ type: 'data-service', name: 'users', domain: 'users.myapp.com' },
{ type: 'data-service', name: 'products', domain: 'products.myapp.com' },
{ type: 'api-gateway', name: 'gateway', domain: 'api.myapp.com' }
];
for (const service of services) {
await Clodo.createService(service);
await Clodo.deploy({ servicePath: `./${service.name}`, environment: 'production' });
}
What Gets Generated
- Source Code: Service handlers, middleware, utilities, types
- Database: D1 migrations, schema validation, queries
- Security: Authentication, authorization, validation schemas
- Testing: Unit tests, integration tests, test fixtures
- Configuration: Environment configs, secrets management, build config
- Deployment: Wrangler config, CI/CD scripts, monitoring setup
- Documentation: API docs, architecture guide, deployment guide
Intelligent Code Generation
Clodo analyzes your requirements and generates contextually appropriate code:
Generated User Authentication Service
// Auto-generated by Clodo Framework
import { Hono } from 'hono';
import { cors } from 'hono/cors';
import { jwt } from 'hono/jwt';
import { z } from 'zod';
const app = new Hono();
// Auto-generated middleware stack
app.use('/api/*', cors({
origin: ['https://yourapp.com'],
credentials: true
}));
app.use('/api/protected/*', jwt({ secret: 'your-secret' }));
// Auto-generated validation schemas
const userSchema = z.object({
email: z.string().email(),
name: z.string().min(2),
password: z.string().min(8)
});
// Auto-generated CRUD endpoints
app.post('/api/users', async (c) => {
const body = await c.req.json();
const validated = userSchema.parse(body);
// Auto-generated database operations
const result = await c.env.DB.prepare(
'INSERT INTO users (email, name, password_hash, created_at) VALUES (?, ?, ?, ?)'
).bind(
validated.email,
validated.name,
await hashPassword(validated.password),
new Date().toISOString()
).run();
return c.json({ id: result.meta.last_row_id });
});
app.get('/api/users/:id', async (c) => {
const id = c.req.param('id');
const user = await c.env.DB.prepare(
'SELECT id, email, name, created_at FROM users WHERE id = ?'
).bind(id).first();
return user ? c.json(user) : c.notFound();
});
export default app;
Automated Deployment Pipeline
Clodo Framework handles the entire deployment lifecycle:
One-Command Deployment
# Deploy all services to production
clodo deploy --environment production --services all
# This automatically:
# - Runs pre-flight checks
# - Builds optimized bundles
# - Updates database migrations
# - Deploys to Cloudflare
# - Runs integration tests
# - Updates monitoring dashboards
Multi-Environment Management
# Deploy to staging first
clodo deploy --environment staging --services user,product
# Promote to production after testing
clodo promote --from staging --to production
# Rollback if issues detected
clodo rollback --environment production --version previous
Development Acceleration Metrics
Time Savings with Clodo Automation
Consistency & Quality Assurance
Every generated service follows enterprise patterns:
- 🔒 Security First - Built-in authentication, authorization, and input validation
- 📊 Observability - Structured logging, metrics, and error tracking
- 🧪 Testing - Unit tests, integration tests, and performance benchmarks
- 📚 Documentation - Auto-generated API docs and deployment guides
- 🔄 DevOps - CI/CD pipelines, monitoring, and automated scaling
From Manual to Automated: A Comparison
| Task | Manual Development | Clodo Automation |
|---|---|---|
| Create API Service | 2-3 days | 5 minutes |
| Setup Authentication | 1-2 days | Auto-generated |
| Database Integration | 1 day | Auto-configured |
| Deploy to Production | 4-6 hours | 2 minutes |
| Setup Monitoring | 2-3 days | Auto-instrumented |
Ready to Accelerate Your Development?
Stop wasting weeks on boilerplate. Generate production-ready services in minutes with Clodo Framework's intelligent automation.
🎯 Why Choose Clodo Framework?
While Cloudflare Workers are powerful, building production applications requires significant infrastructure. Clodo Framework provides the missing pieces:
Ready to Build Production SaaS?
Clodo Framework reduces development time from months to weeks and costs by 60%. Get started with enterprise-grade components today.
Clodo Framework builds on Cloudflare Workers by providing five core pillars that address the gaps between serverless functions and production SaaS applications.
The Five Pillars of Clodo
1. Automation (Input → Output)
Transform requirements into production-ready code automatically:
- Parse user requirements and specifications
- Generate 28+ production files (handlers, middleware, tests, configs)
- Create database schemas with migrations
- Setup authentication and authorization patterns
- Generate API documentation automatically
2. Orchestration (Multi-Service Coordination)
Manage complex architectures with service dependencies:
- Multi-domain support for service distribution
- Service dependency resolution and deployment ordering
- Cross-service communication patterns
- API Gateway orchestration
- Load balancing and failover strategies
3. Configuration (Convention Over Configuration)
Smart defaults with environment-specific overrides:
- Sensible defaults for development and production
- Environment-specific configurations (dev/staging/prod)
- Secrets management integration
- Feature flags and gradual rollouts
- Zero-config deployment to Cloudflare
4. Validation (Pre-Deploy Quality Checks)
Comprehensive validation at every stage:
- Syntax Validation: TypeScript, linting, code quality
- Schema Validation: Database schemas, API contracts
- Security Validation: Authentication rules, authorization checks
- Integration Validation: Service dependencies, cross-service contracts
- Performance Validation: Cold starts, memory usage, startup time
5. Consistency (Unified Patterns Across Services)
All services follow identical conventions and patterns:
- Naming Conventions: Variables, functions, files follow standard patterns
- Code Patterns: Error handling, logging, security patterns are unified
- Security Standards: All services implement the same security measures
- Testing Patterns: Unit and integration tests use same frameworks
- Documentation: All services have consistent API and architecture docs
What Gets Generated
When you create a new service with Clodo, you get 28+ production-ready files:
- Source Code: Handlers, middleware, utilities, type definitions, services
- Database: D1 migrations, schema validation, ORM queries
- Security: JWT authentication, role-based access, input validation
- Testing: Unit tests, integration tests, fixtures, mocks
- Configuration: Environment configs, secrets, build settings
- Deployment: Wrangler config, CI/CD scripts, monitoring setup
- Documentation: API docs, architecture guide, deployment guide
Installation & Setup
Basic Installation
Choose the installation method that fits your workflow:
# For one-time use (npx - no installation required)
npx @tamyla/clodo-framework create
# For repeated use (install globally)
npm install -g @tamyla/clodo-framework
# For project-specific use (install locally)
npm install @tamyla/clodo-framework --save-dev
Environment Setup
Clodo Framework auto-detects your Cloudflare credentials, but you can configure explicitly:
# Initialize configuration interactively
npx clodo-service init-config
# Or set environment variables
export CLOUDFLARE_API_TOKEN=your_token
export CLOUDFLARE_ACCOUNT_ID=your_account_id
export CLOUDFLARE_ZONE_ID=your_zone_id
Verification
Confirm everything is working correctly:
# Check installation and version
npx clodo-service --version
# Test framework capabilities
npx clodo-service diagnose
# Validate your configuration
npx clodo-service validate-config
Available Tools & Commands
CLI Tools
- clodo-service - Main CLI for complete service lifecycle management
- clodo-simple - Streamlined CLI for basic operations and quick starts
- clodo-security - Security-focused operations and compliance checks
Essential Commands
# Service Creation & Management
npx clodo-service create # Interactive service creation
npx clodo-service create --help # Show all options
npx clodo-service validate # Validate service configuration
npx clodo-service update # Update existing service
# Deployment & Orchestration
npx clodo-service deploy # Deploy service to Cloudflare
npx clodo-service diagnose # Troubleshoot deployment issues
npx clodo-service assess # Capability assessment and reporting
# Utilities
npx clodo-service init-config # Initialize configuration
npx clodo-service list-types # Show available service types
npx clodo-service rollback # Rollback to previous version
Programmatic API
For advanced use cases, import the framework directly in your code:
// Simple operations
import { Clodo } from '@tamyla/clodo-framework';
await Clodo.createService({ name: 'my-api', type: 'data-service' });
await Clodo.deploy({ servicePath: './my-api', environment: 'production' });
await Clodo.validate({ servicePath: './my-api' });
// Advanced orchestration
import { ServiceOrchestrator } from '@tamyla/clodo-framework/service-management';
import { MultiDomainOrchestrator } from '@tamyla/clodo-framework/orchestration';
Usage Patterns by Real-World Scenario
Scenario 1: Building Your First Service
Perfect for developers new to Cloudflare Workers:
# Interactive creation with guided setup
npx clodo-service create
# Or programmatic creation
import { Clodo } from '@tamyla/clodo-framework';
await Clodo.createService({
name: 'user-service',
type: 'data-service',
domain: 'users.myapp.com',
withAuth: true,
withDatabase: true
});
Scenario 2: Multi-Environment Deployment
Deploy the same service across dev, staging, and production:
# Development (with debugging)
npx clodo-service deploy --environment development --debug
# Staging (with validation)
npx clodo-service validate
npx clodo-service deploy --environment staging
# Production (with extra checks)
npx clodo-service assess --service-path ./my-service
npx clodo-service deploy --environment production --dry-run
npx clodo-service deploy --environment production
Scenario 3: Managing Multiple Services
Orchestrate complex architectures with automatic dependency management:
import { MultiDomainOrchestrator } from '@tamyla/clodo-framework/orchestration';
const orchestrator = new MultiDomainOrchestrator();
// Deploy multiple services across different domains
await orchestrator.deployMultiple([
{ path: './services/api', domain: 'api.example.com' },
{ path: './services/auth', domain: 'auth.example.com' },
{ path: './services/files', domain: 'files.example.com' }
], {
environment: 'production',
validateDependencies: true,
orderedDeployment: true
});
Scenario 4: Customizing Generated Services
Extend generated services with custom business logic:
import { GenericDataService } from '@tamyla/clodo-framework/services';
import { SchemaManager } from '@tamyla/clodo-framework/schema';
import { Hono } from 'hono';
// Use framework components as a foundation
const service = new GenericDataService();
const schema = new SchemaManager();
// Add your custom endpoints
const app = new Hono();
app.post('/custom-logic', async (c) => {
// Your business logic here
return c.json({ success: true });
});
export default app;
Common Questions & Answers
Q: Can I import internal `dist/*` files directly?
A: No — always prefer public exports from the main package. Internal files may change between versions. If you need internal functionality exposed, request it explicitly and we'll evaluate adding it to the public API.
Q: Is the CLI intended for programmatic use?
A: No — the CLI is optimized for human use and automation scripts. For programmatic tasks, use the library exports directly. This gives you better error handling and doesn't spawn subprocesses.
Q: What's the difference between `clodo-service` and `clodo-simple`?
A: clodo-service provides full control and all options. clodo-simple provides a streamlined experience with smart defaults. Choose simple for quick setup, service for advanced customization.
Q: How do I handle multiple domains and services?
A: Use the MultiDomainOrchestrator for orchestrated deployments. It handles service dependencies, deployment ordering, and environment consistency automatically across all domains.
Q: What happens if deployment fails?
A: Framework automatically rolls back to the previous version. Check logs with npx clodo-service diagnose and validate configuration with npx clodo-service validate before re-deploying.
Q: How do I customize generated code without losing updates?
A: Generated code uses clear sections marking framework-generated vs. custom areas. Keep custom logic in separate files or marked blocks, and regenerate with npx clodo-service update when needed.
Service Types Available
Clodo Framework supports multiple service types to fit different use cases:
Data Service
Best for: CRUD operations, database-driven APIs, data management services
npx clodo-service create --type data-service --name user-api
# Generates:
# - D1 database integration with migrations
# - RESTful CRUD endpoints
# - Input validation with Zod schemas
# - Database connection pooling
# - Query optimization utilities
Authentication Service
Best for: User authentication, JWT token management, session handling
npx clodo-service create --type auth-service --name auth-api
# Generates:
# - JWT token generation and validation
# - Password hashing and verification
# - OAuth integration patterns
# - Rate limiting for auth endpoints
# - Secure session management
Content Service
Best for: Content management, file handling, asset delivery
npx clodo-service create --type content-service --name cms-api
# Generates:
# - Content upload and storage handlers
# - R2 bucket integration
# - Content versioning
# - Preview and publishing workflows
# - Asset optimization
API Gateway
Best for: Service orchestration, request routing, API aggregation
npx clodo-service create --type api-gateway --name api-gateway
# Generates:
# - Multi-service request routing
# - Request/response transformation
# - Cross-service communication
# - Load balancing patterns
# - Service health checks
Generic Service
Best for: Custom use cases, specialized requirements, experimentation
npx clodo-service create --type generic --name custom-service
# Generates:
# - Minimal boilerplate structure
# - Custom handler templates
# - Flexible configuration
# - Complete control over implementation
Structured Learning Path
Progress through five levels as you become more proficient with Clodo Framework:
Level 1: Getting Started (30 minutes)
- ✅ Install Node.js 18+ and npm
- ✅ Run
npx clodo-service create - ✅ Follow interactive prompts
- ✅ Deploy with
npx clodo-service deploy - ✅ Goal: Have a working Cloudflare service live
Level 2: Understanding Automation (1 hour)
- ✅ Explore the 28+ generated files
- ✅ Understand project structure and patterns
- ✅ Customize handlers and middleware
- ✅ Run
npx clodo-service validate - ✅ Goal: Understand what the framework generates and why
Level 3: Orchestration Basics (2 hours)
- ✅ Create multiple services
- ✅ Deploy to dev, staging, and production
- ✅ Use
npx clodo-service validatein different environments - ✅ Learn the programmatic API
- ✅ Goal: Manage multi-service applications confidently
Level 4: Advanced Orchestration (4+ hours)
- ✅ Multi-domain deployments with MultiDomainOrchestrator
- ✅ Custom service types and templates
- ✅ Integration with CI/CD pipelines
- ✅ Advanced monitoring and diagnostics
- ✅ Goal: Deploy enterprise-scale applications
Level 5: Expert Customization (Ongoing)
- ✅ Extend framework components for custom needs
- ✅ Build and publish custom service templates
- ✅ Contribute improvements to the framework
- ✅ Mentor other developers in your organization
- ✅ Goal: Become a Clodo Framework expert and contributor
Cost & Licensing
Framework Licensing
- License: MIT (free and open source)
- Usage: Commercial and personal use allowed
- Support: Community-driven via GitHub
- Cost: $0 (framework itself)
Cloudflare Services Pricing
The framework is free, but Cloudflare charges for the services you deploy:
- Workers: $0.30 per million requests (first 10 million free/month)
- D1 Database: $0.75 per GB stored + $1.25 per million queries
- KV Storage: $0.50 per million operations
- R2 Storage: $0.015 per GB stored
- Domains: Standard Cloudflare pricing varies by plan
Cost Optimization Tips
- Start with Cloudflare's free tier for development and testing
- Use KV for caching to reduce D1 database queries
- Optimize cold starts by monitoring performance metrics
- Use appropriate caching strategies for static content
- Monitor usage regularly and set up billing alerts
CI/CD Integration
Integrate Clodo Framework into your continuous integration and deployment pipelines:
GitHub Actions Example
name: Deploy Clodo Service
on:
push:
branches: [ main ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install Clodo Framework
run: npm install -g @tamyla/clodo-framework
- name: Validate Service
run: npx clodo-service validate
- name: Deploy to Staging
run: npx clodo-service deploy --environment staging
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
- name: Run Integration Tests
run: npm test
- name: Deploy to Production
if: success()
run: npx clodo-service deploy --environment production
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
GitLab CI Example
stages:
- validate
- deploy-staging
- deploy-production
validate:
stage: validate
image: node:18
script:
- npm install -g @tamyla/clodo-framework
- npx clodo-service validate
deploy-staging:
stage: deploy-staging
image: node:18
script:
- npm install -g @tamyla/clodo-framework
- npx clodo-service deploy --environment staging
environment:
name: staging
deploy-production:
stage: deploy-production
image: node:18
script:
- npm install -g @tamyla/clodo-framework
- npx clodo-service deploy --environment production
environment:
name: production
when: manual
Framework Integrations
Use Clodo Framework services with popular web frameworks:
Next.js Integration
// Use Clodo service as API backend
import { Clodo } from '@tamyla/clodo-framework';
export async function getServerSideProps() {
// Call your Clodo service from Next.js
const response = await fetch('https://your-domain.com/api/data');
const data = await response.json();
return { props: { data } };
}
Remix Integration
// Deploy Clodo services alongside Remix
import { json } from '@remix-run/cloudflare';
export async function loader({ context }) {
// Access Clodo service
const response = await context.env.SERVICES.yourService.call('api/data');
return json(response);
}
Astro Integration
// Use Clodo content service for Astro
---
import { Clodo } from '@tamyla/clodo-framework';
const data = await Clodo.getContent({
service: 'content-service',
path: '/blog'
});
---
{data.map(item => (
{item.title}
))}
SvelteKit Integration
// Call Clodo services from SvelteKit endpoints
export async function POST({ request }) {
const data = await request.json();
const response = await fetch('https://your-api.com/api/items', {
method: 'POST',
body: JSON.stringify(data)
});
return response;
}
Community & Support
Getting Help
- 📖 Documentation: This guide + generated service READMEs + API docs
- 🐛 GitHub Issues: Report bugs and request features
- 💬 GitHub Discussions: Ask questions and share ideas
- 📧 Email Support: Enterprise support inquiries
- 🔗 Community Forums: Connect with other developers
Contributing
- Code: Submit PRs for bug fixes and features
- Documentation: Improve guides and examples
- Templates: Share custom service templates
- Testing: Add test cases and integration tests
- Translations: Help translate documentation
Code of Conduct
We maintain a welcoming, inclusive community. All contributors are expected to follow our Code of Conduct. Be respectful, constructive, and supportive in all interactions.
API Reference
Public Exports
- @tamyla/clodo-framework - Simple API (recommended for most use cases)
- @tamyla/clodo-framework/service-management - Service creation and management
- @tamyla/clodo-framework/orchestration - Multi-domain management
- @tamyla/clodo-framework/deployment - Deployment utilities
- @tamyla/clodo-framework/security - Security components
- @tamyla/clodo-framework/config - Configuration management
Simple API Methods
import { Clodo } from '@tamyla/clodo-framework';
// Create a new service
await Clodo.createService({
name: 'my-service',
type: 'data-service',
domain: 'api.example.com'
});
// Deploy a service
await Clodo.deploy({
servicePath: './my-service',
environment: 'production'
});
// Validate service configuration
await Clodo.validate({
servicePath: './my-service'
});
// Get framework information
const info = Clodo.getInfo();
Advanced API
import { ServiceOrchestrator } from '@tamyla/clodo-framework/service-management';
import { MultiDomainOrchestrator } from '@tamyla/clodo-framework/orchestration';
// Advanced orchestration for complex architectures
const orchestrator = new MultiDomainOrchestrator();
await orchestrator.deployMultiple([
{ path: './api', domain: 'api.example.com' },
{ path: './auth', domain: 'auth.example.com' }
]);
Best Practices
Multi-Service Consistency
- Use environment-specific config files (dev.toml, staging.toml, prod.toml) rather than branching generated code
- Define service templates for your domain to enforce naming and structure across teams
- Run
npx clodo-service validatein pre-commit hooks to catch issues before CI/CD
Production Deployment Strategy
- Deploy to staging first, run integration tests against live Cloudflare infrastructure (not mocks)
- Use
npx clodo-service deploy --strategy gradualfor canary deployments to catch edge cases - Set up alerts on cold start times and D1 query latency to catch performance regressions early
Development Workflow
- Keep generated framework code in git history but mark it clearly (use git diff to track customizations)
- Build custom business logic as separate modules imported by handlers, not inline modifications
- Use
npx clodo-service diagnosewhen deployments fail—it reports actual vs expected configurations
Security Essentials
- Store secrets in Cloudflare Secrets Manager, accessed via
context.env(never .env files in production) - Enable request signing for cross-service calls to prevent unauthorized internal requests
- Audit D1 query logs quarterly for access patterns and remove overly permissive role bindings