[{"data":1,"prerenderedAt":1814},["ShallowReactive",2],{"navigation":3,"-docs-modules":445,"-docs-modules-surround":1809},[4,123,260,266,430,442],{"title":5,"path":6,"stem":7,"children":8,"icon":122},"","\u002Fdocs","1.docs\u002F1.index",[9,12,17,22,27,32,37,42,47,52,57,62,67,72,77,82,87,92,97,102,107,112,117],{"title":10,"path":6,"stem":7,"icon":11},"Introduction","i-lucide-compass",{"title":13,"path":14,"stem":15,"icon":16},"Quick Start","\u002Fdocs\u002Fquick-start","1.docs\u002F2.quick-start","i-lucide-zap",{"title":18,"path":19,"stem":20,"icon":21},"Renderer","\u002Fdocs\u002Frenderer","1.docs\u002F4.renderer","ri:layout-masonry-line",{"title":23,"path":24,"stem":25,"icon":26},"Routing","\u002Fdocs\u002Frouting","1.docs\u002F5.routing","ri:direction-line",{"title":28,"path":29,"stem":30,"icon":31},"Assets","\u002Fdocs\u002Fassets","1.docs\u002F50.assets","ri:image-2-line",{"title":33,"path":34,"stem":35,"icon":36},"Configuration","\u002Fdocs\u002Fconfiguration","1.docs\u002F50.configuration","ri:settings-3-line",{"title":38,"path":39,"stem":40,"icon":41},"Database","\u002Fdocs\u002Fdatabase","1.docs\u002F50.database","ri:database-2-line",{"title":43,"path":44,"stem":45,"icon":46},"Lifecycle","\u002Fdocs\u002Flifecycle","1.docs\u002F50.lifecycle","i-lucide-layers",{"title":48,"path":49,"stem":50,"icon":51},"OpenAPI","\u002Fdocs\u002Fopenapi","1.docs\u002F50.openapi","ri:contract-line",{"title":53,"path":54,"stem":55,"icon":56},"Plugins","\u002Fdocs\u002Fplugins","1.docs\u002F50.plugins","ri:plug-line",{"title":58,"path":59,"stem":60,"icon":61},"Prerendering","\u002Fdocs\u002Fprerendering","1.docs\u002F50.prerendering","ri:file-copy-2-line",{"title":63,"path":64,"stem":65,"icon":66},"Tasks","\u002Fdocs\u002Ftasks","1.docs\u002F50.tasks","codicon:run-all",{"title":68,"path":69,"stem":70,"icon":71},"WebSocket","\u002Fdocs\u002Fwebsocket","1.docs\u002F50.websocket","ri:broadcast-fill",{"title":73,"path":74,"stem":75,"icon":76},"Modules","\u002Fdocs\u002Fmodules","1.docs\u002F55.modules","i-lucide-puzzle",{"title":78,"path":79,"stem":80,"icon":81},"Server Entry","\u002Fdocs\u002Fserver-entry","1.docs\u002F6.server-entry","ri:server-line",{"title":83,"path":84,"stem":85,"icon":86},"CLI","\u002Fdocs\u002Fcli","1.docs\u002F60.cli","i-lucide-terminal",{"title":88,"path":89,"stem":90,"icon":91},"Vite","\u002Fdocs\u002Fvite","1.docs\u002F61.vite","i-logos-vitejs",{"title":93,"path":94,"stem":95,"icon":96},"Utils","\u002Fdocs\u002Futils","1.docs\u002F62.utils","i-lucide-braces",{"title":98,"path":99,"stem":100,"icon":101},"TypeScript","\u002Fdocs\u002Ftypescript","1.docs\u002F63.typescript","i-logos-typescript-icon",{"title":103,"path":104,"stem":105,"icon":106},"Cache","\u002Fdocs\u002Fcache","1.docs\u002F7.cache","ri:speed-line",{"title":108,"path":109,"stem":110,"icon":111},"KV Storage","\u002Fdocs\u002Fstorage","1.docs\u002F8.storage","carbon:datastore",{"title":113,"path":114,"stem":115,"icon":116},"Migration Guide","\u002Fdocs\u002Fmigration","1.docs\u002F99.migration","ri:arrow-right-up-line",{"title":118,"path":119,"stem":120,"icon":121},"Nightly Channel","\u002Fdocs\u002Fnightly","1.docs\u002F99.nightly","ri:moon-fill","i-lucide-book-open",{"title":124,"path":125,"stem":126,"children":127,"icon":129},"Deploy","\u002Fdeploy","2.deploy\u002F0.index",[128,130,155],{"title":124,"path":125,"stem":126,"icon":129},"ri:upload-cloud-2-line",{"title":131,"path":132,"stem":133,"children":134,"page":154},"Runtimes","\u002Fdeploy\u002Fruntimes","2.deploy\u002F10.runtimes",[135,140,145,150],{"title":136,"path":137,"stem":138,"icon":139},"Node.js","\u002Fdeploy\u002Fruntimes\u002Fnode","2.deploy\u002F10.runtimes\u002F1.node","akar-icons:node-fill",{"title":141,"path":142,"stem":143,"icon":144},"Bun","\u002Fdeploy\u002Fruntimes\u002Fbun","2.deploy\u002F10.runtimes\u002Fbun","simple-icons:bun",{"title":146,"path":147,"stem":148,"icon":149},"Deno","\u002Fdeploy\u002Fruntimes\u002Fdeno","2.deploy\u002F10.runtimes\u002Fdeno","simple-icons:deno",{"title":151,"path":152,"stem":153},"Standard","\u002Fdeploy\u002Fruntimes\u002Fstandard","2.deploy\u002F10.runtimes\u002Fstandard",false,{"title":156,"path":157,"stem":158,"children":159,"page":154},"Providers","\u002Fdeploy\u002Fproviders","2.deploy\u002F20.providers",[160,164,168,172,176,180,184,188,192,196,200,204,208,212,216,220,224,228,232,236,240,244,248,252,256],{"title":161,"path":162,"stem":163},"Alwaysdata","\u002Fdeploy\u002Fproviders\u002Falwaysdata","2.deploy\u002F20.providers\u002Falwaysdata",{"title":165,"path":166,"stem":167},"AWS Lambda","\u002Fdeploy\u002Fproviders\u002Faws","2.deploy\u002F20.providers\u002Faws",{"title":169,"path":170,"stem":171},"AWS Amplify","\u002Fdeploy\u002Fproviders\u002Faws-amplify","2.deploy\u002F20.providers\u002Faws-amplify",{"title":173,"path":174,"stem":175},"Azure","\u002Fdeploy\u002Fproviders\u002Fazure","2.deploy\u002F20.providers\u002Fazure",{"title":177,"path":178,"stem":179},"Cleavr","\u002Fdeploy\u002Fproviders\u002Fcleavr","2.deploy\u002F20.providers\u002Fcleavr",{"title":181,"path":182,"stem":183},"Cloudflare","\u002Fdeploy\u002Fproviders\u002Fcloudflare","2.deploy\u002F20.providers\u002Fcloudflare",{"title":185,"path":186,"stem":187},"Deno Deploy","\u002Fdeploy\u002Fproviders\u002Fdeno-deploy","2.deploy\u002F20.providers\u002Fdeno-deploy",{"title":189,"path":190,"stem":191},"DigitalOcean","\u002Fdeploy\u002Fproviders\u002Fdigitalocean","2.deploy\u002F20.providers\u002Fdigitalocean",{"title":193,"path":194,"stem":195},"EdgeOne Pages","\u002Fdeploy\u002Fproviders\u002Fedgeone","2.deploy\u002F20.providers\u002Fedgeone",{"title":197,"path":198,"stem":199},"Firebase","\u002Fdeploy\u002Fproviders\u002Ffirebase","2.deploy\u002F20.providers\u002Ffirebase",{"title":201,"path":202,"stem":203},"Flightcontrol","\u002Fdeploy\u002Fproviders\u002Fflightcontrol","2.deploy\u002F20.providers\u002Fflightcontrol",{"title":205,"path":206,"stem":207},"Genezio","\u002Fdeploy\u002Fproviders\u002Fgenezio","2.deploy\u002F20.providers\u002Fgenezio",{"title":209,"path":210,"stem":211},"GitHub Pages","\u002Fdeploy\u002Fproviders\u002Fgithub-pages","2.deploy\u002F20.providers\u002Fgithub-pages",{"title":213,"path":214,"stem":215},"GitLab Pages","\u002Fdeploy\u002Fproviders\u002Fgitlab-pages","2.deploy\u002F20.providers\u002Fgitlab-pages",{"title":217,"path":218,"stem":219},"Heroku","\u002Fdeploy\u002Fproviders\u002Fheroku","2.deploy\u002F20.providers\u002Fheroku",{"title":221,"path":222,"stem":223},"IIS","\u002Fdeploy\u002Fproviders\u002Fiis","2.deploy\u002F20.providers\u002Fiis",{"title":225,"path":226,"stem":227},"Koyeb","\u002Fdeploy\u002Fproviders\u002Fkoyeb","2.deploy\u002F20.providers\u002Fkoyeb",{"title":229,"path":230,"stem":231},"Netlify","\u002Fdeploy\u002Fproviders\u002Fnetlify","2.deploy\u002F20.providers\u002Fnetlify",{"title":233,"path":234,"stem":235},"Platform.sh","\u002Fdeploy\u002Fproviders\u002Fplatform-sh","2.deploy\u002F20.providers\u002Fplatform-sh",{"title":237,"path":238,"stem":239},"Render.com","\u002Fdeploy\u002Fproviders\u002Frender","2.deploy\u002F20.providers\u002Frender",{"title":241,"path":242,"stem":243},"Stormkit","\u002Fdeploy\u002Fproviders\u002Fstormkit","2.deploy\u002F20.providers\u002Fstormkit",{"title":245,"path":246,"stem":247},"Vercel","\u002Fdeploy\u002Fproviders\u002Fvercel","2.deploy\u002F20.providers\u002Fvercel",{"title":249,"path":250,"stem":251},"Zeabur","\u002Fdeploy\u002Fproviders\u002Fzeabur","2.deploy\u002F20.providers\u002Fzeabur",{"title":253,"path":254,"stem":255},"Zephyr Cloud","\u002Fdeploy\u002Fproviders\u002Fzephyr","2.deploy\u002F20.providers\u002Fzephyr",{"title":257,"path":258,"stem":259},"Zerops","\u002Fdeploy\u002Fproviders\u002Fzerops","2.deploy\u002F20.providers\u002Fzerops",{"title":261,"path":262,"stem":263,"children":264,"icon":36},"Config","\u002Fconfig","3.config\u002F0.index",[265],{"title":261,"path":262,"stem":263,"icon":36},{"title":267,"path":268,"stem":269,"children":270,"icon":272},"Examples","\u002Fexamples","4.examples\u002F0.index",[271,273,278,283,288,293,297,302,307,312,317,322,327,331,336,340,344,349,354,359,364,369,374,379,383,388,393,398,402,407,412,416,421,426],{"title":267,"path":268,"stem":269,"icon":272},"i-lucide-folder-code",{"title":274,"path":275,"stem":276,"icon":277},"API Routes","\u002Fexamples\u002Fapi-routes","4.examples\u002Fapi-routes","i-lucide-route",{"title":279,"path":280,"stem":281,"icon":282},"Auto Imports","\u002Fexamples\u002Fauto-imports","4.examples\u002Fauto-imports","i-lucide-import",{"title":284,"path":285,"stem":286,"icon":287},"Cached Handler","\u002Fexamples\u002Fcached-handler","4.examples\u002Fcached-handler","i-lucide-clock",{"title":289,"path":290,"stem":291,"icon":292},"Custom Error Handler","\u002Fexamples\u002Fcustom-error-handler","4.examples\u002Fcustom-error-handler","i-lucide-alert-circle",{"title":38,"path":294,"stem":295,"icon":296},"\u002Fexamples\u002Fdatabase","4.examples\u002Fdatabase","i-lucide-database",{"title":298,"path":299,"stem":300,"icon":301},"Elysia","\u002Fexamples\u002Felysia","4.examples\u002Felysia","i-skill-icons-elysia-dark",{"title":303,"path":304,"stem":305,"icon":306},"Express","\u002Fexamples\u002Fexpress","4.examples\u002Fexpress","i-simple-icons-express",{"title":308,"path":309,"stem":310,"icon":311},"Fastify","\u002Fexamples\u002Ffastify","4.examples\u002Ffastify","i-simple-icons-fastify",{"title":313,"path":314,"stem":315,"icon":316},"Hello World","\u002Fexamples\u002Fhello-world","4.examples\u002Fhello-world","i-lucide-sparkles",{"title":318,"path":319,"stem":320,"icon":321},"Hono","\u002Fexamples\u002Fhono","4.examples\u002Fhono","i-logos-hono",{"title":323,"path":324,"stem":325,"icon":326},"Import Alias","\u002Fexamples\u002Fimport-alias","4.examples\u002Fimport-alias","i-lucide-at-sign",{"title":328,"path":329,"stem":330,"icon":46},"Middleware","\u002Fexamples\u002Fmiddleware","4.examples\u002Fmiddleware",{"title":332,"path":333,"stem":334,"icon":335},"Mono JSX","\u002Fexamples\u002Fmono-jsx","4.examples\u002Fmono-jsx","i-lucide-brackets",{"title":337,"path":338,"stem":339,"icon":335},"Nano JSX","\u002Fexamples\u002Fnano-jsx","4.examples\u002Fnano-jsx",{"title":53,"path":341,"stem":342,"icon":343},"\u002Fexamples\u002Fplugins","4.examples\u002Fplugins","i-lucide-plug",{"title":345,"path":346,"stem":347,"icon":348},"Custom Renderer","\u002Fexamples\u002Frenderer","4.examples\u002Frenderer","i-lucide-code",{"title":350,"path":351,"stem":352,"icon":353},"Runtime Config","\u002Fexamples\u002Fruntime-config","4.examples\u002Fruntime-config","i-lucide-settings",{"title":355,"path":356,"stem":357,"icon":358},"Server Fetch","\u002Fexamples\u002Fserver-fetch","4.examples\u002Fserver-fetch","i-lucide-arrow-right-left",{"title":360,"path":361,"stem":362,"icon":363},"Shiki","\u002Fexamples\u002Fshiki","4.examples\u002Fshiki","i-lucide-highlighter",{"title":365,"path":366,"stem":367,"icon":368},"Takumi","\u002Fexamples\u002Ftakumi","4.examples\u002Ftakumi","i-lucide-image",{"title":370,"path":371,"stem":372,"icon":373},"Tracing","\u002Fexamples\u002Ftracing","4.examples\u002Ftracing","i-lucide-activity",{"title":375,"path":376,"stem":377,"icon":378},"Virtual Routes","\u002Fexamples\u002Fvirtual-routes","4.examples\u002Fvirtual-routes","i-lucide-box",{"title":380,"path":381,"stem":382,"icon":91},"Vite Nitro Plugin","\u002Fexamples\u002Fvite-nitro-plugin","4.examples\u002Fvite-nitro-plugin",{"title":384,"path":385,"stem":386,"icon":387},"Vite RSC","\u002Fexamples\u002Fvite-rsc","4.examples\u002Fvite-rsc","i-logos-react",{"title":389,"path":390,"stem":391,"icon":392},"Vite SSR HTML","\u002Fexamples\u002Fvite-ssr-html","4.examples\u002Fvite-ssr-html","i-logos-html-5",{"title":394,"path":395,"stem":396,"icon":397},"SSR with Preact","\u002Fexamples\u002Fvite-ssr-preact","4.examples\u002Fvite-ssr-preact","i-logos-preact",{"title":399,"path":400,"stem":401,"icon":387},"SSR with React","\u002Fexamples\u002Fvite-ssr-react","4.examples\u002Fvite-ssr-react",{"title":403,"path":404,"stem":405,"icon":406},"SSR with SolidJS","\u002Fexamples\u002Fvite-ssr-solid","4.examples\u002Fvite-ssr-solid","i-logos-solidjs-icon",{"title":408,"path":409,"stem":410,"icon":411},"SSR with TanStack Router","\u002Fexamples\u002Fvite-ssr-tsr-react","4.examples\u002Fvite-ssr-tsr-react","i-simple-icons-tanstack",{"title":413,"path":414,"stem":415,"icon":411},"SSR with TanStack Start","\u002Fexamples\u002Fvite-ssr-tss-react","4.examples\u002Fvite-ssr-tss-react",{"title":417,"path":418,"stem":419,"icon":420},"SSR with Vue Router","\u002Fexamples\u002Fvite-ssr-vue-router","4.examples\u002Fvite-ssr-vue-router","i-logos-vue",{"title":422,"path":423,"stem":424,"icon":425},"Vite + tRPC","\u002Fexamples\u002Fvite-trpc","4.examples\u002Fvite-trpc","i-simple-icons-trpc",{"title":68,"path":427,"stem":428,"icon":429},"\u002Fexamples\u002Fwebsocket","4.examples\u002Fwebsocket","i-lucide-radio",{"title":431,"path":432,"stem":433,"children":434},"Blog","\u002Fblog","9.blog",[435,438],{"title":431,"path":432,"stem":436,"icon":437},"9.blog\u002Findex","i-lucide-file-text",{"title":439,"path":440,"stem":441,"icon":437},"Nitro v3 Beta is here!","\u002Fblog\u002Fv3-beta","9.blog\u002F1.v3-beta",{"title":5,"path":443,"stem":444},"\u002F","index",{"id":446,"title":73,"body":447,"description":1803,"extension":1804,"meta":1805,"navigation":1806,"path":74,"seo":1807,"stem":75,"__hash__":1808},"content\u002F1.docs\u002F55.modules.md",{"type":448,"value":449,"toc":1796,"icon":76},"minimark",[450,464,487,558,563,570,801,804,894,909,916,920,944,1124,1133,1219,1223,1230,1350,1353,1566,1584,1610,1614,1656,1660,1666,1783,1792],[451,452,453,454,458,459,463],"p",{},"Nitro modules are functions that run ",[455,456,457],"strong",{},"once when the Nitro instance is initialized"," (in development, build, and prerendering). They receive the ",[460,461,462],"code",{},"nitro"," build context, which they can use to modify options, register build-time hooks, add virtual files, or register route handlers.",[465,466,467],"note",{},[451,468,469,470,473,474,477,478,482,483,486],{},"Modules run at ",[455,471,472],{},"build time",". To extend the server's ",[455,475,476],{},"runtime"," behavior (request ",[479,480,481],"a",{"href":44},"lifecycle",", error handling, shutdown), use ",[479,484,485],{"href":54},"plugins"," instead.",[488,489,490,505],"table",{},[491,492,493],"thead",{},[494,495,496,499,501],"tr",{},[497,498],"th",{},[497,500,73],{},[497,502,503],{},[479,504,53],{"href":54},[506,507,508,520,536,547],"tbody",{},[494,509,510,514,517],{},[511,512,513],"td",{},"Run",[511,515,516],{},"Once, during initialization and build",[511,518,519],{},"Once, on server startup",[494,521,522,525,530],{},[511,523,524],{},"Receive",[511,526,527,529],{},[460,528,462],{}," (build context)",[511,531,532,535],{},[460,533,534],{},"nitroApp"," (runtime app)",[494,537,538,541,544],{},[511,539,540],{},"Typical use",[511,542,543],{},"Modify config, add handlers and virtual files, hook into build",[511,545,546],{},"Hook into request\u002Fresponse lifecycle",[494,548,549,552,555],{},[511,550,551],{},"Bundled into output",[511,553,554],{},"No",[511,556,557],{},"Yes",[559,560,562],"h2",{"id":561},"using-modules","Using modules",[451,564,565,566,569],{},"Register modules with the ",[460,567,568],{},"modules"," config array:",[571,572,577],"pre",{"className":573,"code":574,"filename":575,"language":576,"meta":5,"style":5},"language-ts shiki shiki-themes github-light github-dark github-dark","import { defineConfig } from \"nitro\";\n\nexport default defineConfig({\n  modules: [\n    \u002F\u002F Path to a local module (relative to the project root)\n    \".\u002Fmodules\u002Fmy-module.ts\",\n    \u002F\u002F Name of an npm package\n    \"my-nitro-module\",\n    \u002F\u002F Inline module object\n    {\n      name: \"inline-module\",\n      setup(nitro) {\n        nitro.logger.info(\"Inline module setup\");\n      },\n    },\n    \u002F\u002F Bare setup function\n    (nitro) => {\n      nitro.hooks.hook(\"compiled\", () => {\n        \u002F\u002F ...\n      });\n    },\n  ],\n});\n","nitro.config.ts","ts",[460,578,579,602,609,625,631,638,647,653,661,667,673,684,699,716,722,728,734,751,772,778,784,789,795],{"__ignoreMap":5},[580,581,584,588,592,595,599],"span",{"class":582,"line":583},"line",1,[580,585,587],{"class":586},"so5gQ","import",[580,589,591],{"class":590},"slsVL"," { defineConfig } ",[580,593,594],{"class":586},"from",[580,596,598],{"class":597},"sfrk1"," \"nitro\"",[580,600,601],{"class":590},";\n",[580,603,605],{"class":582,"line":604},2,[580,606,608],{"emptyLinePlaceholder":607},true,"\n",[580,610,612,615,618,622],{"class":582,"line":611},3,[580,613,614],{"class":586},"export",[580,616,617],{"class":586}," default",[580,619,621],{"class":620},"shcOC"," defineConfig",[580,623,624],{"class":590},"({\n",[580,626,628],{"class":582,"line":627},4,[580,629,630],{"class":590},"  modules: [\n",[580,632,634],{"class":582,"line":633},5,[580,635,637],{"class":636},"sCsY4","    \u002F\u002F Path to a local module (relative to the project root)\n",[580,639,641,644],{"class":582,"line":640},6,[580,642,643],{"class":597},"    \".\u002Fmodules\u002Fmy-module.ts\"",[580,645,646],{"class":590},",\n",[580,648,650],{"class":582,"line":649},7,[580,651,652],{"class":636},"    \u002F\u002F Name of an npm package\n",[580,654,656,659],{"class":582,"line":655},8,[580,657,658],{"class":597},"    \"my-nitro-module\"",[580,660,646],{"class":590},[580,662,664],{"class":582,"line":663},9,[580,665,666],{"class":636},"    \u002F\u002F Inline module object\n",[580,668,670],{"class":582,"line":669},10,[580,671,672],{"class":590},"    {\n",[580,674,676,679,682],{"class":582,"line":675},11,[580,677,678],{"class":590},"      name: ",[580,680,681],{"class":597},"\"inline-module\"",[580,683,646],{"class":590},[580,685,687,690,693,696],{"class":582,"line":686},12,[580,688,689],{"class":620},"      setup",[580,691,692],{"class":590},"(",[580,694,462],{"class":695},"sQHwn",[580,697,698],{"class":590},") {\n",[580,700,702,705,708,710,713],{"class":582,"line":701},13,[580,703,704],{"class":590},"        nitro.logger.",[580,706,707],{"class":620},"info",[580,709,692],{"class":590},[580,711,712],{"class":597},"\"Inline module setup\"",[580,714,715],{"class":590},");\n",[580,717,719],{"class":582,"line":718},14,[580,720,721],{"class":590},"      },\n",[580,723,725],{"class":582,"line":724},15,[580,726,727],{"class":590},"    },\n",[580,729,731],{"class":582,"line":730},16,[580,732,733],{"class":636},"    \u002F\u002F Bare setup function\n",[580,735,737,740,742,745,748],{"class":582,"line":736},17,[580,738,739],{"class":590},"    (",[580,741,462],{"class":695},[580,743,744],{"class":590},") ",[580,746,747],{"class":586},"=>",[580,749,750],{"class":590}," {\n",[580,752,754,757,760,762,765,768,770],{"class":582,"line":753},18,[580,755,756],{"class":590},"      nitro.hooks.",[580,758,759],{"class":620},"hook",[580,761,692],{"class":590},[580,763,764],{"class":597},"\"compiled\"",[580,766,767],{"class":590},", () ",[580,769,747],{"class":586},[580,771,750],{"class":590},[580,773,775],{"class":582,"line":774},19,[580,776,777],{"class":636},"        \u002F\u002F ...\n",[580,779,781],{"class":582,"line":780},20,[580,782,783],{"class":590},"      });\n",[580,785,787],{"class":582,"line":786},21,[580,788,727],{"class":590},[580,790,792],{"class":582,"line":791},22,[580,793,794],{"class":590},"  ],\n",[580,796,798],{"class":582,"line":797},23,[580,799,800],{"class":590},"});\n",[451,802,803],{},"Each entry can be one of the following forms:",[488,805,806,819],{},[491,807,808],{},[494,809,810,813,816],{},[497,811,812],{},"Form",[497,814,815],{},"Example",[497,817,818],{},"Description",[506,820,821,842,863,879],{},[494,822,823,826,835],{},[511,824,825],{},"Path or package string",[511,827,828,831,832],{},[460,829,830],{},"\".\u002Fmodules\u002Fmy-module.ts\"",", ",[460,833,834],{},"\"my-nitro-module\"",[511,836,837,838,841],{},"Resolved from the project root and imported. The ",[455,839,840],{},"default export"," is used as the module.",[494,843,844,847,852],{},[511,845,846],{},"Module object",[511,848,849],{},[460,850,851],{},"{ name?, setup }",[511,853,854,855,858,859,862],{},"An object with a ",[460,856,857],{},"setup(nitro)"," function and an optional ",[460,860,861],{},"name",".",[494,864,865,868,873],{},[511,866,867],{},"Bare function",[511,869,870],{},[460,871,872],{},"(nitro) => { ... }",[511,874,875,876,862],{},"A shorthand for ",[460,877,878],{},"{ setup }",[494,880,881,884,889],{},[511,882,883],{},"Wrapper object",[511,885,886],{},[460,887,888],{},"{ nitro: { name?, setup } }",[511,890,854,891,893],{},[460,892,462],{}," key. Useful for packages that integrate with multiple tools from a single export.",[451,895,896,897,900,901,904,905,908],{},"Files in the ",[460,898,899],{},"modules\u002F"," directory are automatically registered as modules (like ",[460,902,903],{},"plugins\u002F"," for ",[479,906,907],{"href":54},"runtime plugins",").",[451,910,911,912,915],{},"Modules referenced by path or package name are resolved and installed ",[455,913,914],{},"only once"," — duplicate entries pointing to the same file are skipped.",[559,917,919],{"id":918},"authoring-a-module","Authoring a module",[451,921,922,923,926,927,935,936,939,940,943],{},"A module is an object with a ",[460,924,925],{},"setup"," function receiving the ",[479,928,932],{"href":929,"rel":930},"https:\u002F\u002Fgithub.com\u002Fnitrojs\u002Fnitro\u002Fblob\u002Fmain\u002Fsrc\u002Ftypes\u002Fnitro.ts",[931],"nofollow",[460,933,934],{},"Nitro"," instance. Use the ",[460,937,938],{},"NitroModule"," type from ",[460,941,942],{},"nitro\u002Ftypes"," for type safety:",[571,945,948],{"className":573,"code":946,"filename":947,"language":576,"meta":5,"style":5},"import type { NitroModule } from \"nitro\u002Ftypes\";\n\nexport default {\n  name: \"hello\",\n  setup(nitro) {\n    \u002F\u002F Add a virtual module usable anywhere in the server code as `#hello`\n    nitro.options.virtual[\"#hello\"] = `export const hello = \"world\";`;\n\n    \u002F\u002F Register a route handler pointing to the virtual module\n    nitro.options.handlers.push({\n      route: \"\u002F_hello\",\n      handler: \"#hello-handler\",\n    });\n    nitro.options.virtual[\"#hello-handler\"] = \u002F* ts *\u002F `\n      import { defineHandler } from \"nitro\";\n      import { hello } from \"#hello\";\n      export default defineHandler(() => ({ hello }));\n    `;\n  },\n} satisfies NitroModule;\n","modules\u002Fhello.ts",[460,949,950,967,971,979,989,1000,1005,1024,1028,1033,1043,1053,1063,1068,1084,1089,1094,1099,1106,1111],{"__ignoreMap":5},[580,951,952,954,957,960,962,965],{"class":582,"line":583},[580,953,587],{"class":586},[580,955,956],{"class":586}," type",[580,958,959],{"class":590}," { NitroModule } ",[580,961,594],{"class":586},[580,963,964],{"class":597}," \"nitro\u002Ftypes\"",[580,966,601],{"class":590},[580,968,969],{"class":582,"line":604},[580,970,608],{"emptyLinePlaceholder":607},[580,972,973,975,977],{"class":582,"line":611},[580,974,614],{"class":586},[580,976,617],{"class":586},[580,978,750],{"class":590},[580,980,981,984,987],{"class":582,"line":627},[580,982,983],{"class":590},"  name: ",[580,985,986],{"class":597},"\"hello\"",[580,988,646],{"class":590},[580,990,991,994,996,998],{"class":582,"line":633},[580,992,993],{"class":620},"  setup",[580,995,692],{"class":590},[580,997,462],{"class":695},[580,999,698],{"class":590},[580,1001,1002],{"class":582,"line":640},[580,1003,1004],{"class":636},"    \u002F\u002F Add a virtual module usable anywhere in the server code as `#hello`\n",[580,1006,1007,1010,1013,1016,1019,1022],{"class":582,"line":649},[580,1008,1009],{"class":590},"    nitro.options.virtual[",[580,1011,1012],{"class":597},"\"#hello\"",[580,1014,1015],{"class":590},"] ",[580,1017,1018],{"class":586},"=",[580,1020,1021],{"class":597}," `export const hello = \"world\";`",[580,1023,601],{"class":590},[580,1025,1026],{"class":582,"line":655},[580,1027,608],{"emptyLinePlaceholder":607},[580,1029,1030],{"class":582,"line":663},[580,1031,1032],{"class":636},"    \u002F\u002F Register a route handler pointing to the virtual module\n",[580,1034,1035,1038,1041],{"class":582,"line":669},[580,1036,1037],{"class":590},"    nitro.options.handlers.",[580,1039,1040],{"class":620},"push",[580,1042,624],{"class":590},[580,1044,1045,1048,1051],{"class":582,"line":675},[580,1046,1047],{"class":590},"      route: ",[580,1049,1050],{"class":597},"\"\u002F_hello\"",[580,1052,646],{"class":590},[580,1054,1055,1058,1061],{"class":582,"line":686},[580,1056,1057],{"class":590},"      handler: ",[580,1059,1060],{"class":597},"\"#hello-handler\"",[580,1062,646],{"class":590},[580,1064,1065],{"class":582,"line":701},[580,1066,1067],{"class":590},"    });\n",[580,1069,1070,1072,1074,1076,1078,1081],{"class":582,"line":718},[580,1071,1009],{"class":590},[580,1073,1060],{"class":597},[580,1075,1015],{"class":590},[580,1077,1018],{"class":586},[580,1079,1080],{"class":636}," \u002F* ts *\u002F",[580,1082,1083],{"class":597}," `\n",[580,1085,1086],{"class":582,"line":724},[580,1087,1088],{"class":597},"      import { defineHandler } from \"nitro\";\n",[580,1090,1091],{"class":582,"line":730},[580,1092,1093],{"class":597},"      import { hello } from \"#hello\";\n",[580,1095,1096],{"class":582,"line":736},[580,1097,1098],{"class":597},"      export default defineHandler(() => ({ hello }));\n",[580,1100,1101,1104],{"class":582,"line":753},[580,1102,1103],{"class":597},"    `",[580,1105,601],{"class":590},[580,1107,1108],{"class":582,"line":774},[580,1109,1110],{"class":590},"  },\n",[580,1112,1113,1116,1119,1122],{"class":582,"line":780},[580,1114,1115],{"class":590},"} ",[580,1117,1118],{"class":586},"satisfies",[580,1120,1121],{"class":620}," NitroModule",[580,1123,601],{"class":590},[451,1125,1126,1127,1129,1130,1132],{},"The ",[460,1128,925],{}," function can be async. Useful properties on the ",[460,1131,462],{}," instance:",[488,1134,1135,1144],{},[491,1136,1137],{},[494,1138,1139,1142],{},[497,1140,1141],{},"Property",[497,1143,818],{},[506,1145,1146,1168,1187,1203],{},[494,1147,1148,1153],{},[511,1149,1150],{},[460,1151,1152],{},"nitro.options",[511,1154,1155,1156,831,1159,831,1162,831,1164,1167],{},"Resolved config (mutable): ",[460,1157,1158],{},"handlers",[460,1160,1161],{},"virtual",[460,1163,485],{},[460,1165,1166],{},"runtimeConfig",", and every other option.",[494,1169,1170,1175],{},[511,1171,1172],{},[460,1173,1174],{},"nitro.hooks",[511,1176,1177,1178,1182,1183,1186],{},"Build-time ",[479,1179,1181],{"href":1180},"#build-time-hooks","hooks"," (",[460,1184,1185],{},"hookable"," instance).",[494,1188,1189,1194],{},[511,1190,1191],{},[460,1192,1193],{},"nitro.logger",[511,1195,1196,1197,1202],{},"Tagged ",[479,1198,1201],{"href":1199,"rel":1200},"https:\u002F\u002Fgithub.com\u002Funjs\u002Fconsola",[931],"consola"," logger for build-time output.",[494,1204,1205,1210],{},[511,1206,1207],{},[460,1208,1209],{},"nitro.meta",[511,1211,1212,1213,831,1216,908],{},"Nitro version info (",[460,1214,1215],{},"version",[460,1217,1218],{},"majorVersion",[559,1220,1222],{"id":1221},"build-time-hooks","Build-time hooks",[451,1224,1225,1226,1229],{},"Modules can hook into the build lifecycle with ",[460,1227,1228],{},"nitro.hooks.hook()",":",[571,1231,1234],{"className":573,"code":1232,"filename":1233,"language":576,"meta":5,"style":5},"import type { NitroModule } from \"nitro\u002Ftypes\";\n\nexport default {\n  name: \"build-info\",\n  setup(nitro) {\n    nitro.hooks.hook(\"compiled\", () => {\n      nitro.logger.info(`Server built in ${nitro.options.output.dir}`);\n    });\n  },\n} satisfies NitroModule;\n","modules\u002Fbuild-info.ts",[460,1235,1236,1250,1254,1262,1271,1281,1298,1332,1336,1340],{"__ignoreMap":5},[580,1237,1238,1240,1242,1244,1246,1248],{"class":582,"line":583},[580,1239,587],{"class":586},[580,1241,956],{"class":586},[580,1243,959],{"class":590},[580,1245,594],{"class":586},[580,1247,964],{"class":597},[580,1249,601],{"class":590},[580,1251,1252],{"class":582,"line":604},[580,1253,608],{"emptyLinePlaceholder":607},[580,1255,1256,1258,1260],{"class":582,"line":611},[580,1257,614],{"class":586},[580,1259,617],{"class":586},[580,1261,750],{"class":590},[580,1263,1264,1266,1269],{"class":582,"line":627},[580,1265,983],{"class":590},[580,1267,1268],{"class":597},"\"build-info\"",[580,1270,646],{"class":590},[580,1272,1273,1275,1277,1279],{"class":582,"line":633},[580,1274,993],{"class":620},[580,1276,692],{"class":590},[580,1278,462],{"class":695},[580,1280,698],{"class":590},[580,1282,1283,1286,1288,1290,1292,1294,1296],{"class":582,"line":640},[580,1284,1285],{"class":590},"    nitro.hooks.",[580,1287,759],{"class":620},[580,1289,692],{"class":590},[580,1291,764],{"class":597},[580,1293,767],{"class":590},[580,1295,747],{"class":586},[580,1297,750],{"class":590},[580,1299,1300,1303,1305,1307,1310,1312,1314,1317,1319,1322,1324,1327,1330],{"class":582,"line":649},[580,1301,1302],{"class":590},"      nitro.logger.",[580,1304,707],{"class":620},[580,1306,692],{"class":590},[580,1308,1309],{"class":597},"`Server built in ${",[580,1311,462],{"class":590},[580,1313,862],{"class":597},[580,1315,1316],{"class":590},"options",[580,1318,862],{"class":597},[580,1320,1321],{"class":590},"output",[580,1323,862],{"class":597},[580,1325,1326],{"class":590},"dir",[580,1328,1329],{"class":597},"}`",[580,1331,715],{"class":590},[580,1333,1334],{"class":582,"line":655},[580,1335,1067],{"class":590},[580,1337,1338],{"class":582,"line":663},[580,1339,1110],{"class":590},[580,1341,1342,1344,1346,1348],{"class":582,"line":669},[580,1343,1115],{"class":590},[580,1345,1118],{"class":586},[580,1347,1121],{"class":620},[580,1349,601],{"class":590},[451,1351,1352],{},"The most useful hooks:",[488,1354,1355,1368],{},[491,1356,1357],{},[494,1358,1359,1362,1365],{},[497,1360,1361],{},"Hook",[497,1363,1364],{},"Signature",[497,1366,1367],{},"When it runs",[506,1369,1370,1388,1403,1418,1432,1447,1462,1477,1492,1507,1522,1537,1552],{},[494,1371,1372,1377,1382],{},[511,1373,1374],{},[460,1375,1376],{},"types:extend",[511,1378,1379],{},[460,1380,1381],{},"(types) => void",[511,1383,1384,1385,862],{},"When generating TypeScript types. Extend generated route types and ",[460,1386,1387],{},"tsConfig",[494,1389,1390,1395,1400],{},[511,1391,1392],{},[460,1393,1394],{},"build:before",[511,1396,1397],{},[460,1398,1399],{},"(nitro) => void",[511,1401,1402],{},"Before the build starts, before the bundler config is created.",[494,1404,1405,1410,1415],{},[511,1406,1407],{},[460,1408,1409],{},"rollup:before",[511,1411,1412],{},[460,1413,1414],{},"(nitro, config) => void",[511,1416,1417],{},"After the bundler (Rollup \u002F Rolldown) config is resolved, right before bundling. Last chance to modify it.",[494,1419,1420,1425,1429],{},[511,1421,1422],{},[460,1423,1424],{},"compiled",[511,1426,1427],{},[460,1428,1399],{},[511,1430,1431],{},"After the server bundle is written to the output directory.",[494,1433,1434,1439,1444],{},[511,1435,1436],{},[460,1437,1438],{},"dev:start",[511,1440,1441],{},[460,1442,1443],{},"() => void",[511,1445,1446],{},"In development, when the dev worker starts.",[494,1448,1449,1454,1459],{},[511,1450,1451],{},[460,1452,1453],{},"dev:reload",[511,1455,1456],{},[460,1457,1458],{},"(payload?) => void",[511,1460,1461],{},"In development, after each rebuild when the dev worker reloads.",[494,1463,1464,1469,1474],{},[511,1465,1466],{},[460,1467,1468],{},"dev:error",[511,1470,1471],{},[460,1472,1473],{},"(cause?) => void",[511,1475,1476],{},"In development, when a build error occurs.",[494,1478,1479,1484,1489],{},[511,1480,1481],{},[460,1482,1483],{},"prerender:routes",[511,1485,1486],{},[460,1487,1488],{},"(routes: Set\u003Cstring>) => void",[511,1490,1491],{},"Before prerendering. Add or remove routes to prerender.",[494,1493,1494,1499,1504],{},[511,1495,1496],{},[460,1497,1498],{},"prerender:config",[511,1500,1501],{},[460,1502,1503],{},"(config) => void",[511,1505,1506],{},"When the prerenderer's Nitro config is created.",[494,1508,1509,1514,1519],{},[511,1510,1511],{},[460,1512,1513],{},"prerender:generate",[511,1515,1516],{},[460,1517,1518],{},"(route, nitro) => void",[511,1520,1521],{},"For each route, before it is generated.",[494,1523,1524,1529,1534],{},[511,1525,1526],{},[460,1527,1528],{},"prerender:route",[511,1530,1531],{},[460,1532,1533],{},"(route) => void",[511,1535,1536],{},"For each route, after it is generated.",[494,1538,1539,1544,1549],{},[511,1540,1541],{},[460,1542,1543],{},"prerender:done",[511,1545,1546],{},[460,1547,1548],{},"({ prerenderedRoutes, failedRoutes }) => void",[511,1550,1551],{},"After prerendering finishes.",[494,1553,1554,1559,1563],{},[511,1555,1556],{},[460,1557,1558],{},"close",[511,1560,1561],{},[460,1562,1443],{},[511,1564,1565],{},"When the Nitro instance is closed.",[451,1567,1568,1569,1574,1575,1579,1580,1583],{},"All hooks can be async. See the ",[479,1570,1573],{"href":1571,"rel":1572},"https:\u002F\u002Fgithub.com\u002Fnitrojs\u002Fnitro\u002Fblob\u002Fmain\u002Fsrc\u002Ftypes\u002Fhooks.ts",[931],"hooks source"," for the full list and exact signatures, and the ",[479,1576,1578],{"href":1577},"\u002Fdocs\u002Fprerendering#hooks","prerendering guide"," for the ",[460,1581,1582],{},"prerender:*"," hooks in context.",[1585,1586,1587],"tip",{},[451,1588,1589,1590,831,1593,831,1596,1599,1600,1603,1604,1606,1607,862],{},"Runtime hooks (",[460,1591,1592],{},"request",[460,1594,1595],{},"response",[460,1597,1598],{},"error",") are ",[455,1601,1602],{},"not"," available here — they belong to ",[479,1605,485],{"href":54},". A module can still add runtime behavior by pushing a plugin file to ",[460,1608,1609],{},"nitro.options.plugins",[559,1611,1613],{"id":1612},"best-practices","Best practices",[1615,1616,1617,1624,1630,1639,1650],"ul",{},[1618,1619,1620,1623],"li",{},[455,1621,1622],{},"Keep modules idempotent."," In development, options can be re-processed on config changes — check before pushing duplicate handlers, plugins, or virtual entries.",[1618,1625,1626,1629],{},[455,1627,1628],{},"Prefer hooks over patching."," Use build hooks to react to lifecycle events instead of monkey-patching Nitro internals or overwriting functions.",[1618,1631,1632,1635,1636,1638],{},[455,1633,1634],{},"Respect user options."," Read existing values from ",[460,1637,1152],{}," and extend them instead of replacing them. Let users opt out of your module's behavior.",[1618,1640,1641,1646,1647,862],{},[455,1642,1643,1644],{},"Use ",[460,1645,1193],{}," for build-time output instead of ",[460,1648,1649],{},"console",[1618,1651,1652,1655],{},[455,1653,1654],{},"Mind the runtime bundle."," Any handler or plugin your module adds is bundled for every deployment target — keep runtime code minimal and runtime-agnostic.",[559,1657,1659],{"id":1658},"distributing-modules","Distributing modules",[451,1661,1662,1663,1665],{},"To share a module as an npm package, export the module object as the ",[455,1664,840],{}," and users can reference it by package name:",[1667,1668,1669,1738],"CodeGroup",{},[571,1670,1673],{"className":573,"code":1671,"filename":1672,"language":576,"meta":5,"style":5},"import type { NitroModule } from \"nitro\u002Ftypes\";\n\nexport default {\n  name: \"my-nitro-module\",\n  setup(nitro) {\n    \u002F\u002F ...\n  },\n} satisfies NitroModule;\n","my-nitro-module\u002Fsrc\u002Findex.ts",[460,1674,1675,1689,1693,1701,1709,1719,1724,1728],{"__ignoreMap":5},[580,1676,1677,1679,1681,1683,1685,1687],{"class":582,"line":583},[580,1678,587],{"class":586},[580,1680,956],{"class":586},[580,1682,959],{"class":590},[580,1684,594],{"class":586},[580,1686,964],{"class":597},[580,1688,601],{"class":590},[580,1690,1691],{"class":582,"line":604},[580,1692,608],{"emptyLinePlaceholder":607},[580,1694,1695,1697,1699],{"class":582,"line":611},[580,1696,614],{"class":586},[580,1698,617],{"class":586},[580,1700,750],{"class":590},[580,1702,1703,1705,1707],{"class":582,"line":627},[580,1704,983],{"class":590},[580,1706,834],{"class":597},[580,1708,646],{"class":590},[580,1710,1711,1713,1715,1717],{"class":582,"line":633},[580,1712,993],{"class":620},[580,1714,692],{"class":590},[580,1716,462],{"class":695},[580,1718,698],{"class":590},[580,1720,1721],{"class":582,"line":640},[580,1722,1723],{"class":636},"    \u002F\u002F ...\n",[580,1725,1726],{"class":582,"line":649},[580,1727,1110],{"class":590},[580,1729,1730,1732,1734,1736],{"class":582,"line":655},[580,1731,1115],{"class":590},[580,1733,1118],{"class":586},[580,1735,1121],{"class":620},[580,1737,601],{"class":590},[571,1739,1741],{"className":573,"code":1740,"filename":575,"language":576,"meta":5,"style":5},"import { defineConfig } from \"nitro\";\n\nexport default defineConfig({\n  modules: [\"my-nitro-module\"],\n});\n",[460,1742,1743,1755,1759,1769,1779],{"__ignoreMap":5},[580,1744,1745,1747,1749,1751,1753],{"class":582,"line":583},[580,1746,587],{"class":586},[580,1748,591],{"class":590},[580,1750,594],{"class":586},[580,1752,598],{"class":597},[580,1754,601],{"class":590},[580,1756,1757],{"class":582,"line":604},[580,1758,608],{"emptyLinePlaceholder":607},[580,1760,1761,1763,1765,1767],{"class":582,"line":611},[580,1762,614],{"class":586},[580,1764,617],{"class":586},[580,1766,621],{"class":620},[580,1768,624],{"class":590},[580,1770,1771,1774,1776],{"class":582,"line":627},[580,1772,1773],{"class":590},"  modules: [",[580,1775,834],{"class":597},[580,1777,1778],{"class":590},"],\n",[580,1780,1781],{"class":582,"line":633},[580,1782,800],{"class":590},[451,1784,1785,1786,1788,1789,1791],{},"Add ",[460,1787,462],{}," as a peer dependency, and import types only from ",[460,1790,942],{}," so your package does not bundle Nitro itself.",[1793,1794,1795],"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 .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}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);}",{"title":5,"searchDepth":604,"depth":604,"links":1797},[1798,1799,1800,1801,1802],{"id":561,"depth":604,"text":562},{"id":918,"depth":604,"text":919},{"id":1221,"depth":604,"text":1222},{"id":1612,"depth":604,"text":1613},{"id":1658,"depth":604,"text":1659},"Use modules to extend Nitro's build-time behavior.","md",{"icon":76},{"icon":76},{"title":73,"description":1803},"Ujkfd_Un-iAA3EMtaYZ07X-taj6en8QAT42uuazr_Qk",[1810,1812],{"title":68,"path":69,"stem":70,"description":1811,"icon":71,"children":-1},"Nitro provides cross-platform WebSocket support powered by CrossWS and H3.",{"title":78,"path":79,"stem":80,"description":1813,"icon":81,"children":-1},"Use a server entry to create a global middleware that runs for all routes before they are matched.",1784019071953]