{ "$schema": "node_modules/wrangler/config-schema.json", "name": "my-worker", "main": "src/index.ts", "compatibility_date": "2025-10-11", "observability": { "enabled": true }, // KV Namespace Bindings "kv_namespaces": [ { // The binding name - accessible as env.CACHE in your Worker "binding": "CACHE", // Production namespace ID (from: wrangler kv namespace create CACHE) "id": "", // Preview/local namespace ID (from: wrangler kv namespace create CACHE --preview) // This is optional but recommended for local development "preview_id": "" }, // Multiple namespaces example { "binding": "CONFIG", "id": "", "preview_id": "" }, { "binding": "SESSIONS", "id": "", "preview_id": "" } ] // IMPORTANT NOTES: // // 1. Create namespaces first: // npx wrangler kv namespace create CACHE // npx wrangler kv namespace create CACHE --preview // // 2. Copy the IDs from the command output to this file // // 3. NEVER commit real namespace IDs to public repos // Use environment variables for sensitive namespaces: // "id": "${KV_CACHE_ID}" // // 4. preview_id is optional but recommended for local development // It creates a separate namespace for testing // // 5. Binding names must be valid JavaScript identifiers // Good: CACHE, MY_KV, UserData // Bad: my-kv, user.data, 123kv }