[{"data":1,"prerenderedAt":1779},["ShallowReactive",2],{"navigation":3,"-deploy-providers-cloudflare":217,"-deploy-providers-cloudflare-surround":1774},[4,83,208,214],{"title":5,"path":6,"stem":7,"children":8,"icon":82},"","/docs","1.docs/1.index",[9,12,17,22,27,32,37,42,47,52,57,62,67,72,77],{"title":10,"path":6,"stem":7,"icon":11},"Introduction","i-lucide-compass",{"title":13,"path":14,"stem":15,"icon":16},"Quick Start","/docs/quick-start","1.docs/2.quick-start","i-lucide-zap",{"title":18,"path":19,"stem":20,"icon":21},"Renderer","/docs/renderer","1.docs/4.renderer","ri:layout-masonry-line",{"title":23,"path":24,"stem":25,"icon":26},"Routing","/docs/routing","1.docs/5.routing","ri:direction-line",{"title":28,"path":29,"stem":30,"icon":31},"Assets","/docs/assets","1.docs/50.assets","ri:image-2-line",{"title":33,"path":34,"stem":35,"icon":36},"Configuration","/docs/configuration","1.docs/50.configuration","ri:settings-3-line",{"title":38,"path":39,"stem":40,"icon":41},"Database","/docs/database","1.docs/50.database","ri:database-2-line",{"title":43,"path":44,"stem":45,"icon":46},"Lifecycle","/docs/lifecycle","1.docs/50.lifecycle","i-lucide-layers",{"title":48,"path":49,"stem":50,"icon":51},"Plugins","/docs/plugins","1.docs/50.plugins","ri:plug-line",{"title":53,"path":54,"stem":55,"icon":56},"Tasks","/docs/tasks","1.docs/50.tasks","codicon:run-all",{"title":58,"path":59,"stem":60,"icon":61},"Server Entry","/docs/server-entry","1.docs/6.server-entry","ri:server-line",{"title":63,"path":64,"stem":65,"icon":66},"Cache","/docs/cache","1.docs/7.cache","ri:speed-line",{"title":68,"path":69,"stem":70,"icon":71},"KV Storage","/docs/storage","1.docs/8.storage","carbon:datastore",{"title":73,"path":74,"stem":75,"icon":76},"Migration Guide","/docs/migration","1.docs/99.migration","ri:arrow-right-up-line",{"title":78,"path":79,"stem":80,"icon":81},"Nightly Channel","/docs/nightly","1.docs/99.nightly","ri:moon-fill","i-lucide-book-open",{"title":84,"path":85,"stem":86,"children":87,"icon":89},"Deploy","/deploy","2.deploy/0.index",[88,90,111],{"title":84,"path":85,"stem":86,"icon":89},"ri:upload-cloud-2-line",{"title":91,"path":92,"stem":93,"children":94,"page":110},"Runtimes","/deploy/runtimes","2.deploy/10.runtimes",[95,100,105],{"title":96,"path":97,"stem":98,"icon":99},"Node.js","/deploy/runtimes/node","2.deploy/10.runtimes/1.node","akar-icons:node-fill",{"title":101,"path":102,"stem":103,"icon":104},"Bun","/deploy/runtimes/bun","2.deploy/10.runtimes/bun","simple-icons:bun",{"title":106,"path":107,"stem":108,"icon":109},"Deno","/deploy/runtimes/deno","2.deploy/10.runtimes/deno","simple-icons:deno",false,{"title":112,"path":113,"stem":114,"children":115,"page":110},"Providers","/deploy/providers","2.deploy/20.providers",[116,120,124,128,132,136,140,144,148,152,156,160,164,168,172,176,180,184,188,192,196,200,204],{"title":117,"path":118,"stem":119},"Alwaysdata","/deploy/providers/alwaysdata","2.deploy/20.providers/alwaysdata",{"title":121,"path":122,"stem":123},"AWS Lambda","/deploy/providers/aws","2.deploy/20.providers/aws",{"title":125,"path":126,"stem":127},"AWS Amplify","/deploy/providers/aws-amplify","2.deploy/20.providers/aws-amplify",{"title":129,"path":130,"stem":131},"Azure","/deploy/providers/azure","2.deploy/20.providers/azure",{"title":133,"path":134,"stem":135},"Cleavr","/deploy/providers/cleavr","2.deploy/20.providers/cleavr",{"title":137,"path":138,"stem":139},"Cloudflare","/deploy/providers/cloudflare","2.deploy/20.providers/cloudflare",{"title":141,"path":142,"stem":143},"Deno Deploy","/deploy/providers/deno-deploy","2.deploy/20.providers/deno-deploy",{"title":145,"path":146,"stem":147},"DigitalOcean","/deploy/providers/digitalocean","2.deploy/20.providers/digitalocean",{"title":149,"path":150,"stem":151},"Firebase","/deploy/providers/firebase","2.deploy/20.providers/firebase",{"title":153,"path":154,"stem":155},"Flightcontrol","/deploy/providers/flightcontrol","2.deploy/20.providers/flightcontrol",{"title":157,"path":158,"stem":159},"Genezio","/deploy/providers/genezio","2.deploy/20.providers/genezio",{"title":161,"path":162,"stem":163},"GitHub Pages","/deploy/providers/github-pages","2.deploy/20.providers/github-pages",{"title":165,"path":166,"stem":167},"GitLab Pages","/deploy/providers/gitlab-pages","2.deploy/20.providers/gitlab-pages",{"title":169,"path":170,"stem":171},"Heroku","/deploy/providers/heroku","2.deploy/20.providers/heroku",{"title":173,"path":174,"stem":175},"IIS","/deploy/providers/iis","2.deploy/20.providers/iis",{"title":177,"path":178,"stem":179},"Koyeb","/deploy/providers/koyeb","2.deploy/20.providers/koyeb",{"title":181,"path":182,"stem":183},"Netlify","/deploy/providers/netlify","2.deploy/20.providers/netlify",{"title":185,"path":186,"stem":187},"Platform.sh","/deploy/providers/platform-sh","2.deploy/20.providers/platform-sh",{"title":189,"path":190,"stem":191},"Render.com","/deploy/providers/render","2.deploy/20.providers/render",{"title":193,"path":194,"stem":195},"StormKit","/deploy/providers/stormkit","2.deploy/20.providers/stormkit",{"title":197,"path":198,"stem":199},"Vercel","/deploy/providers/vercel","2.deploy/20.providers/vercel",{"title":201,"path":202,"stem":203},"Zeabur","/deploy/providers/zeabur","2.deploy/20.providers/zeabur",{"title":205,"path":206,"stem":207},"Zerops","/deploy/providers/zerops","2.deploy/20.providers/zerops",{"title":209,"path":210,"stem":211,"children":212,"icon":36},"Config","/config","3.config/0.index",[213],{"title":209,"path":210,"stem":211,"icon":36},{"title":5,"path":215,"stem":216},"/","index",{"id":218,"title":137,"body":219,"description":1768,"extension":1769,"meta":1770,"navigation":1771,"path":138,"seo":1772,"stem":139,"__hash__":1773},"content/2.deploy/20.providers/cloudflare.md",{"type":220,"value":221,"toc":1746},"minimark",[222,227,239,243,262,272,279,395,418,437,442,451,455,459,463,466,469,472,475,478,482,494,497,540,544,551,554,560,571,576,643,660,663,668,670,673,676,679,681,683,686,690,699,715,719,730,739,753,874,878,888,914,930,934,957,968,978,982,993,1002,1010,1015,1019,1196,1200,1214,1228,1239,1242,1244,1251,1372,1376,1385,1399,1404,1536,1539,1665,1670,1680,1684,1687,1727,1730,1733,1742],[223,224,226],"h2",{"id":225},"cloudflare-workers","Cloudflare Workers",[228,229,230,234,235],"p",{},[231,232,233],"strong",{},"Preset:"," ",[236,237,238],"code",{},"cloudflare_module",[240,241],"read-more",{"to":242,"title":226},"https://developers.cloudflare.com/workers/",[244,245,246],"note",{},[228,247,248,249,254,255,261],{},"Integration with this provider is possible with ",[250,251,253],"a",{"href":252},"/deploy#zero-config-providers","zero configuration"," supporting ",[250,256,260],{"href":257,"rel":258},"https://developers.cloudflare.com/workers/ci-cd/builds/",[259],"nofollow","workers builds (beta)",".",[263,264,265],"important",{},[228,266,267,268,271],{},"To use Workers with Static Assets, you need a Nitro compatibility date set to ",[236,269,270],{},"2024-09-19"," or later.",[228,273,274,275,278],{},"The following shows an example ",[236,276,277],{},"nitro.config.ts"," file for deploying a Nitro app to Cloudflare Workers.",[280,281,285],"pre",{"className":282,"code":283,"filename":277,"language":284,"meta":5,"style":5},"language-ts shiki shiki-themes github-light github-dark github-dark","import { defineNitroConfig } from \"nitro/config\";\n\nexport default defineNitroConfig({\n    compatibilityDate: \"2024-09-19\",\n    preset: \"cloudflare_module\",\n    cloudflare: {\n      deployConfig: true,\n      nodeCompat: true\n    }\n})\n","ts",[236,286,287,310,317,333,345,356,362,374,383,389],{"__ignoreMap":5},[288,289,292,296,300,303,307],"span",{"class":290,"line":291},"line",1,[288,293,295],{"class":294},"so5gQ","import",[288,297,299],{"class":298},"slsVL"," { defineNitroConfig } ",[288,301,302],{"class":294},"from",[288,304,306],{"class":305},"sfrk1"," \"nitro/config\"",[288,308,309],{"class":298},";\n",[288,311,313],{"class":290,"line":312},2,[288,314,316],{"emptyLinePlaceholder":315},true,"\n",[288,318,320,323,326,330],{"class":290,"line":319},3,[288,321,322],{"class":294},"export",[288,324,325],{"class":294}," default",[288,327,329],{"class":328},"shcOC"," defineNitroConfig",[288,331,332],{"class":298},"({\n",[288,334,336,339,342],{"class":290,"line":335},4,[288,337,338],{"class":298},"    compatibilityDate: ",[288,340,341],{"class":305},"\"2024-09-19\"",[288,343,344],{"class":298},",\n",[288,346,348,351,354],{"class":290,"line":347},5,[288,349,350],{"class":298},"    preset: ",[288,352,353],{"class":305},"\"cloudflare_module\"",[288,355,344],{"class":298},[288,357,359],{"class":290,"line":358},6,[288,360,361],{"class":298},"    cloudflare: {\n",[288,363,365,368,372],{"class":290,"line":364},7,[288,366,367],{"class":298},"      deployConfig: ",[288,369,371],{"class":370},"suiK_","true",[288,373,344],{"class":298},[288,375,377,380],{"class":290,"line":376},8,[288,378,379],{"class":298},"      nodeCompat: ",[288,381,382],{"class":370},"true\n",[288,384,386],{"class":290,"line":385},9,[288,387,388],{"class":298},"    }\n",[288,390,392],{"class":290,"line":391},10,[288,393,394],{"class":298},"})\n",[228,396,397,398,401,402,405,406,411,412,417],{},"By setting ",[236,399,400],{},"deployConfig: true",", Nitro will automatically generate a ",[236,403,404],{},"wrangler.json"," for you with the correct configuration.\nIf you need to add ",[250,407,410],{"href":408,"rel":409},"https://developers.cloudflare.com/workers/wrangler/configuration/",[259],"Cloudflare Workers configuration",", such as ",[250,413,416],{"href":414,"rel":415},"https://developers.cloudflare.com/workers/runtime-apis/bindings/",[259],"bindings",", you can either:",[419,420,421,431],"ul",{},[422,423,424,425,428,429,261],"li",{},"Set these in your Nitro config under the ",[236,426,427],{},"cloudflare: { wrangler : {} }",". This has the same type as ",[236,430,404],{},[422,432,433,434,436],{},"Provide your own ",[236,435,404],{},". Nitro will merge your config with the appropriate settings, including pointing to the build output.",[438,439,441],"h3",{"id":440},"local-preview","Local Preview",[228,443,444,445,450],{},"You can use ",[250,446,449],{"href":447,"rel":448},"https://github.com/cloudflare/workers-sdk/tree/main/packages/wrangler",[259],"Wrangler"," to preview your app locally:",[452,453],"pm-run",{"script":454},"build",[456,457],"pm-x",{"command":458},"wrangler dev",[438,460,462],{"id":461},"manual-deploy","Manual Deploy",[228,464,465],{},"After having built your application you can manually deploy it with Wrangler.",[228,467,468],{},"First make sure to be logged into your Cloudflare account:",[456,470],{"command":471},"wrangler login",[228,473,474],{},"Then you can deploy the application with:",[456,476],{"command":477},"wrangler deploy",[438,479,481],{"id":480},"runtime-hooks","Runtime Hooks",[228,483,444,484,488,489,261],{},[250,485,487],{"href":486},"/docs/plugins#nitro-runtime-hooks","runtime hooks"," below in order to extend ",[250,490,493],{"href":491,"rel":492},"https://developers.cloudflare.com/workers/runtime-apis/handlers/",[259],"Worker handlers",[240,495],{"to":496},"/guide/plugins#nitro-runtime-hooks",[419,498,499,508,517,526,535],{},[422,500,501],{},[250,502,505],{"href":503,"rel":504},"https://developers.cloudflare.com/workers/runtime-apis/handlers/scheduled/",[259],[236,506,507],{},"cloudflare:scheduled",[422,509,510],{},[250,511,514],{"href":512,"rel":513},"https://developers.cloudflare.com/email-routing/email-workers/runtime-api/",[259],[236,515,516],{},"cloudflare:email",[422,518,519],{},[250,520,523],{"href":521,"rel":522},"https://developers.cloudflare.com/queues/configuration/javascript-apis/#consumer",[259],[236,524,525],{},"cloudflare:queue",[422,527,528],{},[250,529,532],{"href":530,"rel":531},"https://developers.cloudflare.com/workers/runtime-apis/handlers/tail/",[259],[236,533,534],{},"cloudflare:tail",[422,536,537],{},[236,538,539],{},"cloudflare:trace",[223,541,543],{"id":542},"cloudflare-pages","Cloudflare Pages",[228,545,546,234,548],{},[231,547,233],{},[236,549,550],{},"cloudflare_pages",[240,552],{"to":553,"title":543},"https://pages.cloudflare.com/",[244,555,556],{},[228,557,248,558,261],{},[250,559,253],{"href":252},[561,562,563],"warning",{},[228,564,565,566,570],{},"Cloudflare ",[250,567,569],{"href":568},"#cloudflare-workers","Workers Module"," is the new recommended preset for deployments. Please consider using the pages only if you need specific features.",[228,572,274,573,575],{},[236,574,277],{}," file for deploying a Nitro app to Cloudflare Pages.",[280,577,579],{"className":282,"code":578,"filename":277,"language":284,"meta":5,"style":5},"import { defineNitroConfig } from \"nitro/config\";\n\nexport default defineNitroConfig({\n    preset: \"cloudflare_pages\",\n    cloudflare: {\n      deployConfig: true,\n      nodeCompat:true\n    }\n})\n",[236,580,581,593,597,607,616,620,628,635,639],{"__ignoreMap":5},[288,582,583,585,587,589,591],{"class":290,"line":291},[288,584,295],{"class":294},[288,586,299],{"class":298},[288,588,302],{"class":294},[288,590,306],{"class":305},[288,592,309],{"class":298},[288,594,595],{"class":290,"line":312},[288,596,316],{"emptyLinePlaceholder":315},[288,598,599,601,603,605],{"class":290,"line":319},[288,600,322],{"class":294},[288,602,325],{"class":294},[288,604,329],{"class":328},[288,606,332],{"class":298},[288,608,609,611,614],{"class":290,"line":335},[288,610,350],{"class":298},[288,612,613],{"class":305},"\"cloudflare_pages\"",[288,615,344],{"class":298},[288,617,618],{"class":290,"line":347},[288,619,361],{"class":298},[288,621,622,624,626],{"class":290,"line":358},[288,623,367],{"class":298},[288,625,371],{"class":370},[288,627,344],{"class":298},[288,629,630,633],{"class":290,"line":364},[288,631,632],{"class":298},"      nodeCompat:",[288,634,382],{"class":370},[288,636,637],{"class":290,"line":376},[288,638,388],{"class":298},[288,640,641],{"class":290,"line":385},[288,642,394],{"class":298},[228,644,645,646,649,650,653,654,659],{},"Nitro automatically generates a ",[236,647,648],{},"_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 ",[236,651,652],{},"cloudflare.pages.routes"," (",[250,655,658],{"href":656,"rel":657},"https://developers.cloudflare.com/pages/platform/functions/routing/#functions-invocation-routes",[259],"read more",").",[438,661,441],{"id":662},"local-preview-1",[228,664,444,665,450],{},[250,666,449],{"href":447,"rel":667},[259],[452,669],{"script":454},[456,671],{"command":672},"wrangler pages dev",[438,674,462],{"id":675},"manual-deploy-1",[228,677,678],{},"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:",[456,680],{"command":471},[228,682,474],{},[456,684],{"command":685},"wrangler pages deploy",[223,687,689],{"id":688},"deploy-within-cicd-using-github-actions","Deploy within CI/CD using GitHub Actions",[228,691,692,693,698],{},"Regardless on whether you're using Cloudflare Pages or Cloudflare Workers, you can use the ",[250,694,697],{"href":695,"rel":696},"https://github.com/marketplace/actions/deploy-to-cloudflare-workers-with-wrangler",[259],"Wrangler GitHub actions"," to deploy your application.",[244,700,701],{},[228,702,703,706,707,711,712,714],{},[231,704,705],{},"Note:"," Remember to ",[250,708,710],{"href":709},"/deploy#changing-the-deployment-preset","instruct Nitro to use the correct preset"," (note that this is necessary for all presets including the ",[236,713,550],{}," one).",[223,716,718],{"id":717},"environment-variables","Environment Variables",[228,720,721,722,725,726,729],{},"Nitro allows you to universally access environment variables using ",[236,723,724],{},"process.env"," or ",[236,727,728],{},"import.meta.env"," or the runtime config.",[244,731,732],{},[228,733,734,735,738],{},"Make sure to only access environment variables ",[231,736,737],{},"within the event lifecycle","  and not in global contexts since Cloudflare only makes them available during the request lifecycle and not before.",[228,740,741,744,745,748,749,752],{},[231,742,743],{},"Example:"," If you have set the ",[236,746,747],{},"SECRET"," and ",[236,750,751],{},"NITRO_HELLO_THERE"," environment variables set you can access them in the following way:",[280,754,756],{"className":282,"code":755,"language":284,"meta":5,"style":5},"import { defineHandler } from \"nitro/h3\";\n\nconsole.log(process.env.SECRET) // 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  // note that all the below are valid ways of accessing the above mentioned variables\n  useRuntimeConfig(event).helloThere\n  useRuntimeConfig(event).secret\n  process.env.NITRO_HELLO_THERE\n  import.meta.env.SECRET\n});\n",[236,757,758,772,776,796,800,824,829,837,844,852,868],{"__ignoreMap":5},[288,759,760,762,765,767,770],{"class":290,"line":291},[288,761,295],{"class":294},[288,763,764],{"class":298}," { defineHandler } ",[288,766,302],{"class":294},[288,768,769],{"class":305}," \"nitro/h3\"",[288,771,309],{"class":298},[288,773,774],{"class":290,"line":312},[288,775,316],{"emptyLinePlaceholder":315},[288,777,778,781,784,787,789,792],{"class":290,"line":319},[288,779,780],{"class":298},"console.",[288,782,783],{"class":328},"log",[288,785,786],{"class":298},"(process.env.",[288,788,747],{"class":370},[288,790,791],{"class":298},") ",[288,793,795],{"class":794},"sCsY4","// note that this is in the global scope! so it doesn't actually work and the variable is undefined!\n",[288,797,798],{"class":290,"line":335},[288,799,316],{"emptyLinePlaceholder":315},[288,801,802,804,806,809,812,816,818,821],{"class":290,"line":347},[288,803,322],{"class":294},[288,805,325],{"class":294},[288,807,808],{"class":328}," defineHandler",[288,810,811],{"class":298},"((",[288,813,815],{"class":814},"sQHwn","event",[288,817,791],{"class":298},[288,819,820],{"class":294},"=>",[288,822,823],{"class":298}," {\n",[288,825,826],{"class":290,"line":358},[288,827,828],{"class":794},"  // note that all the below are valid ways of accessing the above mentioned variables\n",[288,830,831,834],{"class":290,"line":364},[288,832,833],{"class":328},"  useRuntimeConfig",[288,835,836],{"class":298},"(event).helloThere\n",[288,838,839,841],{"class":290,"line":376},[288,840,833],{"class":328},[288,842,843],{"class":298},"(event).secret\n",[288,845,846,849],{"class":290,"line":385},[288,847,848],{"class":298},"  process.env.",[288,850,851],{"class":370},"NITRO_HELLO_THERE\n",[288,853,854,857,859,862,865],{"class":290,"line":391},[288,855,856],{"class":294},"  import",[288,858,261],{"class":298},[288,860,861],{"class":370},"meta",[288,863,864],{"class":298},".env.",[288,866,867],{"class":370},"SECRET\n",[288,869,871],{"class":290,"line":870},11,[288,872,873],{"class":298},"});\n",[438,875,877],{"id":876},"specify-variables-in-development-mode","Specify Variables in Development Mode",[228,879,880,881,725,884,887],{},"For development, you can use a ",[236,882,883],{},".env",[236,885,886],{},".env.local"," file to specify environment variables:",[280,889,893],{"className":890,"code":891,"language":892,"meta":5,"style":5},"language-ini shiki shiki-themes github-light github-dark github-dark","NITRO_HELLO_THERE=\"captain\"\nSECRET=\"top-secret\"\n","ini",[236,894,895,905],{"__ignoreMap":5},[288,896,897,899,902],{"class":290,"line":291},[288,898,751],{"class":294},[288,900,901],{"class":298},"=",[288,903,904],{"class":305},"\"captain\"\n",[288,906,907,909,911],{"class":290,"line":312},[288,908,747],{"class":294},[288,910,901],{"class":298},[288,912,913],{"class":305},"\"top-secret\"\n",[244,915,916],{},[228,917,918,920,921,748,923,925,926,929],{},[231,919,705],{}," Make sure you add ",[236,922,883],{},[236,924,886],{}," to the ",[236,927,928],{},".gitignore"," file so that you don't commit it as it can contain sensitive information.",[438,931,933],{"id":932},"specify-variables-for-local-previews","Specify Variables for local previews",[228,935,936,937,725,939,941,942,945,946,748,951,956],{},"After build, when you try out your project locally with ",[236,938,458],{},[236,940,672],{},", in order to have access to environment variables you will need to specify the in a ",[236,943,944],{},".dev.vars"," file in the root of your project (as presented in the ",[250,947,950],{"href":948,"rel":949},"https://developers.cloudflare.com/pages/functions/bindings/#interact-with-your-environment-variables-locally",[259],"Pages",[250,952,955],{"href":953,"rel":954},"https://developers.cloudflare.com/workers/configuration/environment-variables/#interact-with-environment-variables-locally",[259],"Workers"," documentation).",[228,958,959,960,725,962,964,965,967],{},"If you are using a ",[236,961,883],{},[236,963,886],{}," file while developing, your ",[236,966,944],{}," should be identical to it.",[244,969,970],{},[228,971,972,920,974,925,976,929],{},[231,973,705],{},[236,975,944],{},[236,977,928],{},[438,979,981],{"id":980},"specify-variables-for-production","Specify Variables for Production",[228,983,984,985,992],{},"For production, use the Cloudflare dashboard or the ",[250,986,989],{"href":987,"rel":988},"https://developers.cloudflare.com/workers/wrangler/commands/#secret",[259],[236,990,991],{},"wrangler secret"," command to set environment variables and secrets.",[438,994,996,997,215,1000],{"id":995},"specify-variables-using-wranglertomlwranglerjson","Specify Variables using ",[236,998,999],{},"wrangler.toml",[236,1001,404],{},[228,1003,1004,1005,215,1007,1009],{},"You can specify a custom ",[236,1006,999],{},[236,1008,404],{}," file and define vars inside.",[561,1011,1012],{},[228,1013,1014],{},"Note that this isn't recommend for sensitive data like secrets.",[228,1016,1017],{},[231,1018,743],{},[1020,1021,1022,1085],"code-group",{},[280,1023,1025],{"className":890,"code":1024,"filename":999,"language":892,"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",[236,1026,1027,1032,1037,1046,1055,1059,1064,1069,1077],{"__ignoreMap":5},[288,1028,1029],{"class":290,"line":291},[288,1030,1031],{"class":794},"# Shared\n",[288,1033,1034],{"class":290,"line":312},[288,1035,1036],{"class":328},"[vars]\n",[288,1038,1039,1041,1043],{"class":290,"line":319},[288,1040,751],{"class":294},[288,1042,901],{"class":298},[288,1044,1045],{"class":305},"\"general\"\n",[288,1047,1048,1050,1052],{"class":290,"line":335},[288,1049,747],{"class":294},[288,1051,901],{"class":298},[288,1053,1054],{"class":305},"\"secret\"\n",[288,1056,1057],{"class":290,"line":347},[288,1058,316],{"emptyLinePlaceholder":315},[288,1060,1061],{"class":290,"line":358},[288,1062,1063],{"class":794},"# Override values for `--env production` usage\n",[288,1065,1066],{"class":290,"line":364},[288,1067,1068],{"class":328},"[env.production.vars]\n",[288,1070,1071,1073,1075],{"class":290,"line":376},[288,1072,751],{"class":294},[288,1074,901],{"class":298},[288,1076,904],{"class":305},[288,1078,1079,1081,1083],{"class":290,"line":385},[288,1080,747],{"class":294},[288,1082,901],{"class":298},[288,1084,913],{"class":305},[280,1086,1090],{"className":1087,"code":1088,"filename":404,"language":1089,"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",[236,1091,1092,1097,1105,1118,1127,1132,1139,1146,1153,1165,1174,1179,1184,1190],{"__ignoreMap":5},[288,1093,1094],{"class":290,"line":291},[288,1095,1096],{"class":298},"{\n",[288,1098,1099,1102],{"class":290,"line":312},[288,1100,1101],{"class":370},"  \"vars\"",[288,1103,1104],{"class":298},": {\n",[288,1106,1107,1110,1113,1116],{"class":290,"line":319},[288,1108,1109],{"class":370},"    \"NITRO_HELLO_THERE\"",[288,1111,1112],{"class":298},": ",[288,1114,1115],{"class":305},"\"general\"",[288,1117,344],{"class":298},[288,1119,1120,1123,1125],{"class":290,"line":335},[288,1121,1122],{"class":370},"    \"SECRET\"",[288,1124,1112],{"class":298},[288,1126,1054],{"class":305},[288,1128,1129],{"class":290,"line":347},[288,1130,1131],{"class":298},"  },\n",[288,1133,1134,1137],{"class":290,"line":358},[288,1135,1136],{"class":370},"  \"env\"",[288,1138,1104],{"class":298},[288,1140,1141,1144],{"class":290,"line":364},[288,1142,1143],{"class":370},"    \"production\"",[288,1145,1104],{"class":298},[288,1147,1148,1151],{"class":290,"line":376},[288,1149,1150],{"class":370},"      \"vars\"",[288,1152,1104],{"class":298},[288,1154,1155,1158,1160,1163],{"class":290,"line":385},[288,1156,1157],{"class":370},"        \"NITRO_HELLO_THERE\"",[288,1159,1112],{"class":298},[288,1161,1162],{"class":305},"\"captain\"",[288,1164,344],{"class":298},[288,1166,1167,1170,1172],{"class":290,"line":391},[288,1168,1169],{"class":370},"        \"SECRET\"",[288,1171,1112],{"class":298},[288,1173,913],{"class":305},[288,1175,1176],{"class":290,"line":870},[288,1177,1178],{"class":298},"      }\n",[288,1180,1182],{"class":290,"line":1181},12,[288,1183,388],{"class":298},[288,1185,1187],{"class":290,"line":1186},13,[288,1188,1189],{"class":298},"  }\n",[288,1191,1193],{"class":290,"line":1192},14,[288,1194,1195],{"class":298},"}\n",[223,1197,1199],{"id":1198},"direct-access-to-cloudflare-bindings","Direct access to Cloudflare bindings",[228,1201,1202,1203,1208,1209,659],{},"Bindings are what allows you to interact with resources from the Cloudflare platform, examples of such resources are key-value data storages (",[250,1204,1207],{"href":1205,"rel":1206},"https://developers.cloudflare.com/kv/",[259],"KVs",") and serverless SQL databases (",[250,1210,1213],{"href":1211,"rel":1212},"https://developers.cloudflare.com/d1/",[259],"D1s",[240,1215,1216],{},[228,1217,1218,1219,748,1223,1227],{},"For more details on Bindings and how to use them please refer to the Cloudflare ",[250,1220,950],{"href":1221,"rel":1222},"https://developers.cloudflare.com/pages/functions/bindings/",[259],[250,1224,955],{"href":1225,"rel":1226},"https://developers.cloudflare.com/workers/configuration/bindings/#bindings",[259]," documentation.",[1229,1230,1231],"tip",{},[228,1232,1233,1234,748,1236,1238],{},"\nNitro provides high level API to interact with primitives such as ",[250,1235,68],{"href":69},[250,1237,38],{"href":39}," and you are highly recommended to prefer using them instead of directly depending on low-level APIs for usage stability.",[240,1240],{"to":39,"title":1241},"Database Layer",[240,1243],{"to":69,"title":68},[228,1245,1246,1247,1250],{},"In runtime, you can access bindings from the request event, by accessing its ",[236,1248,1249],{},"context.cloudflare.env"," field, this is for example how you can access a D1 bindings:",[280,1252,1254],{"className":282,"code":1253,"language":284,"meta":5,"style":5},"import { defineHandler } from \"nitro/h3\";\n\ndefineHandler(async (event) => {\n  const { cloudflare } = event.context\n  const stmt = await cloudflare.env.MY_D1.prepare('SELECT id FROM table')\n  const { results } = await stmt.all()\n})\n",[236,1255,1256,1268,1272,1293,1312,1344,1368],{"__ignoreMap":5},[288,1257,1258,1260,1262,1264,1266],{"class":290,"line":291},[288,1259,295],{"class":294},[288,1261,764],{"class":298},[288,1263,302],{"class":294},[288,1265,769],{"class":305},[288,1267,309],{"class":298},[288,1269,1270],{"class":290,"line":312},[288,1271,316],{"emptyLinePlaceholder":315},[288,1273,1274,1277,1280,1283,1285,1287,1289,1291],{"class":290,"line":319},[288,1275,1276],{"class":328},"defineHandler",[288,1278,1279],{"class":298},"(",[288,1281,1282],{"class":294},"async",[288,1284,653],{"class":298},[288,1286,815],{"class":814},[288,1288,791],{"class":298},[288,1290,820],{"class":294},[288,1292,823],{"class":298},[288,1294,1295,1298,1301,1304,1307,1309],{"class":290,"line":335},[288,1296,1297],{"class":294},"  const",[288,1299,1300],{"class":298}," { ",[288,1302,1303],{"class":370},"cloudflare",[288,1305,1306],{"class":298}," } ",[288,1308,901],{"class":294},[288,1310,1311],{"class":298}," event.context\n",[288,1313,1314,1316,1319,1322,1325,1328,1331,1333,1336,1338,1341],{"class":290,"line":347},[288,1315,1297],{"class":294},[288,1317,1318],{"class":370}," stmt",[288,1320,1321],{"class":294}," =",[288,1323,1324],{"class":294}," await",[288,1326,1327],{"class":298}," cloudflare.env.",[288,1329,1330],{"class":370},"MY_D1",[288,1332,261],{"class":298},[288,1334,1335],{"class":328},"prepare",[288,1337,1279],{"class":298},[288,1339,1340],{"class":305},"'SELECT id FROM table'",[288,1342,1343],{"class":298},")\n",[288,1345,1346,1348,1350,1353,1355,1357,1359,1362,1365],{"class":290,"line":358},[288,1347,1297],{"class":294},[288,1349,1300],{"class":298},[288,1351,1352],{"class":370},"results",[288,1354,1306],{"class":298},[288,1356,901],{"class":294},[288,1358,1324],{"class":294},[288,1360,1361],{"class":298}," stmt.",[288,1363,1364],{"class":328},"all",[288,1366,1367],{"class":298},"()\n",[288,1369,1370],{"class":290,"line":364},[288,1371,394],{"class":298},[438,1373,1375],{"id":1374},"access-to-the-bindings-in-local-dev","Access to the bindings in local dev",[244,1377,1378],{},[228,1379,1380,1381,1384],{},"\nThe ",[236,1382,1383],{},"nitro-cloudflare-dev"," module is experimental. The Nitro team is looking into a more native integration  which could in the near future make the module unneeded.",[228,1386,1387,1388,215,1390,1392,1393,1396,1397,659],{},"In order to access bindings in dev mode we start by defining the bindings. You can do this in a ",[236,1389,999],{},[236,1391,404],{}," file, or directly in your Nitro config under ",[236,1394,1395],{},"cloudflare.wrangler"," (accepts the same type as ",[236,1398,404],{},[228,1400,1401,1402],{},"For example to define a variable and a KV namespace in a ",[236,1403,999],{},[1020,1405,1406,1458],{},[280,1407,1409],{"className":890,"code":1408,"filename":999,"language":892,"meta":5,"style":5},"[vars]\nMY_VARIABLE=\"my-value\"\n\n[[kv_namespaces]]\nbinding = \"MY_KV\"\nid = \"xxx\"\n",[236,1410,1411,1415,1425,1429,1437,1448],{"__ignoreMap":5},[288,1412,1413],{"class":290,"line":291},[288,1414,1036],{"class":328},[288,1416,1417,1420,1422],{"class":290,"line":312},[288,1418,1419],{"class":294},"MY_VARIABLE",[288,1421,901],{"class":298},[288,1423,1424],{"class":305},"\"my-value\"\n",[288,1426,1427],{"class":290,"line":319},[288,1428,316],{"emptyLinePlaceholder":315},[288,1430,1431,1434],{"class":290,"line":335},[288,1432,1433],{"class":328},"[[kv_namespaces]",[288,1435,1436],{"class":298},"]\n",[288,1438,1439,1442,1445],{"class":290,"line":347},[288,1440,1441],{"class":294},"binding",[288,1443,1444],{"class":298}," = ",[288,1446,1447],{"class":305},"\"MY_KV\"\n",[288,1449,1450,1453,1455],{"class":290,"line":358},[288,1451,1452],{"class":294},"id",[288,1454,1444],{"class":298},[288,1456,1457],{"class":305},"\"xxx\"\n",[280,1459,1461],{"className":1087,"code":1460,"filename":404,"language":1089,"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",[236,1462,1463,1467,1473,1485,1489,1497,1502,1514,1523,1527,1532],{"__ignoreMap":5},[288,1464,1465],{"class":290,"line":291},[288,1466,1096],{"class":298},[288,1468,1469,1471],{"class":290,"line":312},[288,1470,1101],{"class":370},[288,1472,1104],{"class":298},[288,1474,1475,1478,1480,1483],{"class":290,"line":319},[288,1476,1477],{"class":370},"    \"MY_VARIABLE\"",[288,1479,1112],{"class":298},[288,1481,1482],{"class":305},"\"my-value\"",[288,1484,344],{"class":298},[288,1486,1487],{"class":290,"line":335},[288,1488,1131],{"class":298},[288,1490,1491,1494],{"class":290,"line":347},[288,1492,1493],{"class":370},"  \"kv_namespaces\"",[288,1495,1496],{"class":298},": [\n",[288,1498,1499],{"class":290,"line":358},[288,1500,1501],{"class":298},"    {\n",[288,1503,1504,1507,1509,1512],{"class":290,"line":364},[288,1505,1506],{"class":370},"      \"binding\"",[288,1508,1112],{"class":298},[288,1510,1511],{"class":305},"\"MY_KV\"",[288,1513,344],{"class":298},[288,1515,1516,1519,1521],{"class":290,"line":376},[288,1517,1518],{"class":370},"      \"id\"",[288,1520,1112],{"class":298},[288,1522,1457],{"class":305},[288,1524,1525],{"class":290,"line":385},[288,1526,388],{"class":298},[288,1528,1529],{"class":290,"line":391},[288,1530,1531],{"class":298},"  ]\n",[288,1533,1534],{"class":290,"line":870},[288,1535,1195],{"class":298},[228,1537,1538],{},"Or in your Nitro config:",[280,1540,1545],{"className":1541,"code":1542,"filename":1543,"language":1544,"meta":5,"style":5},"language-js shiki shiki-themes github-light github-dark github-dark","import { defineNitroConfig } from \"nitro/config\";\nimport nitroCloudflareBindings from \"nitro-cloudflare-dev\";\n\nexport default defineNitroConfig({\n    cloudflare: {\n      wrangler: {\n        vars: {\n          MY_VARIABLE: \"my-value\"\n        },\n        kv_namespaces: [\n          {\n            binding: \"MY_KV\",\n            id: \"xxx\"\n          }\n        ]\n      }\n    }\n});\n","nitro.config.js","js",[236,1546,1547,1559,1573,1577,1587,1591,1596,1601,1608,1613,1618,1623,1632,1639,1644,1650,1655,1660],{"__ignoreMap":5},[288,1548,1549,1551,1553,1555,1557],{"class":290,"line":291},[288,1550,295],{"class":294},[288,1552,299],{"class":298},[288,1554,302],{"class":294},[288,1556,306],{"class":305},[288,1558,309],{"class":298},[288,1560,1561,1563,1566,1568,1571],{"class":290,"line":312},[288,1562,295],{"class":294},[288,1564,1565],{"class":298}," nitroCloudflareBindings ",[288,1567,302],{"class":294},[288,1569,1570],{"class":305}," \"nitro-cloudflare-dev\"",[288,1572,309],{"class":298},[288,1574,1575],{"class":290,"line":319},[288,1576,316],{"emptyLinePlaceholder":315},[288,1578,1579,1581,1583,1585],{"class":290,"line":335},[288,1580,322],{"class":294},[288,1582,325],{"class":294},[288,1584,329],{"class":328},[288,1586,332],{"class":298},[288,1588,1589],{"class":290,"line":347},[288,1590,361],{"class":298},[288,1592,1593],{"class":290,"line":358},[288,1594,1595],{"class":298},"      wrangler: {\n",[288,1597,1598],{"class":290,"line":364},[288,1599,1600],{"class":298},"        vars: {\n",[288,1602,1603,1606],{"class":290,"line":376},[288,1604,1605],{"class":298},"          MY_VARIABLE: ",[288,1607,1424],{"class":305},[288,1609,1610],{"class":290,"line":385},[288,1611,1612],{"class":298},"        },\n",[288,1614,1615],{"class":290,"line":391},[288,1616,1617],{"class":298},"        kv_namespaces: [\n",[288,1619,1620],{"class":290,"line":870},[288,1621,1622],{"class":298},"          {\n",[288,1624,1625,1628,1630],{"class":290,"line":1181},[288,1626,1627],{"class":298},"            binding: ",[288,1629,1511],{"class":305},[288,1631,344],{"class":298},[288,1633,1634,1637],{"class":290,"line":1186},[288,1635,1636],{"class":298},"            id: ",[288,1638,1457],{"class":305},[288,1640,1641],{"class":290,"line":1192},[288,1642,1643],{"class":298},"          }\n",[288,1645,1647],{"class":290,"line":1646},15,[288,1648,1649],{"class":298},"        ]\n",[288,1651,1653],{"class":290,"line":1652},16,[288,1654,1178],{"class":298},[288,1656,1658],{"class":290,"line":1657},17,[288,1659,388],{"class":298},[288,1661,1663],{"class":290,"line":1662},18,[288,1664,873],{"class":298},[244,1666,1667],{},[228,1668,1669],{},"\nOnly bindings in the default environment are recognized.",[228,1671,1672,1673,1675,1676,1679],{},"Next we install the ",[236,1674,1383],{}," module as well as the required ",[236,1677,1678],{},"wrangler"," package (if not already installed):",[1681,1682],"pm-install",{"name":1683},"-D nitro-cloudflare-dev wrangler",[228,1685,1686],{},"Then define module:",[280,1688,1690],{"className":1541,"code":1689,"filename":1543,"language":1544,"meta":5,"style":5},"import nitroCloudflareBindings from \"nitro-cloudflare-dev\";\n\nexport default defineNitroConfig({\n  modules: [nitroCloudflareBindings],\n});\n",[236,1691,1692,1704,1708,1718,1723],{"__ignoreMap":5},[288,1693,1694,1696,1698,1700,1702],{"class":290,"line":291},[288,1695,295],{"class":294},[288,1697,1565],{"class":298},[288,1699,302],{"class":294},[288,1701,1570],{"class":305},[288,1703,309],{"class":298},[288,1705,1706],{"class":290,"line":312},[288,1707,316],{"emptyLinePlaceholder":315},[288,1709,1710,1712,1714,1716],{"class":290,"line":319},[288,1711,322],{"class":294},[288,1713,325],{"class":294},[288,1715,329],{"class":328},[288,1717,332],{"class":298},[288,1719,1720],{"class":290,"line":335},[288,1721,1722],{"class":298},"  modules: [nitroCloudflareBindings],\n",[288,1724,1725],{"class":290,"line":347},[288,1726,873],{"class":298},[228,1728,1729],{},"From this moment, when running",[452,1731],{"script":1732},"dev",[228,1734,1735,1736,748,1738,1741],{},"you will be able to access the ",[236,1737,1419],{},[236,1739,1740],{},"MY_KV"," from the request event just as illustrated above.",[1743,1744,1745],"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 pre.shiki code .suiK_, html code.shiki .suiK_{--shiki-light:#005CC5;--shiki-default:#79B8FF;--shiki-dark:#79B8FF}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 .sCsY4, html code.shiki .sCsY4{--shiki-light:#6A737D;--shiki-default:#6A737D;--shiki-dark:#6A737D}html pre.shiki code .sQHwn, html code.shiki .sQHwn{--shiki-light:#E36209;--shiki-default:#FFAB70;--shiki-dark:#FFAB70}",{"title":5,"searchDepth":312,"depth":312,"links":1747},[1748,1753,1757,1758,1765],{"id":225,"depth":312,"text":226,"children":1749},[1750,1751,1752],{"id":440,"depth":319,"text":441},{"id":461,"depth":319,"text":462},{"id":480,"depth":319,"text":481},{"id":542,"depth":312,"text":543,"children":1754},[1755,1756],{"id":662,"depth":319,"text":441},{"id":675,"depth":319,"text":462},{"id":688,"depth":312,"text":689},{"id":717,"depth":312,"text":718,"children":1759},[1760,1761,1762,1763],{"id":876,"depth":319,"text":877},{"id":932,"depth":319,"text":933},{"id":980,"depth":319,"text":981},{"id":995,"depth":319,"text":1764},"Specify Variables using wrangler.toml/wrangler.json",{"id":1198,"depth":312,"text":1199,"children":1766},[1767],{"id":1374,"depth":319,"text":1375},"Deploy Nitro apps to Cloudflare.","md",{},{},{"title":137,"description":1768},"597XBCG-UmbNwzvJCGiaQOVTU8j32vFl4DV3qSXgfZQ",[1775,1777],{"title":133,"path":134,"stem":135,"description":1776,"children":-1},"Deploy Nitro apps to Cleavr.",{"title":141,"path":142,"stem":143,"description":1778,"children":-1},"Deploy Nitro apps to Deno Deploy.",1764005908330]