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