functions.do
Deploy Functions Globally in Seconds
Write TypeScript functions with full type safety and deploy to edge locations worldwide. Zero cold starts with automatic scaling.
import { $, db, ai } from 'sdk.do' // Order processing function with fraud detectionexport async function processOrder(order: any) { const fraudCheck = await ai.generate({ prompt: `Analyze order for fraud: ${JSON.stringify(order)}`, schema: $.Security.analyzes.FraudRisk }) if (fraudCheck.riskScore > 0.8) throw new Error('High fraud risk') await db.update('orders', order.id, { status: 'processing' }) return { ...order, validated: true }} // Webhook handler with semantic routingexport async function handleWebhook(webhook: any) { if (webhook.source === 'stripe') return processPayment(webhook.data) if (webhook.source === 'shopify') return syncInventory(webhook.data) return { status: 'ignored' }}
Frequently asked questions
Functions run on Cloudflare Workers using V8 isolates that start in <1ms vs 100-1000ms for containers. Every function stays warm at the edge with automatic distribution across 300+ locations.
128MB memory and 50ms CPU time with unlimited concurrent executions covers 99% of use cases like API handlers and webhooks. Use queues or scheduled functions for long-running tasks.
Pay only for CPU time used per millisecond—first 100K requests daily free, then $0.50/million requests with no idle charges or minimums. Example: 10M requests/month at 5ms average = $47/month.
Yes, with built-in connectors for PostgreSQL, MySQL, MongoDB, Redis, and Cloudflare D1/R2/KV/Durable Objects. HTTP fetch works for any external API with automatic retries and caching.
Automatic error capturing with stack traces, configurable retry policies, and dead letter queues for failed invocations. Real-time logs, distributed tracing, and metrics dashboards show invocations, errors, and latency.