[{"data":1,"prerenderedAt":1506},["ShallowReactive",2],{"navigation":3,"-docs-vite":445,"-docs-vite-surround":1501},[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":447,"body":448,"description":1495,"extension":1496,"meta":1497,"navigation":1498,"path":89,"seo":1499,"stem":90,"__hash__":1500},"content\u002F1.docs\u002F61.vite.md","Vite Integration",{"type":449,"value":450,"toc":1482,"icon":91},"minimark",[451,462,467,470,559,562,599,610,627,631,634,710,725,728,757,771,775,782,806,1013,1030,1043,1048,1054,1070,1078,1085,1089,1092,1147,1151,1154,1189,1234,1237,1259,1268,1272,1298,1302,1311,1375,1385,1391,1395,1478],[452,453,454,455,461],"p",{},"Nitro integrates with ",[456,457,88],"a",{"href":458,"rel":459},"https:\u002F\u002Fvite.dev",[460],"nofollow"," as a plugin. Adding it to a Vite project gives you a full server alongside your frontend: API routes, server-side rendering, and a production build that deploys anywhere.",[463,464,466],"h2",{"id":465},"nitro-as-a-vite-plugin","Nitro as a Vite plugin",[452,468,469],{},"Add the plugin to your Vite config:",[471,472,477],"pre",{"className":473,"code":474,"filename":475,"language":476,"meta":5,"style":5},"language-ts shiki shiki-themes github-light github-dark github-dark","import { defineConfig } from \"vite\";\nimport { nitro } from \"nitro\u002Fvite\";\n\nexport default defineConfig({\n  plugins: [nitro()],\n});\n","vite.config.ts","ts",[478,479,480,503,518,525,541,553],"code",{"__ignoreMap":5},[481,482,485,489,493,496,500],"span",{"class":483,"line":484},"line",1,[481,486,488],{"class":487},"so5gQ","import",[481,490,492],{"class":491},"slsVL"," { defineConfig } ",[481,494,495],{"class":487},"from",[481,497,499],{"class":498},"sfrk1"," \"vite\"",[481,501,502],{"class":491},";\n",[481,504,506,508,511,513,516],{"class":483,"line":505},2,[481,507,488],{"class":487},[481,509,510],{"class":491}," { nitro } ",[481,512,495],{"class":487},[481,514,515],{"class":498}," \"nitro\u002Fvite\"",[481,517,502],{"class":491},[481,519,521],{"class":483,"line":520},3,[481,522,524],{"emptyLinePlaceholder":523},true,"\n",[481,526,528,531,534,538],{"class":483,"line":527},4,[481,529,530],{"class":487},"export",[481,532,533],{"class":487}," default",[481,535,537],{"class":536},"shcOC"," defineConfig",[481,539,540],{"class":491},"({\n",[481,542,544,547,550],{"class":483,"line":543},5,[481,545,546],{"class":491},"  plugins: [",[481,548,549],{"class":536},"nitro",[481,551,552],{"class":491},"()],\n",[481,554,556],{"class":483,"line":555},6,[481,557,558],{"class":491},"});\n",[452,560,561],{},"With the plugin enabled, you use the Vite CLI for everything:",[563,564,565,575,591],"ul",{},[566,567,568,574],"li",{},[569,570,571],"strong",{},[478,572,573],{},"vite dev"," — One dev server for both frontend and backend. Nitro serves your server routes and assets while Vite handles client modules. Server code runs in an isolated worker and automatically reloads when server files change, while client code keeps Vite's hot module replacement (HMR).",[566,576,577,582,583,586,587,590],{},[569,578,579],{},[478,580,581],{},"vite build"," — Builds the client and the server together into a single deployable ",[478,584,585],{},".output\u002F"," directory, using any ",[456,588,589],{"href":125},"deployment preset",".",[566,592,593,598],{},[569,594,595],{},[478,596,597],{},"vite preview"," — Serves the production build locally through Nitro, including static assets and WebSocket support.",[600,601,602],"tip",{},[452,603,604,605,609],{},"Follow the ",[456,606,608],{"href":607},"\u002Fdocs\u002Fquick-start#add-to-a-vite-project","quick start"," for a step-by-step guide to adding Nitro to an existing Vite project.",[611,612,613],"note",{},[452,614,615,616,618,619,622,623,626],{},"When using the Vite plugin, prefer ",[478,617,573],{}," over ",[478,620,621],{},"nitro dev"," — the Nitro CLI dev server does not support the Vite builder. ",[478,624,625],{},"nitro build"," works and runs the Vite build under the hood.",[463,628,630],{"id":629},"frontend-frameworks","Frontend frameworks",[452,632,633],{},"The Nitro plugin composes with other Vite plugins, so you can use your favorite frontend framework for server-side rendering with client hydration:",[471,635,637],{"className":473,"code":636,"filename":475,"language":476,"meta":5,"style":5},"import { defineConfig } from \"vite\";\nimport { nitro } from \"nitro\u002Fvite\";\nimport react from \"@vitejs\u002Fplugin-react\";\n\nexport default defineConfig({\n  plugins: [nitro(), react()],\n});\n",[478,638,639,651,663,677,681,691,705],{"__ignoreMap":5},[481,640,641,643,645,647,649],{"class":483,"line":484},[481,642,488],{"class":487},[481,644,492],{"class":491},[481,646,495],{"class":487},[481,648,499],{"class":498},[481,650,502],{"class":491},[481,652,653,655,657,659,661],{"class":483,"line":505},[481,654,488],{"class":487},[481,656,510],{"class":491},[481,658,495],{"class":487},[481,660,515],{"class":498},[481,662,502],{"class":491},[481,664,665,667,670,672,675],{"class":483,"line":520},[481,666,488],{"class":487},[481,668,669],{"class":491}," react ",[481,671,495],{"class":487},[481,673,674],{"class":498}," \"@vitejs\u002Fplugin-react\"",[481,676,502],{"class":491},[481,678,679],{"class":483,"line":527},[481,680,524],{"emptyLinePlaceholder":523},[481,682,683,685,687,689],{"class":483,"line":543},[481,684,530],{"class":487},[481,686,533],{"class":487},[481,688,537],{"class":536},[481,690,540],{"class":491},[481,692,693,695,697,700,703],{"class":483,"line":555},[481,694,546],{"class":491},[481,696,549],{"class":536},[481,698,699],{"class":491},"(), ",[481,701,702],{"class":536},"react",[481,704,552],{"class":491},[481,706,708],{"class":483,"line":707},7,[481,709,558],{"class":491},[452,711,712,713,716,717,720,721,724],{},"Nitro automatically detects a file named ",[478,714,715],{},"entry-server.(ts|js|tsx|jsx|mjs)"," (in the project root, ",[478,718,719],{},"app\u002F",", ",[478,722,723],{},"src\u002F",", or the server directory) and uses it as the SSR entry.",[452,726,727],{},"Instead of re-explaining each setup, see the working examples:",[563,729,730,734,738,743,747,752],{},[566,731,732],{},[456,733,399],{"href":400},[566,735,736],{},[456,737,417],{"href":418},[566,739,740],{},[456,741,742],{"href":404},"SSR with Solid",[566,744,745],{},[456,746,394],{"href":395},[566,748,749],{},[456,750,751],{"href":385},"React Server Components",[566,753,754],{},[456,755,756],{"href":390},"SSR with plain HTML",[758,759,760],"read-more",{"to":19},[452,761,762,763,766,767,770],{},"Learn more about how unmatched routes are rendered in the ",[456,764,765],{"href":19},"renderer"," and ",[456,768,769],{"href":79},"server entry"," guides.",[463,772,774],{"id":773},"configuring-nitro-with-vite","Configuring Nitro with Vite",[452,776,777,778,781],{},"Nitro configuration can live in three places, all accepting the same ",[456,779,780],{"href":262},"options",":",[783,784,786,794,800],"steps",{"level":785},"4",[787,788,789,790,793],"h4",{},"A ",[478,791,792],{},"nitro.config.ts"," file (recommended for most projects)",[787,795,796,797,799],{},"The ",[478,798,549],{}," key in your Vite config",[787,801,802,803],{},"Inline plugin options passed to ",[478,804,805],{},"nitro()",[807,808,809,856,933],"code-group",{},[471,810,812],{"className":473,"code":811,"filename":792,"language":476,"meta":5,"style":5},"import { defineConfig } from \"nitro\";\n\nexport default defineConfig({\n  serverDir: \".\u002Fserver\",\n});\n",[478,813,814,827,831,841,852],{"__ignoreMap":5},[481,815,816,818,820,822,825],{"class":483,"line":484},[481,817,488],{"class":487},[481,819,492],{"class":491},[481,821,495],{"class":487},[481,823,824],{"class":498}," \"nitro\"",[481,826,502],{"class":491},[481,828,829],{"class":483,"line":505},[481,830,524],{"emptyLinePlaceholder":523},[481,832,833,835,837,839],{"class":483,"line":520},[481,834,530],{"class":487},[481,836,533],{"class":487},[481,838,537],{"class":536},[481,840,540],{"class":491},[481,842,843,846,849],{"class":483,"line":527},[481,844,845],{"class":491},"  serverDir: ",[481,847,848],{"class":498},"\".\u002Fserver\"",[481,850,851],{"class":491},",\n",[481,853,854],{"class":483,"line":543},[481,855,558],{"class":491},[471,857,860],{"className":473,"code":858,"filename":859,"language":476,"meta":5,"style":5},"import { defineConfig } from \"vite\";\nimport { nitro } from \"nitro\u002Fvite\";\n\nexport default defineConfig({\n  plugins: [nitro()],\n  nitro: {\n    serverDir: \".\u002Fserver\",\n  },\n});\n","vite.config.ts (nitro key)",[478,861,862,874,886,890,900,908,913,922,928],{"__ignoreMap":5},[481,863,864,866,868,870,872],{"class":483,"line":484},[481,865,488],{"class":487},[481,867,492],{"class":491},[481,869,495],{"class":487},[481,871,499],{"class":498},[481,873,502],{"class":491},[481,875,876,878,880,882,884],{"class":483,"line":505},[481,877,488],{"class":487},[481,879,510],{"class":491},[481,881,495],{"class":487},[481,883,515],{"class":498},[481,885,502],{"class":491},[481,887,888],{"class":483,"line":520},[481,889,524],{"emptyLinePlaceholder":523},[481,891,892,894,896,898],{"class":483,"line":527},[481,893,530],{"class":487},[481,895,533],{"class":487},[481,897,537],{"class":536},[481,899,540],{"class":491},[481,901,902,904,906],{"class":483,"line":543},[481,903,546],{"class":491},[481,905,549],{"class":536},[481,907,552],{"class":491},[481,909,910],{"class":483,"line":555},[481,911,912],{"class":491},"  nitro: {\n",[481,914,915,918,920],{"class":483,"line":707},[481,916,917],{"class":491},"    serverDir: ",[481,919,848],{"class":498},[481,921,851],{"class":491},[481,923,925],{"class":483,"line":924},8,[481,926,927],{"class":491},"  },\n",[481,929,931],{"class":483,"line":930},9,[481,932,558],{"class":491},[471,934,937],{"className":473,"code":935,"filename":936,"language":476,"meta":5,"style":5},"import { defineConfig } from \"vite\";\nimport { nitro } from \"nitro\u002Fvite\";\n\nexport default defineConfig({\n  plugins: [\n    nitro({\n      serverDir: \".\u002Fserver\",\n    }),\n  ],\n});\n","vite.config.ts (inline)",[478,938,939,951,963,967,977,982,989,998,1003,1008],{"__ignoreMap":5},[481,940,941,943,945,947,949],{"class":483,"line":484},[481,942,488],{"class":487},[481,944,492],{"class":491},[481,946,495],{"class":487},[481,948,499],{"class":498},[481,950,502],{"class":491},[481,952,953,955,957,959,961],{"class":483,"line":505},[481,954,488],{"class":487},[481,956,510],{"class":491},[481,958,495],{"class":487},[481,960,515],{"class":498},[481,962,502],{"class":491},[481,964,965],{"class":483,"line":520},[481,966,524],{"emptyLinePlaceholder":523},[481,968,969,971,973,975],{"class":483,"line":527},[481,970,530],{"class":487},[481,972,533],{"class":487},[481,974,537],{"class":536},[481,976,540],{"class":491},[481,978,979],{"class":483,"line":543},[481,980,981],{"class":491},"  plugins: [\n",[481,983,984,987],{"class":483,"line":555},[481,985,986],{"class":536},"    nitro",[481,988,540],{"class":491},[481,990,991,994,996],{"class":483,"line":707},[481,992,993],{"class":491},"      serverDir: ",[481,995,848],{"class":498},[481,997,851],{"class":491},[481,999,1000],{"class":483,"line":924},[481,1001,1002],{"class":491},"    }),\n",[481,1004,1005],{"class":483,"line":930},[481,1006,1007],{"class":491},"  ],\n",[481,1009,1011],{"class":483,"line":1010},10,[481,1012,558],{"class":491},[452,1014,1015,1016,1018,1019,1021,1022,1025,1026,1029],{},"Inline plugin options take precedence over the ",[478,1017,549],{}," key in the Vite config, and both override ",[478,1020,792],{},". The ",[478,1023,1024],{},"dev"," mode and ",[478,1027,1028],{},"rootDir"," are inferred from Vite and cannot be overridden.",[452,1031,1032,1033,1035,1036,1039,1040,590],{},"Vite plugins can also extend Nitro programmatically by exposing a ",[478,1034,549],{}," key (a ",[456,1037,1038],{"href":74},"Nitro module",") on the plugin object — see the ",[456,1041,1042],{"href":381},"Vite Nitro plugin example",[1044,1045,1047],"h3",{"id":1046},"experimental-plugin-options","Experimental plugin options",[452,1049,1050,1051,781],{},"The plugin additionally accepts Vite-specific flags under ",[478,1052,1053],{},"experimental.vite",[1055,1056,1059],"field",{"name":1057,"type":1058},"assetsImport","boolean",[452,1060,1061,1062,1065,1066,1069],{},"Enable ",[478,1063,1064],{},"?assets"," imports for collecting CSS and JS assets from entry points (default: ",[478,1067,1068],{},"true",").",[1055,1071,1073],{"name":1072,"type":1058},"serverReload",[452,1074,1075,1076,1069],{},"Reload the server (and browser) when a server-only module changes (default: ",[478,1077,1068],{},[1055,1079,1082],{"name":1080,"type":1081},"services","Record\u003Cstring, { entry: string }>",[452,1083,1084],{},"Register additional server environments as fetchable services.",[463,1086,1088],{"id":1087},"builders","Builders",[452,1090,1091],{},"Nitro can bundle your server with one of three builders:",[1093,1094,1095,1108],"table",{},[1096,1097,1098],"thead",{},[1099,1100,1101,1105],"tr",{},[1102,1103,1104],"th",{},"Builder",[1102,1106,1107],{},"Description",[1109,1110,1111,1122,1135],"tbody",{},[1099,1112,1113,1119],{},[1114,1115,1116],"td",{},[478,1117,1118],{},"rolldown",[1114,1120,1121],{},"Default. Rust-based bundler, ships with Nitro — no extra installation needed.",[1099,1123,1124,1129],{},[1114,1125,1126],{},[478,1127,1128],{},"rollup",[1114,1130,1131,1132,1134],{},"Battle-tested bundler with a mature plugin ecosystem. Requires ",[478,1133,1128],{}," to be installed.",[1099,1136,1137,1142],{},[1114,1138,1139],{},[478,1140,1141],{},"vite",[1114,1143,1144,1145,1134],{},"Full-stack builds via the Vite plugin. Requires ",[478,1146,1141],{},[1044,1148,1150],{"id":1149},"how-the-builder-is-selected","How the builder is selected",[452,1152,1153],{},"The builder is resolved in this order:",[783,1155,1156,1162,1168,1184],{"level":785},[787,1157,796,1158,1161],{},[478,1159,1160],{},"builder"," option in your Nitro config.",[787,1163,796,1164,1167],{},[478,1165,1166],{},"NITRO_BUILDER"," environment variable.",[787,1169,1170,1171,1173,1174,1177,1178,1180,1181,1183],{},"Auto-detection: if ",[478,1172,1141],{}," is installed and your ",[478,1175,1176],{},"vite.config"," uses the ",[478,1179,805],{}," plugin, the ",[478,1182,1141],{}," builder is used.",[787,1185,1186,1187,590],{},"Otherwise, Nitro defaults to ",[478,1188,1118],{},[471,1190,1192],{"className":473,"code":1191,"filename":792,"language":476,"meta":5,"style":5},"import { defineConfig } from \"nitro\";\n\nexport default defineConfig({\n  builder: \"rollup\",\n});\n",[478,1193,1194,1206,1210,1220,1230],{"__ignoreMap":5},[481,1195,1196,1198,1200,1202,1204],{"class":483,"line":484},[481,1197,488],{"class":487},[481,1199,492],{"class":491},[481,1201,495],{"class":487},[481,1203,824],{"class":498},[481,1205,502],{"class":491},[481,1207,1208],{"class":483,"line":505},[481,1209,524],{"emptyLinePlaceholder":523},[481,1211,1212,1214,1216,1218],{"class":483,"line":520},[481,1213,530],{"class":487},[481,1215,533],{"class":487},[481,1217,537],{"class":536},[481,1219,540],{"class":491},[481,1221,1222,1225,1228],{"class":483,"line":527},[481,1223,1224],{"class":491},"  builder: ",[481,1226,1227],{"class":498},"\"rollup\"",[481,1229,851],{"class":491},[481,1231,1232],{"class":483,"line":543},[481,1233,558],{"class":491},[452,1235,1236],{},"Or without touching the config file:",[471,1238,1242],{"className":1239,"code":1240,"language":1241,"meta":5,"style":5},"language-bash shiki shiki-themes github-light github-dark github-dark","NITRO_BUILDER=rollup nitro build\n","bash",[478,1243,1244],{"__ignoreMap":5},[481,1245,1246,1248,1251,1253,1256],{"class":483,"line":484},[481,1247,1166],{"class":491},[481,1249,1250],{"class":487},"=",[481,1252,1128],{"class":498},[481,1254,1255],{"class":536}," nitro",[481,1257,1258],{"class":498}," build\n",[452,1260,1261,1262,1264,1265,1267],{},"If you explicitly select ",[478,1263,1128],{}," or ",[478,1266,1141],{}," and the package is not installed, Nitro prompts to install it as a dev dependency.",[1044,1269,1271],{"id":1270},"which-builder-to-pick","Which builder to pick",[563,1273,1274,1282,1290],{},[566,1275,1276,1277,1281],{},"Stick with ",[569,1278,1279],{},[478,1280,1118],{}," for standalone servers and APIs — it is the fastest option and works out of the box.",[566,1283,1284,1285,1289],{},"Pick ",[569,1286,1287],{},[478,1288,1128],{}," if you depend on Rollup-specific plugins or need maximum ecosystem compatibility.",[566,1291,1292,1293,1297],{},"Use ",[569,1294,1295],{},[478,1296,1141],{}," (usually via auto-detection) whenever you have a frontend built with Vite — it is the only builder that bundles client and server together.",[1044,1299,1301],{"id":1300},"customizing-the-bundler","Customizing the bundler",[452,1303,1304,1305,1264,1308,781],{},"For advanced cases, you can pass extra configuration directly to the underlying bundler with ",[478,1306,1307],{},"rollupConfig",[478,1309,1310],{},"rolldownConfig",[471,1312,1314],{"className":473,"code":1313,"filename":792,"language":476,"meta":5,"style":5},"import { defineConfig } from \"nitro\";\n\nexport default defineConfig({\n  rolldownConfig: {\n    \u002F\u002F Extra Rolldown options and plugins\n  },\n  rollupConfig: {\n    \u002F\u002F Extra Rollup options and plugins\n  },\n});\n",[478,1315,1316,1328,1332,1342,1347,1353,1357,1362,1367,1371],{"__ignoreMap":5},[481,1317,1318,1320,1322,1324,1326],{"class":483,"line":484},[481,1319,488],{"class":487},[481,1321,492],{"class":491},[481,1323,495],{"class":487},[481,1325,824],{"class":498},[481,1327,502],{"class":491},[481,1329,1330],{"class":483,"line":505},[481,1331,524],{"emptyLinePlaceholder":523},[481,1333,1334,1336,1338,1340],{"class":483,"line":520},[481,1335,530],{"class":487},[481,1337,533],{"class":487},[481,1339,537],{"class":536},[481,1341,540],{"class":491},[481,1343,1344],{"class":483,"line":527},[481,1345,1346],{"class":491},"  rolldownConfig: {\n",[481,1348,1349],{"class":483,"line":543},[481,1350,1352],{"class":1351},"sCsY4","    \u002F\u002F Extra Rolldown options and plugins\n",[481,1354,1355],{"class":483,"line":555},[481,1356,927],{"class":491},[481,1358,1359],{"class":483,"line":707},[481,1360,1361],{"class":491},"  rollupConfig: {\n",[481,1363,1364],{"class":483,"line":924},[481,1365,1366],{"class":1351},"    \u002F\u002F Extra Rollup options and plugins\n",[481,1368,1369],{"class":483,"line":930},[481,1370,927],{"class":491},[481,1372,1373],{"class":483,"line":1010},[481,1374,558],{"class":491},[452,1376,1377,1378,1380,1381,1384],{},"Each option applies to its matching builder. With the ",[478,1379,1141],{}," builder, both are merged into the server bundle configuration depending on whether Vite runs on Rolldown (",[478,1382,1383],{},"rolldown-vite",") or Rollup.",[1386,1387,1388],"warning",{},[452,1389,1390],{},"These options are escape hatches. Prefer built-in Nitro options when available, as low-level bundler overrides can break across builders.",[463,1392,1394],{"id":1393},"good-to-know","Good to know",[563,1396,1397,1403,1424,1449],{},[566,1398,1399,1402],{},[569,1400,1401],{},"Server reloads instead of HMR",": changes to server-only modules trigger a server reload (and a browser refresh) rather than hot module replacement. Modules shared between client and server keep normal Vite HMR.",[566,1404,1405,1408,1409,1412,1413,1416,1417,1420,1421,1069],{},[569,1406,1407],{},"Dev server port",": the port is resolved from the ",[478,1410,1411],{},"PORT"," environment variable, then Vite's ",[478,1414,1415],{},"server.port",", then Nitro's ",[478,1418,1419],{},"devServer.port"," (default: ",[478,1422,1423],{},"3000",[566,1425,1426,1429,1430,720,1433,1436,1437,720,1440,1443,1444,590],{},[569,1427,1428],{},"Environment files",": in dev mode, Nitro loads ",[478,1431,1432],{},".env",[478,1434,1435],{},".env.local",", and mode-specific variants (",[478,1438,1439],{},".env.[mode]",[478,1441,1442],{},".env.[mode].local",") following ",[456,1445,1448],{"href":1446,"rel":1447},"https:\u002F\u002Fvite.dev\u002Fguide\u002Fenv-and-mode#env-files",[460],"Vite conventions",[566,1450,1451,1454,1455,1460,1461,766,1464,1466,1467,1470,1471,1474,1475,590],{},[569,1452,1453],{},"Vite environments",": Nitro uses the ",[456,1456,1459],{"href":1457,"rel":1458},"https:\u002F\u002Fvite.dev\u002Fguide\u002Fapi-environment",[460],"Vite environment API"," and registers ",[478,1462,1463],{},"client",[478,1465,549],{}," environments (plus ",[478,1468,1469],{},"ssr"," when an SSR entry exists). You can configure the client entry point via ",[478,1472,1473],{},"environments.client.build.rollupOptions.input"," in your Vite config, as shown in the ",[456,1476,1477],{"href":400},"SSR examples",[1479,1480,1481],"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 .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":505,"depth":505,"links":1483},[1484,1485,1486,1489,1494],{"id":465,"depth":505,"text":466},{"id":629,"depth":505,"text":630},{"id":773,"depth":505,"text":774,"children":1487},[1488],{"id":1046,"depth":520,"text":1047},{"id":1087,"depth":505,"text":1088,"children":1490},[1491,1492,1493],{"id":1149,"depth":520,"text":1150},{"id":1270,"depth":520,"text":1271},{"id":1300,"depth":520,"text":1301},{"id":1393,"depth":505,"text":1394},"Use Nitro as a Vite plugin to build full-stack applications, and choose the builder that bundles your server.","md",{"icon":91},{"title":88,"icon":91},{"title":447,"description":1495},"AQpMce12bCchJLARmIK8zzQL-7luT-YG7clYfGL1zq4",[1502,1504],{"title":83,"path":84,"stem":85,"description":1503,"icon":86,"children":-1},"Nitro ships with a nitro command to develop, build, preview, and deploy your project.",{"title":93,"path":94,"stem":95,"description":1505,"icon":96,"children":-1},"A reference of everything you can import from nitro and its subpaths in your server code.",1784019071970]