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