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