[{"data":1,"prerenderedAt":788},["ShallowReactive",2],{"navigation":3,"-docs-plugins":228,"-docs-plugins-surround":783},[4,83,212,218,225],{"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,208],{"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},"Zephyr Cloud","/deploy/providers/zephyr","2.deploy/20.providers/zephyr",{"title":209,"path":210,"stem":211},"Zerops","/deploy/providers/zerops","2.deploy/20.providers/zerops",{"title":213,"path":214,"stem":215,"children":216,"icon":36},"Config","/config","3.config/0.index",[217],{"title":213,"path":214,"stem":215,"icon":36},{"title":219,"path":220,"stem":221,"children":222,"icon":224},"Examples","/examples","4.examples/0.index",[223],{"title":219,"path":220,"stem":221,"icon":224},"i-lucide-folder-code",{"title":5,"path":226,"stem":227},"/","index",{"id":229,"title":48,"body":230,"description":777,"extension":778,"meta":779,"navigation":780,"path":49,"seo":781,"stem":50,"__hash__":782},"content/1.docs/50.plugins.md",{"type":231,"value":232,"toc":767,"icon":51},"minimark",[233,240,253,260,265,356,363,414,419,430,434,517,522,546,549,553,556,663,667,670,674,677,763],[234,235,236],"warning",{},[237,238,239],"p",{},"Nitro v3 Alpha docs are a work in progress — expect updates, rough edges, and occasional inaccuracies.",[237,241,242,243,247,248,252],{},"Nitro plugins will be ",[244,245,246],"strong",{},"executed once"," during server startup in order to allow extending Nitro's runtime behavior.\nThey receive ",[249,250,251],"code",{},"nitroApp"," context, which can be used to hook into Nitro lifecycle events.",[237,254,255,256,259],{},"Plugins are auto-registered from ",[249,257,258],{},"plugins/"," directory and run synchronously (by order of file name) on the first Nitro initialization.",[237,261,262],{},[244,263,264],{},"Example:",[266,267,272],"pre",{"className":268,"code":269,"filename":270,"language":271,"meta":5,"style":5},"language-ts shiki shiki-themes github-light github-dark github-dark","import { definePlugin } from \"nitro\";\n\nexport default definePlugin((nitroApp) => {\n  console.log('Nitro plugin', nitroApp)\n})\n","plugins/test.ts","ts",[249,273,274,297,304,332,350],{"__ignoreMap":5},[275,276,279,283,287,290,294],"span",{"class":277,"line":278},"line",1,[275,280,282],{"class":281},"so5gQ","import",[275,284,286],{"class":285},"slsVL"," { definePlugin } ",[275,288,289],{"class":281},"from",[275,291,293],{"class":292},"sfrk1"," \"nitro\"",[275,295,296],{"class":285},";\n",[275,298,300],{"class":277,"line":299},2,[275,301,303],{"emptyLinePlaceholder":302},true,"\n",[275,305,307,310,313,317,320,323,326,329],{"class":277,"line":306},3,[275,308,309],{"class":281},"export",[275,311,312],{"class":281}," default",[275,314,316],{"class":315},"shcOC"," definePlugin",[275,318,319],{"class":285},"((",[275,321,251],{"class":322},"sQHwn",[275,324,325],{"class":285},") ",[275,327,328],{"class":281},"=>",[275,330,331],{"class":285}," {\n",[275,333,335,338,341,344,347],{"class":277,"line":334},4,[275,336,337],{"class":285},"  console.",[275,339,340],{"class":315},"log",[275,342,343],{"class":285},"(",[275,345,346],{"class":292},"'Nitro plugin'",[275,348,349],{"class":285},", nitroApp)\n",[275,351,353],{"class":277,"line":352},5,[275,354,355],{"class":285},"})\n",[237,357,358,359,362],{},"If you have plugins in another directory, you can use the ",[249,360,361],{},"plugins"," option:",[266,364,367],{"className":268,"code":365,"filename":366,"language":271,"meta":5,"style":5},"import { defineNitroConfig } from \"nitro/config\";\n\nexport default defineNitroConfig({\n  plugins: ['my-plugins/hello.ts']\n})\n","nitro.config.ts",[249,368,369,383,387,399,410],{"__ignoreMap":5},[275,370,371,373,376,378,381],{"class":277,"line":278},[275,372,282],{"class":281},[275,374,375],{"class":285}," { defineNitroConfig } ",[275,377,289],{"class":281},[275,379,380],{"class":292}," \"nitro/config\"",[275,382,296],{"class":285},[275,384,385],{"class":277,"line":299},[275,386,303],{"emptyLinePlaceholder":302},[275,388,389,391,393,396],{"class":277,"line":306},[275,390,309],{"class":281},[275,392,312],{"class":281},[275,394,395],{"class":315}," defineNitroConfig",[275,397,398],{"class":285},"({\n",[275,400,401,404,407],{"class":277,"line":334},[275,402,403],{"class":285},"  plugins: [",[275,405,406],{"class":292},"'my-plugins/hello.ts'",[275,408,409],{"class":285},"]\n",[275,411,412],{"class":277,"line":352},[275,413,355],{"class":285},[415,416,418],"h2",{"id":417},"nitro-runtime-hooks","Nitro runtime hooks",[237,420,421,422,429],{},"You can use Nitro ",[423,424,428],"a",{"href":425,"rel":426},"https://github.com/unjs/hookable",[427],"nofollow","hooks"," to extend the default runtime behaviour of Nitro by registering custom (async or sync) functions to the lifecycle events within plugins.",[237,431,432],{},[244,433,264],{},[266,435,437],{"className":268,"code":436,"language":271,"meta":5,"style":5},"import { definePlugin } from \"nitro\";\n\nexport default definePlugin((nitro) => {\n  nitro.hooks.hook(\"close\", async () => {\n    // Will run when nitro is being closed\n  });\n})\n",[249,438,439,451,455,474,500,506,512],{"__ignoreMap":5},[275,440,441,443,445,447,449],{"class":277,"line":278},[275,442,282],{"class":281},[275,444,286],{"class":285},[275,446,289],{"class":281},[275,448,293],{"class":292},[275,450,296],{"class":285},[275,452,453],{"class":277,"line":299},[275,454,303],{"emptyLinePlaceholder":302},[275,456,457,459,461,463,465,468,470,472],{"class":277,"line":306},[275,458,309],{"class":281},[275,460,312],{"class":281},[275,462,316],{"class":315},[275,464,319],{"class":285},[275,466,467],{"class":322},"nitro",[275,469,325],{"class":285},[275,471,328],{"class":281},[275,473,331],{"class":285},[275,475,476,479,482,484,487,490,493,496,498],{"class":277,"line":334},[275,477,478],{"class":285},"  nitro.hooks.",[275,480,481],{"class":315},"hook",[275,483,343],{"class":285},[275,485,486],{"class":292},"\"close\"",[275,488,489],{"class":285},", ",[275,491,492],{"class":281},"async",[275,494,495],{"class":285}," () ",[275,497,328],{"class":281},[275,499,331],{"class":285},[275,501,502],{"class":277,"line":352},[275,503,505],{"class":504},"sCsY4","    // Will run when nitro is being closed\n",[275,507,509],{"class":277,"line":508},6,[275,510,511],{"class":285},"  });\n",[275,513,515],{"class":277,"line":514},7,[275,516,355],{"class":285},[518,519,521],"h3",{"id":520},"available-hooks","Available hooks",[523,524,525,531,536,541],"ul",{},[526,527,528],"li",{},[249,529,530],{},"\"close\", () => {}",[526,532,533],{},[249,534,535],{},"\"request\", (event) => {}",[526,537,538],{},[249,539,540],{},"\"error\", (error, { event? }) => {}",[526,542,543],{},[249,544,545],{},"\"response\", (res, event) => {}",[415,547,219],{"id":548},"examples",[518,550,552],{"id":551},"capturing-errors","Capturing errors",[237,554,555],{},"You can use plugins to capture all application errors.",[266,557,559],{"className":268,"code":558,"language":271,"meta":5,"style":5},"import { definePlugin } from \"nitro\";\n\nexport default definePlugin((nitro) => {\n  nitro.hooks.hook(\"error\", async (error, { event }) => {\n    console.error(`${event.path} Application error:`, error)\n  });\n})\n",[249,560,561,573,577,595,629,655,659],{"__ignoreMap":5},[275,562,563,565,567,569,571],{"class":277,"line":278},[275,564,282],{"class":281},[275,566,286],{"class":285},[275,568,289],{"class":281},[275,570,293],{"class":292},[275,572,296],{"class":285},[275,574,575],{"class":277,"line":299},[275,576,303],{"emptyLinePlaceholder":302},[275,578,579,581,583,585,587,589,591,593],{"class":277,"line":306},[275,580,309],{"class":281},[275,582,312],{"class":281},[275,584,316],{"class":315},[275,586,319],{"class":285},[275,588,467],{"class":322},[275,590,325],{"class":285},[275,592,328],{"class":281},[275,594,331],{"class":285},[275,596,597,599,601,603,606,608,610,613,616,619,622,625,627],{"class":277,"line":334},[275,598,478],{"class":285},[275,600,481],{"class":315},[275,602,343],{"class":285},[275,604,605],{"class":292},"\"error\"",[275,607,489],{"class":285},[275,609,492],{"class":281},[275,611,612],{"class":285}," (",[275,614,615],{"class":322},"error",[275,617,618],{"class":285},", { ",[275,620,621],{"class":322},"event",[275,623,624],{"class":285}," }) ",[275,626,328],{"class":281},[275,628,331],{"class":285},[275,630,631,634,636,638,641,643,646,649,652],{"class":277,"line":352},[275,632,633],{"class":285},"    console.",[275,635,615],{"class":315},[275,637,343],{"class":285},[275,639,640],{"class":292},"`${",[275,642,621],{"class":285},[275,644,645],{"class":292},".",[275,647,648],{"class":285},"path",[275,650,651],{"class":292},"} Application error:`",[275,653,654],{"class":285},", error)\n",[275,656,657],{"class":277,"line":508},[275,658,511],{"class":285},[275,660,661],{"class":277,"line":514},[275,662,355],{"class":285},[518,664,666],{"id":665},"graceful-shutdown","Graceful shutdown",[237,668,669],{},"Server will gracefully shutdown and wait for any background pending tasks initiated by event.waitUntil",[518,671,673],{"id":672},"request-and-response-lifecycle","Request and response lifecycle",[237,675,676],{},"You can use plugins to register a hook that can run on request lifecycle:",[266,678,680],{"className":268,"code":679,"language":271,"meta":5,"style":5},"import { definePlugin } from \"nitro\";\n\nexport default definePlugin((nitroApp) => {\n  nitroApp.hooks.hook(\"request\", (req) => {\n    console.log(\"on request\", req.url);\n  });\n});\n",[249,681,682,694,698,716,740,754,758],{"__ignoreMap":5},[275,683,684,686,688,690,692],{"class":277,"line":278},[275,685,282],{"class":281},[275,687,286],{"class":285},[275,689,289],{"class":281},[275,691,293],{"class":292},[275,693,296],{"class":285},[275,695,696],{"class":277,"line":299},[275,697,303],{"emptyLinePlaceholder":302},[275,699,700,702,704,706,708,710,712,714],{"class":277,"line":306},[275,701,309],{"class":281},[275,703,312],{"class":281},[275,705,316],{"class":315},[275,707,319],{"class":285},[275,709,251],{"class":322},[275,711,325],{"class":285},[275,713,328],{"class":281},[275,715,331],{"class":285},[275,717,718,721,723,725,728,731,734,736,738],{"class":277,"line":334},[275,719,720],{"class":285},"  nitroApp.hooks.",[275,722,481],{"class":315},[275,724,343],{"class":285},[275,726,727],{"class":292},"\"request\"",[275,729,730],{"class":285},", (",[275,732,733],{"class":322},"req",[275,735,325],{"class":285},[275,737,328],{"class":281},[275,739,331],{"class":285},[275,741,742,744,746,748,751],{"class":277,"line":352},[275,743,633],{"class":285},[275,745,340],{"class":315},[275,747,343],{"class":285},[275,749,750],{"class":292},"\"on request\"",[275,752,753],{"class":285},", req.url);\n",[275,755,756],{"class":277,"line":508},[275,757,511],{"class":285},[275,759,760],{"class":277,"line":514},[275,761,762],{"class":285},"});\n",[764,765,766],"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 .sQHwn, html code.shiki .sQHwn{--shiki-light:#E36209;--shiki-default:#FFAB70;--shiki-dark:#FFAB70}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}",{"title":5,"searchDepth":299,"depth":299,"links":768},[769,772],{"id":417,"depth":299,"text":418,"children":770},[771],{"id":520,"depth":306,"text":521},{"id":548,"depth":299,"text":219,"children":773},[774,775,776],{"id":551,"depth":306,"text":552},{"id":665,"depth":306,"text":666},{"id":672,"depth":306,"text":673},"Use plugins to extend Nitro's runtime behavior.","md",{"icon":51},{"icon":51},{"title":48,"description":777},"bPhrJZnLxr_vUbvNqR5e4oPBfQLirF_F43fpJ_ZFXh0",[784,786],{"title":43,"path":44,"stem":45,"description":785,"icon":46,"children":-1},"Understand how Nitro runs and serves incoming requests to your application.",{"title":53,"path":54,"stem":55,"description":787,"icon":56,"children":-1},"Nitro tasks allow on-off operations in runtime.",1773176970101]