Overview
Bindings connect your Conductor worker to Cloudflare resources like D1 databases, KV namespaces, R2 buckets, and Vectorize indexes. Learn how to configure and use each binding type.Binding Types
D1 Database
SQL database for structured data. Configuration:query- Execute SELECT/INSERT/UPDATE/DELETEbatch- Execute multiple queries atomicallyexec- Execute DDL (CREATE TABLE, etc.)
KV Namespace
Key-value storage for caching and state. Configuration:get- Retrieve value by keyput- Store key-value pairdelete- Remove keylist- List keys by prefix
R2 Bucket
Object storage for files and large data. Configuration:get- Retrieve objectput- Store objectdelete- Remove objectlist- List objects by prefixhead- Get metadata only
Vectorize Index
Vector database for embeddings and semantic search. Configuration:query- Search for similar vectorsinsert- Add vectors to indexupsert- Insert or update vectorsdelete- Remove vectors
Workers AI
Access to Cloudflare’s AI models. Configuration:Durable Objects
Stateful coordination and HITL workflows. Configuration:Queue
Async task processing. Configuration:Multiple Bindings
Same Type, Different Names
Environment-Specific Bindings
Testing with Bindings
Local Development
Test with Miniflare
Binding Limits
D1 Database
- Max databases per account: 10 (can request increase)
- Max database size: 10GB
- Max queries per request: 50
- Max query execution time: 30 seconds
KV Namespace
- Max namespaces per account: 100
- Max key size: 512 bytes
- Max value size: 25MB
- Max metadata: 1KB per key
- Reads: 100,000/day (free), unlimited (paid)
- Writes: 1,000/day (free), unlimited (paid)
R2 Bucket
- Max buckets per account: 1,000
- Max object size: 5TB
- Storage: 10GB free, then pay-as-you-go
- Operations: Class A (1 million free), Class B (10 million free)
Vectorize Index
- Max indexes per account: 100
- Max dimensions: 1536
- Max vectors per index: 5 million
- Max queries per second: 1,000
Durable Objects
- Max classes per script: 10
- Max concurrent instances: No hard limit (rate limited)
- Max storage per object: 128KB alarm + unlimited SQL
Best Practices
- Use descriptive binding names -
USER_CACHEnotKV1 - Separate data by environment - Different bindings for dev/prod
- Limit binding access - Only bind what you need
- Use preview bindings - Test with non-production data
- Document bindings - Comment what each binding is for
- Monitor usage - Track read/write operations
- Implement cleanup - Delete unused keys/objects
- Validate binding availability - Check env.BINDING exists
- Use appropriate storage - KV for cache, D1 for relational, R2 for files
- Version Durable Object migrations - Increment tags properly
Troubleshooting
Binding not found
- Check wrangler.toml has binding
- Verify resource ID is correct
- Redeploy:
npx wrangler deploy

