[{"data":1,"prerenderedAt":2245},["ShallowReactive",2],{"navigation":3,"-deploy-providers-cloudflare":402,"-deploy-providers-cloudflare-surround":2240},[4,93,226,232,387,399],{"title":5,"path":6,"stem":7,"children":8,"icon":92},"","\u002Fdocs","1.docs\u002F1.index",[9,12,17,22,27,32,37,42,47,52,57,62,67,72,77,82,87],{"title":10,"path":6,"stem":7,"icon":11},"Introduction","i-lucide-compass",{"title":13,"path":14,"stem":15,"icon":16},"Quick Start","\u002Fdocs\u002Fquick-start","1.docs\u002F2.quick-start","i-lucide-zap",{"title":18,"path":19,"stem":20,"icon":21},"Renderer","\u002Fdocs\u002Frenderer","1.docs\u002F4.renderer","ri:layout-masonry-line",{"title":23,"path":24,"stem":25,"icon":26},"Routing","\u002Fdocs\u002Frouting","1.docs\u002F5.routing","ri:direction-line",{"title":28,"path":29,"stem":30,"icon":31},"Assets","\u002Fdocs\u002Fassets","1.docs\u002F50.assets","ri:image-2-line",{"title":33,"path":34,"stem":35,"icon":36},"Configuration","\u002Fdocs\u002Fconfiguration","1.docs\u002F50.configuration","ri:settings-3-line",{"title":38,"path":39,"stem":40,"icon":41},"Database","\u002Fdocs\u002Fdatabase","1.docs\u002F50.database","ri:database-2-line",{"title":43,"path":44,"stem":45,"icon":46},"Lifecycle","\u002Fdocs\u002Flifecycle","1.docs\u002F50.lifecycle","i-lucide-layers",{"title":48,"path":49,"stem":50,"icon":51},"OpenAPI","\u002Fdocs\u002Fopenapi","1.docs\u002F50.openapi","ri:contract-line",{"title":53,"path":54,"stem":55,"icon":56},"Plugins","\u002Fdocs\u002Fplugins","1.docs\u002F50.plugins","ri:plug-line",{"title":58,"path":59,"stem":60,"icon":61},"Tasks","\u002Fdocs\u002Ftasks","1.docs\u002F50.tasks","codicon:run-all",{"title":63,"path":64,"stem":65,"icon":66},"WebSocket","\u002Fdocs\u002Fwebsocket","1.docs\u002F50.websocket","ri:broadcast-fill",{"title":68,"path":69,"stem":70,"icon":71},"Server Entry","\u002Fdocs\u002Fserver-entry","1.docs\u002F6.server-entry","ri:server-line",{"title":73,"path":74,"stem":75,"icon":76},"Cache","\u002Fdocs\u002Fcache","1.docs\u002F7.cache","ri:speed-line",{"title":78,"path":79,"stem":80,"icon":81},"KV Storage","\u002Fdocs\u002Fstorage","1.docs\u002F8.storage","carbon:datastore",{"title":83,"path":84,"stem":85,"icon":86},"Migration Guide","\u002Fdocs\u002Fmigration","1.docs\u002F99.migration","ri:arrow-right-up-line",{"title":88,"path":89,"stem":90,"icon":91},"Nightly Channel","\u002Fdocs\u002Fnightly","1.docs\u002F99.nightly","ri:moon-fill","i-lucide-book-open",{"title":94,"path":95,"stem":96,"children":97,"icon":99},"Deploy","\u002Fdeploy","2.deploy\u002F0.index",[98,100,121],{"title":94,"path":95,"stem":96,"icon":99},"ri:upload-cloud-2-line",{"title":101,"path":102,"stem":103,"children":104,"page":120},"Runtimes","\u002Fdeploy\u002Fruntimes","2.deploy\u002F10.runtimes",[105,110,115],{"title":106,"path":107,"stem":108,"icon":109},"Node.js","\u002Fdeploy\u002Fruntimes\u002Fnode","2.deploy\u002F10.runtimes\u002F1.node","akar-icons:node-fill",{"title":111,"path":112,"stem":113,"icon":114},"Bun","\u002Fdeploy\u002Fruntimes\u002Fbun","2.deploy\u002F10.runtimes\u002Fbun","simple-icons:bun",{"title":116,"path":117,"stem":118,"icon":119},"Deno","\u002Fdeploy\u002Fruntimes\u002Fdeno","2.deploy\u002F10.runtimes\u002Fdeno","simple-icons:deno",false,{"title":122,"path":123,"stem":124,"children":125,"page":120},"Providers","\u002Fdeploy\u002Fproviders","2.deploy\u002F20.providers",[126,130,134,138,142,146,150,154,158,162,166,170,174,178,182,186,190,194,198,202,206,210,214,218,222],{"title":127,"path":128,"stem":129},"Alwaysdata","\u002Fdeploy\u002Fproviders\u002Falwaysdata","2.deploy\u002F20.providers\u002Falwaysdata",{"title":131,"path":132,"stem":133},"AWS Lambda","\u002Fdeploy\u002Fproviders\u002Faws","2.deploy\u002F20.providers\u002Faws",{"title":135,"path":136,"stem":137},"AWS Amplify","\u002Fdeploy\u002Fproviders\u002Faws-amplify","2.deploy\u002F20.providers\u002Faws-amplify",{"title":139,"path":140,"stem":141},"Azure","\u002Fdeploy\u002Fproviders\u002Fazure","2.deploy\u002F20.providers\u002Fazure",{"title":143,"path":144,"stem":145},"Cleavr","\u002Fdeploy\u002Fproviders\u002Fcleavr","2.deploy\u002F20.providers\u002Fcleavr",{"title":147,"path":148,"stem":149},"Cloudflare","\u002Fdeploy\u002Fproviders\u002Fcloudflare","2.deploy\u002F20.providers\u002Fcloudflare",{"title":151,"path":152,"stem":153},"Deno Deploy","\u002Fdeploy\u002Fproviders\u002Fdeno-deploy","2.deploy\u002F20.providers\u002Fdeno-deploy",{"title":155,"path":156,"stem":157},"DigitalOcean","\u002Fdeploy\u002Fproviders\u002Fdigitalocean","2.deploy\u002F20.providers\u002Fdigitalocean",{"title":159,"path":160,"stem":161},"EdgeOne Pages","\u002Fdeploy\u002Fproviders\u002Fedgeone","2.deploy\u002F20.providers\u002Fedgeone",{"title":163,"path":164,"stem":165},"Firebase","\u002Fdeploy\u002Fproviders\u002Ffirebase","2.deploy\u002F20.providers\u002Ffirebase",{"title":167,"path":168,"stem":169},"Flightcontrol","\u002Fdeploy\u002Fproviders\u002Fflightcontrol","2.deploy\u002F20.providers\u002Fflightcontrol",{"title":171,"path":172,"stem":173},"Genezio","\u002Fdeploy\u002Fproviders\u002Fgenezio","2.deploy\u002F20.providers\u002Fgenezio",{"title":175,"path":176,"stem":177},"GitHub Pages","\u002Fdeploy\u002Fproviders\u002Fgithub-pages","2.deploy\u002F20.providers\u002Fgithub-pages",{"title":179,"path":180,"stem":181},"GitLab Pages","\u002Fdeploy\u002Fproviders\u002Fgitlab-pages","2.deploy\u002F20.providers\u002Fgitlab-pages",{"title":183,"path":184,"stem":185},"Heroku","\u002Fdeploy\u002Fproviders\u002Fheroku","2.deploy\u002F20.providers\u002Fheroku",{"title":187,"path":188,"stem":189},"IIS","\u002Fdeploy\u002Fproviders\u002Fiis","2.deploy\u002F20.providers\u002Fiis",{"title":191,"path":192,"stem":193},"Koyeb","\u002Fdeploy\u002Fproviders\u002Fkoyeb","2.deploy\u002F20.providers\u002Fkoyeb",{"title":195,"path":196,"stem":197},"Netlify","\u002Fdeploy\u002Fproviders\u002Fnetlify","2.deploy\u002F20.providers\u002Fnetlify",{"title":199,"path":200,"stem":201},"Platform.sh","\u002Fdeploy\u002Fproviders\u002Fplatform-sh","2.deploy\u002F20.providers\u002Fplatform-sh",{"title":203,"path":204,"stem":205},"Render.com","\u002Fdeploy\u002Fproviders\u002Frender","2.deploy\u002F20.providers\u002Frender",{"title":207,"path":208,"stem":209},"StormKit","\u002Fdeploy\u002Fproviders\u002Fstormkit","2.deploy\u002F20.providers\u002Fstormkit",{"title":211,"path":212,"stem":213},"Vercel","\u002Fdeploy\u002Fproviders\u002Fvercel","2.deploy\u002F20.providers\u002Fvercel",{"title":215,"path":216,"stem":217},"Zeabur","\u002Fdeploy\u002Fproviders\u002Fzeabur","2.deploy\u002F20.providers\u002Fzeabur",{"title":219,"path":220,"stem":221},"Zephyr Cloud","\u002Fdeploy\u002Fproviders\u002Fzephyr","2.deploy\u002F20.providers\u002Fzephyr",{"title":223,"path":224,"stem":225},"Zerops","\u002Fdeploy\u002Fproviders\u002Fzerops","2.deploy\u002F20.providers\u002Fzerops",{"title":227,"path":228,"stem":229,"children":230,"icon":36},"Config","\u002Fconfig","3.config\u002F0.index",[231],{"title":227,"path":228,"stem":229,"icon":36},{"title":233,"path":234,"stem":235,"children":236,"icon":238},"Examples","\u002Fexamples","4.examples\u002F0.index",[237,239,244,249,254,259,263,268,273,278,283,288,293,297,302,306,310,315,320,325,330,335,340,345,350,355,359,364,369,373,378,383],{"title":233,"path":234,"stem":235,"icon":238},"i-lucide-folder-code",{"title":240,"path":241,"stem":242,"icon":243},"API Routes","\u002Fexamples\u002Fapi-routes","4.examples\u002Fapi-routes","i-lucide-route",{"title":245,"path":246,"stem":247,"icon":248},"Auto Imports","\u002Fexamples\u002Fauto-imports","4.examples\u002Fauto-imports","i-lucide-import",{"title":250,"path":251,"stem":252,"icon":253},"Cached Handler","\u002Fexamples\u002Fcached-handler","4.examples\u002Fcached-handler","i-lucide-clock",{"title":255,"path":256,"stem":257,"icon":258},"Custom Error Handler","\u002Fexamples\u002Fcustom-error-handler","4.examples\u002Fcustom-error-handler","i-lucide-alert-circle",{"title":38,"path":260,"stem":261,"icon":262},"\u002Fexamples\u002Fdatabase","4.examples\u002Fdatabase","i-lucide-database",{"title":264,"path":265,"stem":266,"icon":267},"Elysia","\u002Fexamples\u002Felysia","4.examples\u002Felysia","i-skill-icons-elysia-dark",{"title":269,"path":270,"stem":271,"icon":272},"Express","\u002Fexamples\u002Fexpress","4.examples\u002Fexpress","i-simple-icons-express",{"title":274,"path":275,"stem":276,"icon":277},"Fastify","\u002Fexamples\u002Ffastify","4.examples\u002Ffastify","i-simple-icons-fastify",{"title":279,"path":280,"stem":281,"icon":282},"Hello World","\u002Fexamples\u002Fhello-world","4.examples\u002Fhello-world","i-lucide-sparkles",{"title":284,"path":285,"stem":286,"icon":287},"Hono","\u002Fexamples\u002Fhono","4.examples\u002Fhono","i-logos-hono",{"title":289,"path":290,"stem":291,"icon":292},"Import Alias","\u002Fexamples\u002Fimport-alias","4.examples\u002Fimport-alias","i-lucide-at-sign",{"title":294,"path":295,"stem":296,"icon":46},"Middleware","\u002Fexamples\u002Fmiddleware","4.examples\u002Fmiddleware",{"title":298,"path":299,"stem":300,"icon":301},"Mono JSX","\u002Fexamples\u002Fmono-jsx","4.examples\u002Fmono-jsx","i-lucide-brackets",{"title":303,"path":304,"stem":305,"icon":301},"Nano JSX","\u002Fexamples\u002Fnano-jsx","4.examples\u002Fnano-jsx",{"title":53,"path":307,"stem":308,"icon":309},"\u002Fexamples\u002Fplugins","4.examples\u002Fplugins","i-lucide-plug",{"title":311,"path":312,"stem":313,"icon":314},"Custom Renderer","\u002Fexamples\u002Frenderer","4.examples\u002Frenderer","i-lucide-code",{"title":316,"path":317,"stem":318,"icon":319},"Runtime Config","\u002Fexamples\u002Fruntime-config","4.examples\u002Fruntime-config","i-lucide-settings",{"title":321,"path":322,"stem":323,"icon":324},"Server Fetch","\u002Fexamples\u002Fserver-fetch","4.examples\u002Fserver-fetch","i-lucide-arrow-right-left",{"title":326,"path":327,"stem":328,"icon":329},"Shiki","\u002Fexamples\u002Fshiki","4.examples\u002Fshiki","i-lucide-highlighter",{"title":331,"path":332,"stem":333,"icon":334},"Virtual Routes","\u002Fexamples\u002Fvirtual-routes","4.examples\u002Fvirtual-routes","i-lucide-box",{"title":336,"path":337,"stem":338,"icon":339},"Vite Nitro Plugin","\u002Fexamples\u002Fvite-nitro-plugin","4.examples\u002Fvite-nitro-plugin","i-logos-vitejs",{"title":341,"path":342,"stem":343,"icon":344},"Vite RSC","\u002Fexamples\u002Fvite-rsc","4.examples\u002Fvite-rsc","i-logos-react",{"title":346,"path":347,"stem":348,"icon":349},"Vite SSR HTML","\u002Fexamples\u002Fvite-ssr-html","4.examples\u002Fvite-ssr-html","i-logos-html-5",{"title":351,"path":352,"stem":353,"icon":354},"SSR with Preact","\u002Fexamples\u002Fvite-ssr-preact","4.examples\u002Fvite-ssr-preact","i-logos-preact",{"title":356,"path":357,"stem":358,"icon":344},"SSR with React","\u002Fexamples\u002Fvite-ssr-react","4.examples\u002Fvite-ssr-react",{"title":360,"path":361,"stem":362,"icon":363},"SSR with SolidJS","\u002Fexamples\u002Fvite-ssr-solid","4.examples\u002Fvite-ssr-solid","i-logos-solidjs-icon",{"title":365,"path":366,"stem":367,"icon":368},"SSR with TanStack Router","\u002Fexamples\u002Fvite-ssr-tsr-react","4.examples\u002Fvite-ssr-tsr-react","i-simple-icons-tanstack",{"title":370,"path":371,"stem":372,"icon":368},"SSR with TanStack Start","\u002Fexamples\u002Fvite-ssr-tss-react","4.examples\u002Fvite-ssr-tss-react",{"title":374,"path":375,"stem":376,"icon":377},"SSR with Vue Router","\u002Fexamples\u002Fvite-ssr-vue-router","4.examples\u002Fvite-ssr-vue-router","i-logos-vue",{"title":379,"path":380,"stem":381,"icon":382},"Vite + tRPC","\u002Fexamples\u002Fvite-trpc","4.examples\u002Fvite-trpc","i-simple-icons-trpc",{"title":63,"path":384,"stem":385,"icon":386},"\u002Fexamples\u002Fwebsocket","4.examples\u002Fwebsocket","i-lucide-radio",{"title":388,"path":389,"stem":390,"children":391},"Blog","\u002Fblog","9.blog",[392,395],{"title":388,"path":389,"stem":393,"icon":394},"9.blog\u002Findex","i-lucide-file-text",{"title":396,"path":397,"stem":398,"icon":394},"Nitro v3 Beta is here!","\u002Fblog\u002Fv3-beta","9.blog\u002F1.v3-beta",{"title":5,"path":400,"stem":401},"\u002F","index",{"id":403,"title":147,"body":404,"description":2234,"extension":2235,"meta":2236,"navigation":2237,"path":148,"seo":2238,"stem":149,"__hash__":2239},"content\u002F2.deploy\u002F20.providers\u002Fcloudflare.md",{"type":405,"value":406,"toc":2209},"minimark",[407,412,424,428,447,454,523,528,537,541,545,549,552,555,558,561,564,568,580,582,627,631,638,713,716,725,734,770,774,791,900,903,907,912,928,981,984,1036,1040,1047,1050,1056,1066,1071,1113,1130,1133,1138,1140,1143,1146,1149,1151,1153,1156,1160,1169,1185,1189,1200,1209,1223,1351,1355,1365,1391,1407,1411,1434,1445,1455,1459,1470,1480,1488,1493,1497,1667,1671,1685,1699,1710,1713,1715,1722,1842,1846,1867,1877,2009,2022,2118,2121,2124,2133,2138,2145,2205],[408,409,411],"h2",{"id":410},"cloudflare-workers","Cloudflare Workers",[413,414,415,419,420],"p",{},[416,417,418],"strong",{},"Preset:"," ",[421,422,423],"code",{},"cloudflare_module",[425,426],"read-more",{"to":427,"title":411},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkers\u002F",[429,430,431],"note",{},[413,432,433,434,439,440,446],{},"Integration with this provider is possible with ",[435,436,438],"a",{"href":437},"\u002Fdeploy#zero-config-providers","zero configuration"," supporting ",[435,441,445],{"href":442,"rel":443},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkers\u002Fci-cd\u002Fbuilds\u002F",[444],"nofollow","workers builds (beta)",".",[413,448,449,450,453],{},"The following shows an example ",[421,451,452],{},"nitro.config.ts"," file for deploying a Nitro app to Cloudflare Workers.",[455,456,460],"pre",{"className":457,"code":458,"filename":452,"language":459,"meta":5,"style":5},"language-ts shiki shiki-themes github-light github-dark github-dark","import { defineConfig } from \"nitro\";\n\nexport default defineConfig({\n    preset: \"cloudflare_module\"\n})\n","ts",[421,461,462,485,492,508,517],{"__ignoreMap":5},[463,464,467,471,475,478,482],"span",{"class":465,"line":466},"line",1,[463,468,470],{"class":469},"so5gQ","import",[463,472,474],{"class":473},"slsVL"," { defineConfig } ",[463,476,477],{"class":469},"from",[463,479,481],{"class":480},"sfrk1"," \"nitro\"",[463,483,484],{"class":473},";\n",[463,486,488],{"class":465,"line":487},2,[463,489,491],{"emptyLinePlaceholder":490},true,"\n",[463,493,495,498,501,505],{"class":465,"line":494},3,[463,496,497],{"class":469},"export",[463,499,500],{"class":469}," default",[463,502,504],{"class":503},"shcOC"," defineConfig",[463,506,507],{"class":473},"({\n",[463,509,511,514],{"class":465,"line":510},4,[463,512,513],{"class":473},"    preset: ",[463,515,516],{"class":480},"\"cloudflare_module\"\n",[463,518,520],{"class":465,"line":519},5,[463,521,522],{"class":473},"})\n",[524,525,527],"h3",{"id":526},"local-preview","Local Preview",[413,529,530,531,536],{},"You can use ",[435,532,535],{"href":533,"rel":534},"https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fworkers-sdk\u002Ftree\u002Fmain\u002Fpackages\u002Fwrangler",[444],"Wrangler"," to preview your app locally:",[538,539],"pm-run",{"script":540},"build",[542,543],"pm-x",{"command":544},"wrangler dev",[524,546,548],{"id":547},"manual-deploy","Manual Deploy",[413,550,551],{},"After having built your application you can manually deploy it with Wrangler.",[413,553,554],{},"First make sure to be logged into your Cloudflare account:",[542,556],{"command":557},"wrangler login",[413,559,560],{},"Then you can deploy the application with:",[542,562],{"command":563},"wrangler deploy",[524,565,567],{"id":566},"runtime-hooks","Runtime Hooks",[413,569,530,570,574,575,446],{},[435,571,573],{"href":572},"\u002Fdocs\u002Fplugins#nitro-runtime-hooks","runtime hooks"," below in order to extend ",[435,576,579],{"href":577,"rel":578},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkers\u002Fruntime-apis\u002Fhandlers\u002F",[444],"Worker handlers",[425,581],{"to":572},[583,584,585,595,604,613,622],"ul",{},[586,587,588],"li",{},[435,589,592],{"href":590,"rel":591},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkers\u002Fruntime-apis\u002Fhandlers\u002Fscheduled\u002F",[444],[421,593,594],{},"cloudflare:scheduled",[586,596,597],{},[435,598,601],{"href":599,"rel":600},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Femail-routing\u002Femail-workers\u002Fruntime-api\u002F",[444],[421,602,603],{},"cloudflare:email",[586,605,606],{},[435,607,610],{"href":608,"rel":609},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Fqueues\u002Fconfiguration\u002Fjavascript-apis\u002F#consumer",[444],[421,611,612],{},"cloudflare:queue",[586,614,615],{},[435,616,619],{"href":617,"rel":618},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkers\u002Fruntime-apis\u002Fhandlers\u002Ftail\u002F",[444],[421,620,621],{},"cloudflare:tail",[586,623,624],{},[421,625,626],{},"cloudflare:trace",[524,628,630],{"id":629},"additional-exports","Additional Exports",[413,632,633,634,637],{},"You can add a ",[421,635,636],{},"exports.cloudflare.ts"," file to your project root to export additional handlers or properties to the Cloudflare Worker entrypoint.",[455,639,641],{"className":457,"code":640,"filename":636,"language":459,"meta":5,"style":5},"export class MyWorkflow extends WorkflowEntrypoint {\n  async run(event: WorkflowEvent, step: WorkflowStep) {\n    \u002F\u002F ...\n  }\n}\n",[421,642,643,662,697,703,708],{"__ignoreMap":5},[463,644,645,647,650,653,656,659],{"class":465,"line":466},[463,646,497],{"class":469},[463,648,649],{"class":469}," class",[463,651,652],{"class":503}," MyWorkflow",[463,654,655],{"class":469}," extends",[463,657,658],{"class":503}," WorkflowEntrypoint",[463,660,661],{"class":473}," {\n",[463,663,664,667,670,673,677,680,683,686,689,691,694],{"class":465,"line":487},[463,665,666],{"class":469},"  async",[463,668,669],{"class":503}," run",[463,671,672],{"class":473},"(",[463,674,676],{"class":675},"sQHwn","event",[463,678,679],{"class":469},":",[463,681,682],{"class":503}," WorkflowEvent",[463,684,685],{"class":473},", ",[463,687,688],{"class":675},"step",[463,690,679],{"class":469},[463,692,693],{"class":503}," WorkflowStep",[463,695,696],{"class":473},") {\n",[463,698,699],{"class":465,"line":494},[463,700,702],{"class":701},"sCsY4","    \u002F\u002F ...\n",[463,704,705],{"class":465,"line":510},[463,706,707],{"class":473},"  }\n",[463,709,710],{"class":465,"line":519},[463,711,712],{"class":473},"}\n",[413,714,715],{},"Nitro will automatically detect this file and include its exports in the final build.",[717,718,719],"warning",{},[413,720,721,722,724],{},"The ",[421,723,636],{}," file must not have a default export.",[413,726,727,728,731,732,679],{},"You can also customize the entrypoint file location using the ",[421,729,730],{},"cloudflare.exports"," option in your ",[421,733,452],{},[455,735,737],{"className":457,"code":736,"filename":452,"language":459,"meta":5,"style":5},"export default defineConfig({\n  cloudflare: {\n    exports: \"custom-exports-entry.ts\"\n  }\n})\n",[421,738,739,749,754,762,766],{"__ignoreMap":5},[463,740,741,743,745,747],{"class":465,"line":466},[463,742,497],{"class":469},[463,744,500],{"class":469},[463,746,504],{"class":503},[463,748,507],{"class":473},[463,750,751],{"class":465,"line":487},[463,752,753],{"class":473},"  cloudflare: {\n",[463,755,756,759],{"class":465,"line":494},[463,757,758],{"class":473},"    exports: ",[463,760,761],{"class":480},"\"custom-exports-entry.ts\"\n",[463,763,764],{"class":465,"line":510},[463,765,707],{"class":473},[463,767,768],{"class":465,"line":519},[463,769,522],{"class":473},[524,771,773],{"id":772},"scheduled-tasks-cron-triggers","Scheduled Tasks (Cron Triggers)",[413,775,776,777,780,781,784,785,790],{},"When using ",[435,778,779],{"href":59},"Nitro tasks"," with ",[421,782,783],{},"scheduledTasks",", Nitro automatically generates ",[435,786,789],{"href":787,"rel":788},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkers\u002Fconfiguration\u002Fcron-triggers\u002F",[444],"Cron Triggers"," in the wrangler config at build time.",[455,792,794],{"className":457,"code":793,"filename":452,"language":459,"meta":5,"style":5},"import { defineConfig } from \"nitro\";\n\nexport default defineConfig({\n  preset: \"cloudflare_module\",\n  experimental: {\n    tasks: true,\n  },\n  scheduledTasks: {\n    \"* * * * *\": [\"cms:update\"],\n    \"0 15 1 * *\": [\"db:cleanup\"],\n  }\n})\n",[421,795,796,808,812,822,833,838,850,856,862,877,890,895],{"__ignoreMap":5},[463,797,798,800,802,804,806],{"class":465,"line":466},[463,799,470],{"class":469},[463,801,474],{"class":473},[463,803,477],{"class":469},[463,805,481],{"class":480},[463,807,484],{"class":473},[463,809,810],{"class":465,"line":487},[463,811,491],{"emptyLinePlaceholder":490},[463,813,814,816,818,820],{"class":465,"line":494},[463,815,497],{"class":469},[463,817,500],{"class":469},[463,819,504],{"class":503},[463,821,507],{"class":473},[463,823,824,827,830],{"class":465,"line":510},[463,825,826],{"class":473},"  preset: ",[463,828,829],{"class":480},"\"cloudflare_module\"",[463,831,832],{"class":473},",\n",[463,834,835],{"class":465,"line":519},[463,836,837],{"class":473},"  experimental: {\n",[463,839,841,844,848],{"class":465,"line":840},6,[463,842,843],{"class":473},"    tasks: ",[463,845,847],{"class":846},"suiK_","true",[463,849,832],{"class":473},[463,851,853],{"class":465,"line":852},7,[463,854,855],{"class":473},"  },\n",[463,857,859],{"class":465,"line":858},8,[463,860,861],{"class":473},"  scheduledTasks: {\n",[463,863,865,868,871,874],{"class":465,"line":864},9,[463,866,867],{"class":480},"    \"* * * * *\"",[463,869,870],{"class":473},": [",[463,872,873],{"class":480},"\"cms:update\"",[463,875,876],{"class":473},"],\n",[463,878,880,883,885,888],{"class":465,"line":879},10,[463,881,882],{"class":480},"    \"0 15 1 * *\"",[463,884,870],{"class":473},[463,886,887],{"class":480},"\"db:cleanup\"",[463,889,876],{"class":473},[463,891,893],{"class":465,"line":892},11,[463,894,707],{"class":473},[463,896,898],{"class":465,"line":897},12,[463,899,522],{"class":473},[413,901,902],{},"No manual Wrangler configuration is needed - Nitro handles it for you.",[524,904,906],{"id":905},"tracing","Tracing",[413,908,909],{},[416,910,911],{},"🧪 Experimental!",[413,913,914,915,921,922,927],{},"When the experimental ",[435,916,918],{"href":917},"\u002Fconfig#tracingchannel",[421,919,920],{},"tracingChannel"," option is enabled, the Cloudflare presets report Nitro's tracing-channel events (h3 routes and middleware, srvx, unstorage operations, …) as ",[435,923,926],{"href":924,"rel":925},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkers\u002Fobservability\u002Ftraces\u002Fcustom-spans\u002F",[444],"custom spans",", alongside Cloudflare's automatic instrumentation (fetch calls, KV reads, D1 queries, …) — no OpenTelemetry SDK required.",[455,929,931],{"className":457,"code":930,"filename":452,"language":459,"meta":5,"style":5},"import { defineConfig } from \"nitro\";\n\nexport default defineConfig({\n  preset: \"cloudflare_module\",\n  tracingChannel: true,\n});\n",[421,932,933,945,949,959,967,976],{"__ignoreMap":5},[463,934,935,937,939,941,943],{"class":465,"line":466},[463,936,470],{"class":469},[463,938,474],{"class":473},[463,940,477],{"class":469},[463,942,481],{"class":480},[463,944,484],{"class":473},[463,946,947],{"class":465,"line":487},[463,948,491],{"emptyLinePlaceholder":490},[463,950,951,953,955,957],{"class":465,"line":494},[463,952,497],{"class":469},[463,954,500],{"class":469},[463,956,504],{"class":503},[463,958,507],{"class":473},[463,960,961,963,965],{"class":465,"line":510},[463,962,826],{"class":473},[463,964,829],{"class":480},[463,966,832],{"class":473},[463,968,969,972,974],{"class":465,"line":519},[463,970,971],{"class":473},"  tracingChannel: ",[463,973,847],{"class":846},[463,975,832],{"class":473},[463,977,978],{"class":465,"line":840},[463,979,980],{"class":473},"});\n",[413,982,983],{},"Tracing must be enabled on the Worker for spans to be recorded:",[455,985,990],{"className":986,"code":987,"filename":988,"language":989,"meta":5,"style":5},"language-jsonc shiki shiki-themes github-light github-dark github-dark","{\n  \"observability\": {\n    \"traces\": {\n      \"enabled\": true\n    }\n  }\n}\n","wrangler.jsonc","jsonc",[421,991,992,997,1005,1012,1023,1028,1032],{"__ignoreMap":5},[463,993,994],{"class":465,"line":466},[463,995,996],{"class":473},"{\n",[463,998,999,1002],{"class":465,"line":487},[463,1000,1001],{"class":846},"  \"observability\"",[463,1003,1004],{"class":473},": {\n",[463,1006,1007,1010],{"class":465,"line":494},[463,1008,1009],{"class":846},"    \"traces\"",[463,1011,1004],{"class":473},[463,1013,1014,1017,1020],{"class":465,"line":510},[463,1015,1016],{"class":846},"      \"enabled\"",[463,1018,1019],{"class":473},": ",[463,1021,1022],{"class":846},"true\n",[463,1024,1025],{"class":465,"line":519},[463,1026,1027],{"class":473},"    }\n",[463,1029,1030],{"class":465,"line":840},[463,1031,707],{"class":473},[463,1033,1034],{"class":465,"line":852},[463,1035,712],{"class":473},[408,1037,1039],{"id":1038},"cloudflare-pages","Cloudflare Pages",[413,1041,1042,419,1044],{},[416,1043,418],{},[421,1045,1046],{},"cloudflare_pages",[425,1048],{"to":1049,"title":1039},"https:\u002F\u002Fpages.cloudflare.com\u002F",[429,1051,1052],{},[413,1053,433,1054,446],{},[435,1055,438],{"href":437},[717,1057,1058],{},[413,1059,1060,1061,1065],{},"Cloudflare ",[435,1062,1064],{"href":1063},"#cloudflare-workers","Workers Module"," is the new recommended preset for deployments. Please consider using the pages only if you need specific features.",[413,1067,449,1068,1070],{},[421,1069,452],{}," file for deploying a Nitro app to Cloudflare Pages.",[455,1072,1074],{"className":457,"code":1073,"filename":452,"language":459,"meta":5,"style":5},"import { defineConfig } from \"nitro\";\n\nexport default defineConfig({\n    preset: \"cloudflare_pages\"\n})\n",[421,1075,1076,1088,1092,1102,1109],{"__ignoreMap":5},[463,1077,1078,1080,1082,1084,1086],{"class":465,"line":466},[463,1079,470],{"class":469},[463,1081,474],{"class":473},[463,1083,477],{"class":469},[463,1085,481],{"class":480},[463,1087,484],{"class":473},[463,1089,1090],{"class":465,"line":487},[463,1091,491],{"emptyLinePlaceholder":490},[463,1093,1094,1096,1098,1100],{"class":465,"line":494},[463,1095,497],{"class":469},[463,1097,500],{"class":469},[463,1099,504],{"class":503},[463,1101,507],{"class":473},[463,1103,1104,1106],{"class":465,"line":510},[463,1105,513],{"class":473},[463,1107,1108],{"class":480},"\"cloudflare_pages\"\n",[463,1110,1111],{"class":465,"line":519},[463,1112,522],{"class":473},[413,1114,1115,1116,1119,1120,1123,1124,1129],{},"Nitro automatically generates a ",[421,1117,1118],{},"_routes.json"," file that controls which routes get served from files and which are served from the Worker script. The auto-generated routes file can be overridden with the config option ",[421,1121,1122],{},"cloudflare.pages.routes"," (",[435,1125,1128],{"href":1126,"rel":1127},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Fpages\u002Fplatform\u002Ffunctions\u002Frouting\u002F#functions-invocation-routes",[444],"read more",").",[524,1131,527],{"id":1132},"local-preview-1",[413,1134,530,1135,536],{},[435,1136,535],{"href":533,"rel":1137},[444],[538,1139],{"script":540},[542,1141],{"command":1142},"wrangler pages dev",[524,1144,548],{"id":1145},"manual-deploy-1",[413,1147,1148],{},"After having built your application you can manually deploy it with Wrangler, in order to do so first make sure to be\nlogged into your Cloudflare account:",[542,1150],{"command":557},[413,1152,560],{},[542,1154],{"command":1155},"wrangler pages deploy",[408,1157,1159],{"id":1158},"deploy-within-cicd-using-github-actions","Deploy within CI\u002FCD using GitHub Actions",[413,1161,1162,1163,1168],{},"Regardless on whether you're using Cloudflare Pages or Cloudflare Workers, you can use the ",[435,1164,1167],{"href":1165,"rel":1166},"https:\u002F\u002Fgithub.com\u002Fmarketplace\u002Factions\u002Fdeploy-to-cloudflare-workers-with-wrangler",[444],"Wrangler GitHub actions"," to deploy your application.",[429,1170,1171],{},[413,1172,1173,1176,1177,1181,1182,1184],{},[416,1174,1175],{},"Note:"," Remember to ",[435,1178,1180],{"href":1179},"\u002Fdeploy#changing-the-deployment-preset","instruct Nitro to use the correct preset"," (note that this is necessary for all presets including the ",[421,1183,1046],{}," one).",[408,1186,1188],{"id":1187},"environment-variables","Environment Variables",[413,1190,1191,1192,1195,1196,1199],{},"Nitro allows you to universally access environment variables using ",[421,1193,1194],{},"process.env"," or ",[421,1197,1198],{},"import.meta.env"," or the runtime config.",[429,1201,1202],{},[413,1203,1204,1205,1208],{},"Make sure to only access environment variables ",[416,1206,1207],{},"within the event lifecycle","  and not in global contexts since Cloudflare only makes them available during the request lifecycle and not before.",[413,1210,1211,1214,1215,1218,1219,1222],{},[416,1212,1213],{},"Example:"," If you have set the ",[421,1216,1217],{},"SECRET"," and ",[421,1220,1221],{},"NITRO_HELLO_THERE"," environment variables set you can access them in the following way:",[455,1224,1226],{"className":457,"code":1225,"language":459,"meta":5,"style":5},"import { defineHandler } from \"nitro\";\nimport { useRuntimeConfig } from \"nitro\u002Fruntime-config\";\n\nconsole.log(process.env.SECRET) \u002F\u002F note that this is in the global scope! so it doesn't actually work and the variable is undefined!\n\nexport default defineHandler((event) => {\n  \u002F\u002F note that all the below are valid ways of accessing the above mentioned variables\n  useRuntimeConfig().helloThere\n  useRuntimeConfig().secret\n  process.env.NITRO_HELLO_THERE\n  import.meta.env.SECRET\n});\n",[421,1227,1228,1241,1255,1259,1278,1282,1303,1308,1316,1323,1331,1347],{"__ignoreMap":5},[463,1229,1230,1232,1235,1237,1239],{"class":465,"line":466},[463,1231,470],{"class":469},[463,1233,1234],{"class":473}," { defineHandler } ",[463,1236,477],{"class":469},[463,1238,481],{"class":480},[463,1240,484],{"class":473},[463,1242,1243,1245,1248,1250,1253],{"class":465,"line":487},[463,1244,470],{"class":469},[463,1246,1247],{"class":473}," { useRuntimeConfig } ",[463,1249,477],{"class":469},[463,1251,1252],{"class":480}," \"nitro\u002Fruntime-config\"",[463,1254,484],{"class":473},[463,1256,1257],{"class":465,"line":494},[463,1258,491],{"emptyLinePlaceholder":490},[463,1260,1261,1264,1267,1270,1272,1275],{"class":465,"line":510},[463,1262,1263],{"class":473},"console.",[463,1265,1266],{"class":503},"log",[463,1268,1269],{"class":473},"(process.env.",[463,1271,1217],{"class":846},[463,1273,1274],{"class":473},") ",[463,1276,1277],{"class":701},"\u002F\u002F note that this is in the global scope! so it doesn't actually work and the variable is undefined!\n",[463,1279,1280],{"class":465,"line":519},[463,1281,491],{"emptyLinePlaceholder":490},[463,1283,1284,1286,1288,1291,1294,1296,1298,1301],{"class":465,"line":840},[463,1285,497],{"class":469},[463,1287,500],{"class":469},[463,1289,1290],{"class":503}," defineHandler",[463,1292,1293],{"class":473},"((",[463,1295,676],{"class":675},[463,1297,1274],{"class":473},[463,1299,1300],{"class":469},"=>",[463,1302,661],{"class":473},[463,1304,1305],{"class":465,"line":852},[463,1306,1307],{"class":701},"  \u002F\u002F note that all the below are valid ways of accessing the above mentioned variables\n",[463,1309,1310,1313],{"class":465,"line":858},[463,1311,1312],{"class":503},"  useRuntimeConfig",[463,1314,1315],{"class":473},"().helloThere\n",[463,1317,1318,1320],{"class":465,"line":864},[463,1319,1312],{"class":503},[463,1321,1322],{"class":473},"().secret\n",[463,1324,1325,1328],{"class":465,"line":879},[463,1326,1327],{"class":473},"  process.env.",[463,1329,1330],{"class":846},"NITRO_HELLO_THERE\n",[463,1332,1333,1336,1338,1341,1344],{"class":465,"line":892},[463,1334,1335],{"class":469},"  import",[463,1337,446],{"class":473},[463,1339,1340],{"class":846},"meta",[463,1342,1343],{"class":473},".env.",[463,1345,1346],{"class":846},"SECRET\n",[463,1348,1349],{"class":465,"line":897},[463,1350,980],{"class":473},[524,1352,1354],{"id":1353},"specify-variables-in-development-mode","Specify Variables in Development Mode",[413,1356,1357,1358,1195,1361,1364],{},"For development, you can use a ",[421,1359,1360],{},".env",[421,1362,1363],{},".env.local"," file to specify environment variables:",[455,1366,1370],{"className":1367,"code":1368,"language":1369,"meta":5,"style":5},"language-ini shiki shiki-themes github-light github-dark github-dark","NITRO_HELLO_THERE=\"captain\"\nSECRET=\"top-secret\"\n","ini",[421,1371,1372,1382],{"__ignoreMap":5},[463,1373,1374,1376,1379],{"class":465,"line":466},[463,1375,1221],{"class":469},[463,1377,1378],{"class":473},"=",[463,1380,1381],{"class":480},"\"captain\"\n",[463,1383,1384,1386,1388],{"class":465,"line":487},[463,1385,1217],{"class":469},[463,1387,1378],{"class":473},[463,1389,1390],{"class":480},"\"top-secret\"\n",[429,1392,1393],{},[413,1394,1395,1397,1398,1218,1400,1402,1403,1406],{},[416,1396,1175],{}," Make sure you add ",[421,1399,1360],{},[421,1401,1363],{}," to the ",[421,1404,1405],{},".gitignore"," file so that you don't commit it as it can contain sensitive information.",[524,1408,1410],{"id":1409},"specify-variables-for-local-previews","Specify Variables for local previews",[413,1412,1413,1414,1195,1416,1418,1419,1422,1423,1218,1428,1433],{},"After build, when you try out your project locally with ",[421,1415,544],{},[421,1417,1142],{},", in order to have access to environment variables you will need to specify the in a ",[421,1420,1421],{},".dev.vars"," file in the root of your project (as presented in the ",[435,1424,1427],{"href":1425,"rel":1426},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Fpages\u002Ffunctions\u002Fbindings\u002F#interact-with-your-environment-variables-locally",[444],"Pages",[435,1429,1432],{"href":1430,"rel":1431},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkers\u002Fconfiguration\u002Fenvironment-variables\u002F#interact-with-environment-variables-locally",[444],"Workers"," documentation).",[413,1435,1436,1437,1195,1439,1441,1442,1444],{},"If you are using a ",[421,1438,1360],{},[421,1440,1363],{}," file while developing, your ",[421,1443,1421],{}," should be identical to it.",[429,1446,1447],{},[413,1448,1449,1397,1451,1402,1453,1406],{},[416,1450,1175],{},[421,1452,1421],{},[421,1454,1405],{},[524,1456,1458],{"id":1457},"specify-variables-for-production","Specify Variables for Production",[413,1460,1461,1462,1469],{},"For production, use the Cloudflare dashboard or the ",[435,1463,1466],{"href":1464,"rel":1465},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkers\u002Fwrangler\u002Fcommands\u002F#secret",[444],[421,1467,1468],{},"wrangler secret"," command to set environment variables and secrets.",[524,1471,1473,1474,400,1477],{"id":1472},"specify-variables-using-wranglertomlwranglerjson","Specify Variables using ",[421,1475,1476],{},"wrangler.toml",[421,1478,1479],{},"wrangler.json",[413,1481,1482,1483,400,1485,1487],{},"You can specify a custom ",[421,1484,1476],{},[421,1486,1479],{}," file and define vars inside.",[717,1489,1490],{},[413,1491,1492],{},"Note that this isn't recommended for sensitive data like secrets.",[413,1494,1495],{},[416,1496,1213],{},[1498,1499,1500,1563],"code-group",{},[455,1501,1503],{"className":1367,"code":1502,"filename":1476,"language":1369,"meta":5,"style":5},"# Shared\n[vars]\nNITRO_HELLO_THERE=\"general\"\nSECRET=\"secret\"\n\n# Override values for `--env production` usage\n[env.production.vars]\nNITRO_HELLO_THERE=\"captain\"\nSECRET=\"top-secret\"\n",[421,1504,1505,1510,1515,1524,1533,1537,1542,1547,1555],{"__ignoreMap":5},[463,1506,1507],{"class":465,"line":466},[463,1508,1509],{"class":701},"# Shared\n",[463,1511,1512],{"class":465,"line":487},[463,1513,1514],{"class":503},"[vars]\n",[463,1516,1517,1519,1521],{"class":465,"line":494},[463,1518,1221],{"class":469},[463,1520,1378],{"class":473},[463,1522,1523],{"class":480},"\"general\"\n",[463,1525,1526,1528,1530],{"class":465,"line":510},[463,1527,1217],{"class":469},[463,1529,1378],{"class":473},[463,1531,1532],{"class":480},"\"secret\"\n",[463,1534,1535],{"class":465,"line":519},[463,1536,491],{"emptyLinePlaceholder":490},[463,1538,1539],{"class":465,"line":840},[463,1540,1541],{"class":701},"# Override values for `--env production` usage\n",[463,1543,1544],{"class":465,"line":852},[463,1545,1546],{"class":503},"[env.production.vars]\n",[463,1548,1549,1551,1553],{"class":465,"line":858},[463,1550,1221],{"class":469},[463,1552,1378],{"class":473},[463,1554,1381],{"class":480},[463,1556,1557,1559,1561],{"class":465,"line":864},[463,1558,1217],{"class":469},[463,1560,1378],{"class":473},[463,1562,1390],{"class":480},[455,1564,1568],{"className":1565,"code":1566,"filename":1479,"language":1567,"meta":5,"style":5},"language-json shiki shiki-themes github-light github-dark github-dark","{\n  \"vars\": {\n    \"NITRO_HELLO_THERE\": \"general\",\n    \"SECRET\": \"secret\"\n  },\n  \"env\": {\n    \"production\": {\n      \"vars\": {\n        \"NITRO_HELLO_THERE\": \"captain\",\n        \"SECRET\": \"top-secret\"\n      }\n    }\n  }\n}\n\n","json",[421,1569,1570,1574,1581,1593,1602,1606,1613,1620,1627,1639,1648,1653,1657,1662],{"__ignoreMap":5},[463,1571,1572],{"class":465,"line":466},[463,1573,996],{"class":473},[463,1575,1576,1579],{"class":465,"line":487},[463,1577,1578],{"class":846},"  \"vars\"",[463,1580,1004],{"class":473},[463,1582,1583,1586,1588,1591],{"class":465,"line":494},[463,1584,1585],{"class":846},"    \"NITRO_HELLO_THERE\"",[463,1587,1019],{"class":473},[463,1589,1590],{"class":480},"\"general\"",[463,1592,832],{"class":473},[463,1594,1595,1598,1600],{"class":465,"line":510},[463,1596,1597],{"class":846},"    \"SECRET\"",[463,1599,1019],{"class":473},[463,1601,1532],{"class":480},[463,1603,1604],{"class":465,"line":519},[463,1605,855],{"class":473},[463,1607,1608,1611],{"class":465,"line":840},[463,1609,1610],{"class":846},"  \"env\"",[463,1612,1004],{"class":473},[463,1614,1615,1618],{"class":465,"line":852},[463,1616,1617],{"class":846},"    \"production\"",[463,1619,1004],{"class":473},[463,1621,1622,1625],{"class":465,"line":858},[463,1623,1624],{"class":846},"      \"vars\"",[463,1626,1004],{"class":473},[463,1628,1629,1632,1634,1637],{"class":465,"line":864},[463,1630,1631],{"class":846},"        \"NITRO_HELLO_THERE\"",[463,1633,1019],{"class":473},[463,1635,1636],{"class":480},"\"captain\"",[463,1638,832],{"class":473},[463,1640,1641,1644,1646],{"class":465,"line":879},[463,1642,1643],{"class":846},"        \"SECRET\"",[463,1645,1019],{"class":473},[463,1647,1390],{"class":480},[463,1649,1650],{"class":465,"line":892},[463,1651,1652],{"class":473},"      }\n",[463,1654,1655],{"class":465,"line":897},[463,1656,1027],{"class":473},[463,1658,1660],{"class":465,"line":1659},13,[463,1661,707],{"class":473},[463,1663,1665],{"class":465,"line":1664},14,[463,1666,712],{"class":473},[408,1668,1670],{"id":1669},"direct-access-to-cloudflare-bindings","Direct access to Cloudflare bindings",[413,1672,1673,1674,1679,1680,1129],{},"Bindings are what allows you to interact with resources from the Cloudflare platform, examples of such resources are key-value data storages (",[435,1675,1678],{"href":1676,"rel":1677},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Fkv\u002F",[444],"KVs",") and serverless SQL databases (",[435,1681,1684],{"href":1682,"rel":1683},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Fd1\u002F",[444],"D1s",[425,1686,1687],{},[413,1688,1689,1690,1218,1694,1698],{},"For more details on Bindings and how to use them please refer to the Cloudflare ",[435,1691,1427],{"href":1692,"rel":1693},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Fpages\u002Ffunctions\u002Fbindings\u002F",[444],[435,1695,1432],{"href":1696,"rel":1697},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkers\u002Fconfiguration\u002Fbindings\u002F#bindings",[444]," documentation.",[1700,1701,1702],"tip",{},[413,1703,1704,1705,1218,1707,1709],{},"\nNitro provides high level API to interact with primitives such as ",[435,1706,78],{"href":79},[435,1708,38],{"href":39}," and you are highly recommended to prefer using them instead of directly depending on low-level APIs for usage stability.",[425,1711],{"to":39,"title":1712},"Database Layer",[425,1714],{"to":79,"title":78},[413,1716,1717,1718,1721],{},"In runtime, you can access bindings from the request event via ",[421,1719,1720],{},"event.req.runtime.cloudflare.env",". This is for example how you can access a D1 binding:",[455,1723,1725],{"className":457,"code":1724,"language":459,"meta":5,"style":5},"import { defineHandler } from \"nitro\";\n\ndefineHandler(async (event) => {\n  const { env } = event.req.runtime.cloudflare\n  const stmt = await env.MY_D1.prepare('SELECT id FROM table')\n  const { results } = await stmt.all()\n})\n",[421,1726,1727,1739,1743,1763,1782,1814,1838],{"__ignoreMap":5},[463,1728,1729,1731,1733,1735,1737],{"class":465,"line":466},[463,1730,470],{"class":469},[463,1732,1234],{"class":473},[463,1734,477],{"class":469},[463,1736,481],{"class":480},[463,1738,484],{"class":473},[463,1740,1741],{"class":465,"line":487},[463,1742,491],{"emptyLinePlaceholder":490},[463,1744,1745,1748,1750,1753,1755,1757,1759,1761],{"class":465,"line":494},[463,1746,1747],{"class":503},"defineHandler",[463,1749,672],{"class":473},[463,1751,1752],{"class":469},"async",[463,1754,1123],{"class":473},[463,1756,676],{"class":675},[463,1758,1274],{"class":473},[463,1760,1300],{"class":469},[463,1762,661],{"class":473},[463,1764,1765,1768,1771,1774,1777,1779],{"class":465,"line":510},[463,1766,1767],{"class":469},"  const",[463,1769,1770],{"class":473}," { ",[463,1772,1773],{"class":846},"env",[463,1775,1776],{"class":473}," } ",[463,1778,1378],{"class":469},[463,1780,1781],{"class":473}," event.req.runtime.cloudflare\n",[463,1783,1784,1786,1789,1792,1795,1798,1801,1803,1806,1808,1811],{"class":465,"line":519},[463,1785,1767],{"class":469},[463,1787,1788],{"class":846}," stmt",[463,1790,1791],{"class":469}," =",[463,1793,1794],{"class":469}," await",[463,1796,1797],{"class":473}," env.",[463,1799,1800],{"class":846},"MY_D1",[463,1802,446],{"class":473},[463,1804,1805],{"class":503},"prepare",[463,1807,672],{"class":473},[463,1809,1810],{"class":480},"'SELECT id FROM table'",[463,1812,1813],{"class":473},")\n",[463,1815,1816,1818,1820,1823,1825,1827,1829,1832,1835],{"class":465,"line":840},[463,1817,1767],{"class":469},[463,1819,1770],{"class":473},[463,1821,1822],{"class":846},"results",[463,1824,1776],{"class":473},[463,1826,1378],{"class":469},[463,1828,1794],{"class":469},[463,1830,1831],{"class":473}," stmt.",[463,1833,1834],{"class":503},"all",[463,1836,1837],{"class":473},"()\n",[463,1839,1840],{"class":465,"line":852},[463,1841,522],{"class":473},[524,1843,1845],{"id":1844},"access-to-the-bindings-in-local-dev","Access to the bindings in local dev",[413,1847,1848,1849,1854,1855,1862,1863,1866],{},"In development mode, Nitro emulates the Cloudflare environment using ",[435,1850,1853],{"href":1851,"rel":1852},"https:\u002F\u002Fminiflare.dev\u002F",[444],"Miniflare"," (the same ",[435,1856,1859],{"href":1857,"rel":1858},"https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fworkerd",[444],[421,1860,1861],{},"workerd"," runtime used by Wrangler and cloudflare workers in production). This means bindings are available natively from the request event — no separate proxy or ",[421,1864,1865],{},"wrangler"," installation is required.",[413,1868,1869,1870,400,1872,400,1874,1876],{},"To access bindings in dev mode, we first define them. You can do this in a ",[421,1871,988],{},[421,1873,1479],{},[421,1875,1476],{}," file:",[1498,1878,1879,1931],{},[455,1880,1882],{"className":1367,"code":1881,"filename":1476,"language":1369,"meta":5,"style":5},"[vars]\nMY_VARIABLE=\"my-value\"\n\n[[kv_namespaces]]\nbinding = \"MY_KV\"\nid = \"xxx\"\n",[421,1883,1884,1888,1898,1902,1910,1921],{"__ignoreMap":5},[463,1885,1886],{"class":465,"line":466},[463,1887,1514],{"class":503},[463,1889,1890,1893,1895],{"class":465,"line":487},[463,1891,1892],{"class":469},"MY_VARIABLE",[463,1894,1378],{"class":473},[463,1896,1897],{"class":480},"\"my-value\"\n",[463,1899,1900],{"class":465,"line":494},[463,1901,491],{"emptyLinePlaceholder":490},[463,1903,1904,1907],{"class":465,"line":510},[463,1905,1906],{"class":503},"[[kv_namespaces]",[463,1908,1909],{"class":473},"]\n",[463,1911,1912,1915,1918],{"class":465,"line":519},[463,1913,1914],{"class":469},"binding",[463,1916,1917],{"class":473}," = ",[463,1919,1920],{"class":480},"\"MY_KV\"\n",[463,1922,1923,1926,1928],{"class":465,"line":840},[463,1924,1925],{"class":469},"id",[463,1927,1917],{"class":473},[463,1929,1930],{"class":480},"\"xxx\"\n",[455,1932,1934],{"className":1565,"code":1933,"filename":1479,"language":1567,"meta":5,"style":5},"{\n  \"vars\": {\n    \"MY_VARIABLE\": \"my-value\",\n  },\n  \"kv_namespaces\": [\n    {\n      \"binding\": \"MY_KV\",\n      \"id\": \"xxx\"\n    }\n  ]\n}\n",[421,1935,1936,1940,1946,1958,1962,1970,1975,1987,1996,2000,2005],{"__ignoreMap":5},[463,1937,1938],{"class":465,"line":466},[463,1939,996],{"class":473},[463,1941,1942,1944],{"class":465,"line":487},[463,1943,1578],{"class":846},[463,1945,1004],{"class":473},[463,1947,1948,1951,1953,1956],{"class":465,"line":494},[463,1949,1950],{"class":846},"    \"MY_VARIABLE\"",[463,1952,1019],{"class":473},[463,1954,1955],{"class":480},"\"my-value\"",[463,1957,832],{"class":473},[463,1959,1960],{"class":465,"line":510},[463,1961,855],{"class":473},[463,1963,1964,1967],{"class":465,"line":519},[463,1965,1966],{"class":846},"  \"kv_namespaces\"",[463,1968,1969],{"class":473},": [\n",[463,1971,1972],{"class":465,"line":840},[463,1973,1974],{"class":473},"    {\n",[463,1976,1977,1980,1982,1985],{"class":465,"line":852},[463,1978,1979],{"class":846},"      \"binding\"",[463,1981,1019],{"class":473},[463,1983,1984],{"class":480},"\"MY_KV\"",[463,1986,832],{"class":473},[463,1988,1989,1992,1994],{"class":465,"line":858},[463,1990,1991],{"class":846},"      \"id\"",[463,1993,1019],{"class":473},[463,1995,1930],{"class":480},[463,1997,1998],{"class":465,"line":864},[463,1999,1027],{"class":473},[463,2001,2002],{"class":465,"line":879},[463,2003,2004],{"class":473},"  ]\n",[463,2006,2007],{"class":465,"line":892},[463,2008,712],{"class":473},[413,2010,2011,2012,2014,2015,2018,2019,2021],{},"Alternatively, you can define bindings inline in your ",[421,2013,452],{}," using the ",[421,2016,2017],{},"cloudflare.wrangler"," option (it accepts the same shape as ",[421,2020,1479],{},"):",[455,2023,2025],{"className":457,"code":2024,"filename":452,"language":459,"meta":5,"style":5},"import { defineConfig } from \"nitro\";\n\nexport default defineConfig({\n  preset: \"cloudflare_module\",\n  cloudflare: {\n    wrangler: {\n      vars: {\n        MY_VARIABLE: \"my-value\",\n      },\n      kv_namespaces: [{ binding: \"MY_KV\", id: \"xxx\" }],\n    },\n  },\n})\n",[421,2026,2027,2039,2043,2053,2061,2065,2070,2075,2084,2089,2105,2110,2114],{"__ignoreMap":5},[463,2028,2029,2031,2033,2035,2037],{"class":465,"line":466},[463,2030,470],{"class":469},[463,2032,474],{"class":473},[463,2034,477],{"class":469},[463,2036,481],{"class":480},[463,2038,484],{"class":473},[463,2040,2041],{"class":465,"line":487},[463,2042,491],{"emptyLinePlaceholder":490},[463,2044,2045,2047,2049,2051],{"class":465,"line":494},[463,2046,497],{"class":469},[463,2048,500],{"class":469},[463,2050,504],{"class":503},[463,2052,507],{"class":473},[463,2054,2055,2057,2059],{"class":465,"line":510},[463,2056,826],{"class":473},[463,2058,829],{"class":480},[463,2060,832],{"class":473},[463,2062,2063],{"class":465,"line":519},[463,2064,753],{"class":473},[463,2066,2067],{"class":465,"line":840},[463,2068,2069],{"class":473},"    wrangler: {\n",[463,2071,2072],{"class":465,"line":852},[463,2073,2074],{"class":473},"      vars: {\n",[463,2076,2077,2080,2082],{"class":465,"line":858},[463,2078,2079],{"class":473},"        MY_VARIABLE: ",[463,2081,1955],{"class":480},[463,2083,832],{"class":473},[463,2085,2086],{"class":465,"line":864},[463,2087,2088],{"class":473},"      },\n",[463,2090,2091,2094,2096,2099,2102],{"class":465,"line":879},[463,2092,2093],{"class":473},"      kv_namespaces: [{ binding: ",[463,2095,1984],{"class":480},[463,2097,2098],{"class":473},", id: ",[463,2100,2101],{"class":480},"\"xxx\"",[463,2103,2104],{"class":473}," }],\n",[463,2106,2107],{"class":465,"line":892},[463,2108,2109],{"class":473},"    },\n",[463,2111,2112],{"class":465,"line":897},[463,2113,855],{"class":473},[463,2115,2116],{"class":465,"line":1659},[463,2117,522],{"class":473},[413,2119,2120],{},"From this moment, when running",[538,2122],{"script":2123},"dev",[413,2125,2126,2127,1218,2129,2132],{},"you will be able to access ",[421,2128,1892],{},[421,2130,2131],{},"MY_KV"," from the request event just as illustrated above.",[2134,2135,2137],"h4",{"id":2136},"wrangler-environments","Wrangler environments",[413,2139,2140,2141,2144],{},"If you have multiple Wrangler environments, you can specify which one to use during local dev emulation with the ",[421,2142,2143],{},"cloudflare.wranglerEnv"," option:",[455,2146,2148],{"className":457,"code":2147,"filename":452,"language":459,"meta":5,"style":5},"import { defineConfig } from \"nitro\";\n\nexport default defineConfig({\n  preset: 'cloudflare_module',\n  cloudflare: {\n    wranglerEnv: 'preview'\n  }\n})\n",[421,2149,2150,2162,2166,2176,2185,2189,2197,2201],{"__ignoreMap":5},[463,2151,2152,2154,2156,2158,2160],{"class":465,"line":466},[463,2153,470],{"class":469},[463,2155,474],{"class":473},[463,2157,477],{"class":469},[463,2159,481],{"class":480},[463,2161,484],{"class":473},[463,2163,2164],{"class":465,"line":487},[463,2165,491],{"emptyLinePlaceholder":490},[463,2167,2168,2170,2172,2174],{"class":465,"line":494},[463,2169,497],{"class":469},[463,2171,500],{"class":469},[463,2173,504],{"class":503},[463,2175,507],{"class":473},[463,2177,2178,2180,2183],{"class":465,"line":510},[463,2179,826],{"class":473},[463,2181,2182],{"class":480},"'cloudflare_module'",[463,2184,832],{"class":473},[463,2186,2187],{"class":465,"line":519},[463,2188,753],{"class":473},[463,2190,2191,2194],{"class":465,"line":840},[463,2192,2193],{"class":473},"    wranglerEnv: ",[463,2195,2196],{"class":480},"'preview'\n",[463,2198,2199],{"class":465,"line":852},[463,2200,707],{"class":473},[463,2202,2203],{"class":465,"line":858},[463,2204,522],{"class":473},[2206,2207,2208],"style",{},"html pre.shiki code .so5gQ, html code.shiki .so5gQ{--shiki-light:#D73A49;--shiki-default:#F97583;--shiki-dark:#F97583}html pre.shiki code .slsVL, html code.shiki .slsVL{--shiki-light:#24292E;--shiki-default:#E1E4E8;--shiki-dark:#E1E4E8}html pre.shiki code .sfrk1, html code.shiki .sfrk1{--shiki-light:#032F62;--shiki-default:#9ECBFF;--shiki-dark:#9ECBFF}html pre.shiki code .shcOC, html code.shiki .shcOC{--shiki-light:#6F42C1;--shiki-default:#B392F0;--shiki-dark:#B392F0}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sQHwn, html code.shiki .sQHwn{--shiki-light:#E36209;--shiki-default:#FFAB70;--shiki-dark:#FFAB70}html pre.shiki code .sCsY4, html code.shiki .sCsY4{--shiki-light:#6A737D;--shiki-default:#6A737D;--shiki-dark:#6A737D}html pre.shiki code .suiK_, html code.shiki .suiK_{--shiki-light:#005CC5;--shiki-default:#79B8FF;--shiki-dark:#79B8FF}",{"title":5,"searchDepth":487,"depth":487,"links":2210},[2211,2219,2223,2224,2231],{"id":410,"depth":487,"text":411,"children":2212},[2213,2214,2215,2216,2217,2218],{"id":526,"depth":494,"text":527},{"id":547,"depth":494,"text":548},{"id":566,"depth":494,"text":567},{"id":629,"depth":494,"text":630},{"id":772,"depth":494,"text":773},{"id":905,"depth":494,"text":906},{"id":1038,"depth":487,"text":1039,"children":2220},[2221,2222],{"id":1132,"depth":494,"text":527},{"id":1145,"depth":494,"text":548},{"id":1158,"depth":487,"text":1159},{"id":1187,"depth":487,"text":1188,"children":2225},[2226,2227,2228,2229],{"id":1353,"depth":494,"text":1354},{"id":1409,"depth":494,"text":1410},{"id":1457,"depth":494,"text":1458},{"id":1472,"depth":494,"text":2230},"Specify Variables using wrangler.toml\u002Fwrangler.json",{"id":1669,"depth":487,"text":1670,"children":2232},[2233],{"id":1844,"depth":494,"text":1845},"Deploy Nitro apps to Cloudflare.","md",{},{},{"title":147,"description":2234},"dsfVKSKd6ffe8_Kl1sggtXBgNPLDtrq2xeuyZBJH9iY",[2241,2243],{"title":143,"path":144,"stem":145,"description":2242,"children":-1},"Deploy Nitro apps to Cleavr.",{"title":151,"path":152,"stem":153,"description":2244,"children":-1},"Deploy Nitro apps to Deno Deploy.",1783605726895]