[{"data":1,"prerenderedAt":691},["ShallowReactive",2],{"navigation":3,"-guide-configuration":225,"-guide-configuration-surround":686},[4,76,219],{"title":5,"path":6,"stem":7,"children":8,"icon":10},"Docs","/guide","1.guide/0.index",[9,11,16,21,26,31,36,41,46,51,56,61,66,71],{"title":5,"path":6,"stem":7,"icon":10},"ph:book-open-duotone",{"title":12,"path":13,"stem":14,"icon":15},"Server Utils","/guide/utils","1.guide/1.utils","ri:tools-line",{"title":17,"path":18,"stem":19,"icon":20},"Tasks","/guide/tasks","1.guide/10.tasks","codicon:run-all",{"title":22,"path":23,"stem":24,"icon":25},"Server Routes","/guide/routing","1.guide/2.routing","ri:direction-line",{"title":27,"path":28,"stem":29,"icon":30},"WebSocket","/guide/websocket","1.guide/3.websocket","cib:socket-io",{"title":32,"path":33,"stem":34,"icon":35},"KV Storage","/guide/storage","1.guide/4.storage","carbon:datastore",{"title":37,"path":38,"stem":39,"icon":40},"SQL Database","/guide/database","1.guide/5.database","ri:database-2-line",{"title":42,"path":43,"stem":44,"icon":45},"Cache","/guide/cache","1.guide/6.cache","ri:speed-line",{"title":47,"path":48,"stem":49,"icon":50},"Fetch","/guide/fetch","1.guide/7.fetch","ri:global-line",{"title":52,"path":53,"stem":54,"icon":55},"Assets","/guide/assets","1.guide/8.assets","ri:image-2-line",{"title":57,"path":58,"stem":59,"icon":60},"Plugins","/guide/plugins","1.guide/9.plugins","ri:plug-line",{"title":62,"path":63,"stem":64,"icon":65},"Configuration","/guide/configuration","1.guide/97.configuration","ri:settings-3-line",{"title":67,"path":68,"stem":69,"icon":70},"TypeScript","/guide/typescript","1.guide/98.typescript","tabler:brand-typescript",{"title":72,"path":73,"stem":74,"icon":75},"Nightly Channel","/guide/nightly","1.guide/99.nightly","ri:moon-fill",{"title":77,"path":78,"stem":79,"children":80,"icon":82},"Deploy","/deploy","2.deploy/0.index",[81,83,87,113,118],{"title":77,"path":78,"stem":79,"icon":82},"ri:upload-cloud-2-line",{"title":84,"path":85,"stem":86,"icon":50},"Edge Workers","/deploy/workers","2.deploy/1.workers",{"title":88,"path":89,"stem":90,"children":91,"page":112},"Runtimes","/deploy/runtimes","2.deploy/10.runtimes",[92,97,102,107],{"title":93,"path":94,"stem":95,"icon":96},"Node.js","/deploy/runtimes/node","2.deploy/10.runtimes/1.node","akar-icons:node-fill",{"title":98,"path":99,"stem":100,"icon":101},"WinterJS","/deploy/runtimes/_winterjs","2.deploy/10.runtimes/_winterjs","game-icons:cold-heart",{"title":103,"path":104,"stem":105,"icon":106},"Bun","/deploy/runtimes/bun","2.deploy/10.runtimes/bun","simple-icons:bun",{"title":108,"path":109,"stem":110,"icon":111},"Deno","/deploy/runtimes/deno","2.deploy/10.runtimes/deno","simple-icons:deno",false,{"title":114,"path":115,"stem":116,"icon":117},"Custom Preset","/deploy/custom-presets","2.deploy/2.custom-presets","ri:file-code-line",{"title":119,"path":120,"stem":121,"children":122,"page":112},"Providers","/deploy/providers","2.deploy/20.providers",[123,127,131,135,139,143,147,151,155,159,163,167,171,175,179,183,187,191,195,199,203,207,211,215],{"title":124,"path":125,"stem":126},"Alwaysdata","/deploy/providers/alwaysdata","2.deploy/20.providers/alwaysdata",{"title":128,"path":129,"stem":130},"AWS Lambda","/deploy/providers/aws","2.deploy/20.providers/aws",{"title":132,"path":133,"stem":134},"AWS Amplify","/deploy/providers/aws-amplify","2.deploy/20.providers/aws-amplify",{"title":136,"path":137,"stem":138},"Azure","/deploy/providers/azure","2.deploy/20.providers/azure",{"title":140,"path":141,"stem":142},"Cleavr","/deploy/providers/cleavr","2.deploy/20.providers/cleavr",{"title":144,"path":145,"stem":146},"Cloudflare","/deploy/providers/cloudflare","2.deploy/20.providers/cloudflare",{"title":148,"path":149,"stem":150},"Deno Deploy","/deploy/providers/deno-deploy","2.deploy/20.providers/deno-deploy",{"title":152,"path":153,"stem":154},"DigitalOcean","/deploy/providers/digitalocean","2.deploy/20.providers/digitalocean",{"title":156,"path":157,"stem":158},"Edgio","/deploy/providers/edgio","2.deploy/20.providers/edgio",{"title":160,"path":161,"stem":162},"Firebase","/deploy/providers/firebase","2.deploy/20.providers/firebase",{"title":164,"path":165,"stem":166},"Flightcontrol","/deploy/providers/flightcontrol","2.deploy/20.providers/flightcontrol",{"title":168,"path":169,"stem":170},"Genezio","/deploy/providers/genezio","2.deploy/20.providers/genezio",{"title":172,"path":173,"stem":174},"GitHub Pages","/deploy/providers/github-pages","2.deploy/20.providers/github-pages",{"title":176,"path":177,"stem":178},"GitLab Pages","/deploy/providers/gitlab-pages","2.deploy/20.providers/gitlab-pages",{"title":180,"path":181,"stem":182},"Heroku","/deploy/providers/heroku","2.deploy/20.providers/heroku",{"title":184,"path":185,"stem":186},"IIS","/deploy/providers/iis","2.deploy/20.providers/iis",{"title":188,"path":189,"stem":190},"Koyeb","/deploy/providers/koyeb","2.deploy/20.providers/koyeb",{"title":192,"path":193,"stem":194},"Netlify","/deploy/providers/netlify","2.deploy/20.providers/netlify",{"title":196,"path":197,"stem":198},"Platform.sh","/deploy/providers/platform-sh","2.deploy/20.providers/platform-sh",{"title":200,"path":201,"stem":202},"Render.com","/deploy/providers/render","2.deploy/20.providers/render",{"title":204,"path":205,"stem":206},"StormKit","/deploy/providers/stormkit","2.deploy/20.providers/stormkit",{"title":208,"path":209,"stem":210},"Vercel","/deploy/providers/vercel","2.deploy/20.providers/vercel",{"title":212,"path":213,"stem":214},"Zeabur","/deploy/providers/zeabur","2.deploy/20.providers/zeabur",{"title":216,"path":217,"stem":218},"Zerops","/deploy/providers/zerops","2.deploy/20.providers/zerops",{"title":220,"path":221,"stem":222,"children":223,"icon":65},"Config","/config","3.config/0.index",[224],{"title":220,"path":221,"stem":222,"icon":65},{"id":226,"title":62,"body":227,"description":680,"extension":681,"meta":682,"navigation":683,"path":63,"seo":684,"stem":64,"__hash__":685},"content/1.guide/97.configuration.md",{"type":228,"value":229,"toc":674,"icon":65},"minimark",[230,242,245,330,347,363,368,371,374,456,471,521,526,533,539,557,572,583,587,597,627,630,656,670],[231,232,233],"read-more",{"to":221},[234,235,236,237,241],"p",{},"See ",[238,239,240],"a",{"href":221},"config reference"," for available options.",[234,243,244],{},"You can customize your Nitro builder with a configuration file.",[246,247,248,292],"code-group",{},[249,250,256],"pre",{"className":251,"code":252,"filename":253,"language":254,"meta":255,"style":255},"language-ts shiki shiki-themes github-light github-dark github-dark","export default defineNitroConfig({\n  // Nitro options\n})\n","nitro.config.ts","ts","",[257,258,259,279,286],"code",{"__ignoreMap":255},[260,261,264,268,271,275],"span",{"class":262,"line":263},"line",1,[260,265,267],{"class":266},"so5gQ","export",[260,269,270],{"class":266}," default",[260,272,274],{"class":273},"shcOC"," defineNitroConfig",[260,276,278],{"class":277},"slsVL","({\n",[260,280,282],{"class":262,"line":281},2,[260,283,285],{"class":284},"sCsY4","  // Nitro options\n",[260,287,289],{"class":262,"line":288},3,[260,290,291],{"class":277},"})\n",[249,293,296],{"className":251,"code":294,"filename":295,"language":254,"meta":255,"style":255},"export default defineNuxtConfig({\n  nitro: {\n    // Nitro options\n  }\n})\n","nuxt.config.ts",[257,297,298,309,314,319,325],{"__ignoreMap":255},[260,299,300,302,304,307],{"class":262,"line":263},[260,301,267],{"class":266},[260,303,270],{"class":266},[260,305,306],{"class":273}," defineNuxtConfig",[260,308,278],{"class":277},[260,310,311],{"class":262,"line":281},[260,312,313],{"class":277},"  nitro: {\n",[260,315,316],{"class":262,"line":288},[260,317,318],{"class":284},"    // Nitro options\n",[260,320,322],{"class":262,"line":321},4,[260,323,324],{"class":277},"  }\n",[260,326,328],{"class":262,"line":327},5,[260,329,291],{"class":277},[331,332,333],"important",{},[234,334,335,336,342,343,346],{},"\nIf you are using ",[238,337,341],{"href":338,"rel":339},"https://nuxt.com",[340],"nofollow","Nuxt",", use the ",[257,344,345],{},"nitro"," option in your Nuxt config instead.",[348,349,350],"tip",{},[234,351,352,353,358,359,362],{},"\nNitro loads the configuration using ",[238,354,357],{"href":355,"rel":356},"https://github.com/unjs/c12",[340],"c12",", giving more  possibilities such as using ",[257,360,361],{},".nitrorc"," file in current working directory or in the user's home directory.",[364,365,367],"h2",{"id":366},"runtime-configuration","Runtime configuration",[234,369,370],{},"Nitro provides a runtime config API to expose configuration within your application, with the ability to update it at runtime by setting environment variables. This is useful when you want to expose different configuration values for different environments (e.g. development, staging, production). For example, you can use this to expose different API endpoints for different environments or to expose different feature flags.",[234,372,373],{},"First, you need to define the runtime config in your configuration file.",[246,375,376,419],{},[249,377,379],{"className":251,"code":378,"filename":253,"language":254,"meta":255,"style":255},"export default defineNitroConfig({\n  runtimeConfig: {\n    apiToken: \"dev_token\", // `dev_token` is the default value\n  }\n})\n",[257,380,381,391,396,411,415],{"__ignoreMap":255},[260,382,383,385,387,389],{"class":262,"line":263},[260,384,267],{"class":266},[260,386,270],{"class":266},[260,388,274],{"class":273},[260,390,278],{"class":277},[260,392,393],{"class":262,"line":281},[260,394,395],{"class":277},"  runtimeConfig: {\n",[260,397,398,401,405,408],{"class":262,"line":288},[260,399,400],{"class":277},"    apiToken: ",[260,402,404],{"class":403},"sfrk1","\"dev_token\"",[260,406,407],{"class":277},", ",[260,409,410],{"class":284},"// `dev_token` is the default value\n",[260,412,413],{"class":262,"line":321},[260,414,324],{"class":277},[260,416,417],{"class":262,"line":327},[260,418,291],{"class":277},[249,420,422],{"className":251,"code":421,"filename":295,"language":254,"meta":255,"style":255},"export default defineNuxtConfig({\n  runtimeConfig: {\n    apiToken: \"dev_token\", // `dev_token` is the default value\n  }\n})\n",[257,423,424,434,438,448,452],{"__ignoreMap":255},[260,425,426,428,430,432],{"class":262,"line":263},[260,427,267],{"class":266},[260,429,270],{"class":266},[260,431,306],{"class":273},[260,433,278],{"class":277},[260,435,436],{"class":262,"line":281},[260,437,395],{"class":277},[260,439,440,442,444,446],{"class":262,"line":288},[260,441,400],{"class":277},[260,443,404],{"class":403},[260,445,407],{"class":277},[260,447,410],{"class":284},[260,449,450],{"class":262,"line":321},[260,451,324],{"class":277},[260,453,454],{"class":262,"line":327},[260,455,291],{"class":277},[234,457,458,459,462,463,465,466,470],{},"You can now access the runtime config using ",[257,460,461],{},"useRuntimeConfig(event)",".  Use ",[257,464,461],{}," within event handlers and utilities and ",[467,468,469],"strong",{},"avoid"," calling it in ambient global contexts. This could lead to unexpected behavior such as sharing the same runtime config across different requests.",[249,472,475],{"className":251,"code":473,"filename":474,"language":254,"meta":255,"style":255},"export default defineEventHandler((event) => {\n  return useRuntimeConfig(event).apiToken // Returns `dev_token`\n});\n","server/api/example.get.ts",[257,476,477,502,516],{"__ignoreMap":255},[260,478,479,481,483,486,489,493,496,499],{"class":262,"line":263},[260,480,267],{"class":266},[260,482,270],{"class":266},[260,484,485],{"class":273}," defineEventHandler",[260,487,488],{"class":277},"((",[260,490,492],{"class":491},"sQHwn","event",[260,494,495],{"class":277},") ",[260,497,498],{"class":266},"=>",[260,500,501],{"class":277}," {\n",[260,503,504,507,510,513],{"class":262,"line":281},[260,505,506],{"class":266},"  return",[260,508,509],{"class":273}," useRuntimeConfig",[260,511,512],{"class":277},"(event).apiToken ",[260,514,515],{"class":284},"// Returns `dev_token`\n",[260,517,518],{"class":262,"line":288},[260,519,520],{"class":277},"});\n",[522,523,525],"h3",{"id":524},"local-development","Local development",[234,527,528,529,532],{},"Finally, you can update the runtime config using environment variables. You can use a ",[257,530,531],{},".env"," file in development and use platform variables in production (see below).",[234,534,535,536,538],{},"Create an ",[257,537,531],{}," file in your project root:",[249,540,544],{"className":541,"code":542,"filename":531,"language":543,"meta":255,"style":255},"language-bash shiki shiki-themes github-light github-dark github-dark","NITRO_API_TOKEN=\"123\"\n","bash",[257,545,546],{"__ignoreMap":255},[260,547,548,551,554],{"class":262,"line":263},[260,549,550],{"class":277},"NITRO_API_TOKEN",[260,552,553],{"class":266},"=",[260,555,556],{"class":403},"\"123\"\n",[234,558,559,560,563,564,567,568,571],{},"Re-start the development server, fetch the ",[257,561,562],{},"/api/example"," endpoint and you should see ",[257,565,566],{},"123"," as the response instead of ",[257,569,570],{},"dev_token",".",[234,573,574,575,578,579,582],{},"Do not forget that you can still universally access environment variables using ",[257,576,577],{},"import.meta.env"," or ",[257,580,581],{},"process.env"," but avoid using them in ambiant global contexts to prevent unexpected behavior.",[522,584,586],{"id":585},"production","Production",[234,588,589,590,593,594,596],{},"You can define variables in your production environment to update the runtime config. All variables must be prefixed with ",[257,591,592],{},"NITRO_"," to be applied to the runtime config. They will override the runtime config variables defined within your ",[257,595,253],{}," file.",[246,598,599,612],{},[249,600,602],{"className":541,"code":542,"filename":601,"language":543,"meta":255,"style":255},".env (nitro)",[257,603,604],{"__ignoreMap":255},[260,605,606,608,610],{"class":262,"line":263},[260,607,550],{"class":277},[260,609,553],{"class":266},[260,611,556],{"class":403},[249,613,616],{"className":541,"code":614,"filename":615,"language":543,"meta":255,"style":255},"NUXT_API_TOKEN=\"123\"\n",".env (nuxt)",[257,617,618],{"__ignoreMap":255},[260,619,620,623,625],{"class":262,"line":263},[260,621,622],{"class":277},"NUXT_API_TOKEN",[260,624,553],{"class":266},[260,626,556],{"class":403},[234,628,629],{},"In runtime config, define key using camelCase. In environment variables, define key using snake_case and uppercase.",[249,631,633],{"className":251,"code":632,"language":254,"meta":255,"style":255},"{\n  helloWorld: \"foo\"\n}\n",[257,634,635,640,651],{"__ignoreMap":255},[260,636,637],{"class":262,"line":263},[260,638,639],{"class":277},"{\n",[260,641,642,645,648],{"class":262,"line":281},[260,643,644],{"class":273},"  helloWorld",[260,646,647],{"class":277},": ",[260,649,650],{"class":403},"\"foo\"\n",[260,652,653],{"class":262,"line":288},[260,654,655],{"class":277},"}\n",[249,657,659],{"className":541,"code":658,"language":543,"meta":255,"style":255},"NITRO_HELLO_WORLD=\"foo\"\n",[257,660,661],{"__ignoreMap":255},[260,662,663,666,668],{"class":262,"line":263},[260,664,665],{"class":277},"NITRO_HELLO_WORLD",[260,667,553],{"class":266},[260,669,650],{"class":403},[671,672,673],"style",{},"html pre.shiki code .so5gQ, html code.shiki .so5gQ{--shiki-light:#D73A49;--shiki-default:#F97583;--shiki-dark:#F97583}html pre.shiki code .shcOC, html code.shiki .shcOC{--shiki-light:#6F42C1;--shiki-default:#B392F0;--shiki-dark:#B392F0}html pre.shiki code .slsVL, html code.shiki .slsVL{--shiki-light:#24292E;--shiki-default:#E1E4E8;--shiki-dark:#E1E4E8}html pre.shiki code .sCsY4, html code.shiki .sCsY4{--shiki-light:#6A737D;--shiki-default:#6A737D;--shiki-dark:#6A737D}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 .sfrk1, html code.shiki .sfrk1{--shiki-light:#032F62;--shiki-default:#9ECBFF;--shiki-dark:#9ECBFF}html pre.shiki code .sQHwn, html code.shiki .sQHwn{--shiki-light:#E36209;--shiki-default:#FFAB70;--shiki-dark:#FFAB70}",{"title":255,"searchDepth":281,"depth":281,"links":675},[676],{"id":366,"depth":281,"text":367,"children":677},[678,679],{"id":524,"depth":288,"text":525},{"id":585,"depth":288,"text":586},"Customize and extend Nitro defaults.","md",{"icon":65},{"icon":65},{"title":62,"description":680},"0qajNCZ6WcTLFaccWB7JakeljVgCjw1tEbu_JNcnRBA",[687,689],{"title":57,"path":58,"stem":59,"description":688,"icon":60,"children":-1},"Use plugins to extend Nitro's runtime behavior.",{"title":67,"path":68,"stem":69,"description":690,"icon":70,"children":-1},"Nitro automatically generates the types for auto-imports and server routes ✨",1775117854968]