[{"data":1,"prerenderedAt":874},["ShallowReactive",2],{"navigation":3,"-deploy-custom-presets":225,"-deploy-custom-presets-surround":869},[4,76,219],{"title":5,"path":6,"stem":7,"children":8,"icon":10},"Docs","/guide","1.guide/0.index",[9,11,16,21,26,31,36,41,46,51,56,61,66,71],{"title":5,"path":6,"stem":7,"icon":10},"ph:book-open-duotone",{"title":12,"path":13,"stem":14,"icon":15},"Server Utils","/guide/utils","1.guide/1.utils","ri:tools-line",{"title":17,"path":18,"stem":19,"icon":20},"Tasks","/guide/tasks","1.guide/10.tasks","codicon:run-all",{"title":22,"path":23,"stem":24,"icon":25},"Server Routes","/guide/routing","1.guide/2.routing","ri:direction-line",{"title":27,"path":28,"stem":29,"icon":30},"WebSocket","/guide/websocket","1.guide/3.websocket","cib:socket-io",{"title":32,"path":33,"stem":34,"icon":35},"KV Storage","/guide/storage","1.guide/4.storage","carbon:datastore",{"title":37,"path":38,"stem":39,"icon":40},"SQL Database","/guide/database","1.guide/5.database","ri:database-2-line",{"title":42,"path":43,"stem":44,"icon":45},"Cache","/guide/cache","1.guide/6.cache","ri:speed-line",{"title":47,"path":48,"stem":49,"icon":50},"Fetch","/guide/fetch","1.guide/7.fetch","ri:global-line",{"title":52,"path":53,"stem":54,"icon":55},"Assets","/guide/assets","1.guide/8.assets","ri:image-2-line",{"title":57,"path":58,"stem":59,"icon":60},"Plugins","/guide/plugins","1.guide/9.plugins","ri:plug-line",{"title":62,"path":63,"stem":64,"icon":65},"Configuration","/guide/configuration","1.guide/97.configuration","ri:settings-3-line",{"title":67,"path":68,"stem":69,"icon":70},"TypeScript","/guide/typescript","1.guide/98.typescript","tabler:brand-typescript",{"title":72,"path":73,"stem":74,"icon":75},"Nightly Channel","/guide/nightly","1.guide/99.nightly","ri:moon-fill",{"title":77,"path":78,"stem":79,"children":80,"icon":82},"Deploy","/deploy","2.deploy/0.index",[81,83,87,113,118],{"title":77,"path":78,"stem":79,"icon":82},"ri:upload-cloud-2-line",{"title":84,"path":85,"stem":86,"icon":50},"Edge Workers","/deploy/workers","2.deploy/1.workers",{"title":88,"path":89,"stem":90,"children":91,"page":112},"Runtimes","/deploy/runtimes","2.deploy/10.runtimes",[92,97,102,107],{"title":93,"path":94,"stem":95,"icon":96},"Node.js","/deploy/runtimes/node","2.deploy/10.runtimes/1.node","akar-icons:node-fill",{"title":98,"path":99,"stem":100,"icon":101},"WinterJS","/deploy/runtimes/_winterjs","2.deploy/10.runtimes/_winterjs","game-icons:cold-heart",{"title":103,"path":104,"stem":105,"icon":106},"Bun","/deploy/runtimes/bun","2.deploy/10.runtimes/bun","simple-icons:bun",{"title":108,"path":109,"stem":110,"icon":111},"Deno","/deploy/runtimes/deno","2.deploy/10.runtimes/deno","simple-icons:deno",false,{"title":114,"path":115,"stem":116,"icon":117},"Custom Preset","/deploy/custom-presets","2.deploy/2.custom-presets","ri:file-code-line",{"title":119,"path":120,"stem":121,"children":122,"page":112},"Providers","/deploy/providers","2.deploy/20.providers",[123,127,131,135,139,143,147,151,155,159,163,167,171,175,179,183,187,191,195,199,203,207,211,215],{"title":124,"path":125,"stem":126},"Alwaysdata","/deploy/providers/alwaysdata","2.deploy/20.providers/alwaysdata",{"title":128,"path":129,"stem":130},"AWS Lambda","/deploy/providers/aws","2.deploy/20.providers/aws",{"title":132,"path":133,"stem":134},"AWS Amplify","/deploy/providers/aws-amplify","2.deploy/20.providers/aws-amplify",{"title":136,"path":137,"stem":138},"Azure","/deploy/providers/azure","2.deploy/20.providers/azure",{"title":140,"path":141,"stem":142},"Cleavr","/deploy/providers/cleavr","2.deploy/20.providers/cleavr",{"title":144,"path":145,"stem":146},"Cloudflare","/deploy/providers/cloudflare","2.deploy/20.providers/cloudflare",{"title":148,"path":149,"stem":150},"Deno Deploy","/deploy/providers/deno-deploy","2.deploy/20.providers/deno-deploy",{"title":152,"path":153,"stem":154},"DigitalOcean","/deploy/providers/digitalocean","2.deploy/20.providers/digitalocean",{"title":156,"path":157,"stem":158},"Edgio","/deploy/providers/edgio","2.deploy/20.providers/edgio",{"title":160,"path":161,"stem":162},"Firebase","/deploy/providers/firebase","2.deploy/20.providers/firebase",{"title":164,"path":165,"stem":166},"Flightcontrol","/deploy/providers/flightcontrol","2.deploy/20.providers/flightcontrol",{"title":168,"path":169,"stem":170},"Genezio","/deploy/providers/genezio","2.deploy/20.providers/genezio",{"title":172,"path":173,"stem":174},"GitHub Pages","/deploy/providers/github-pages","2.deploy/20.providers/github-pages",{"title":176,"path":177,"stem":178},"GitLab Pages","/deploy/providers/gitlab-pages","2.deploy/20.providers/gitlab-pages",{"title":180,"path":181,"stem":182},"Heroku","/deploy/providers/heroku","2.deploy/20.providers/heroku",{"title":184,"path":185,"stem":186},"IIS","/deploy/providers/iis","2.deploy/20.providers/iis",{"title":188,"path":189,"stem":190},"Koyeb","/deploy/providers/koyeb","2.deploy/20.providers/koyeb",{"title":192,"path":193,"stem":194},"Netlify","/deploy/providers/netlify","2.deploy/20.providers/netlify",{"title":196,"path":197,"stem":198},"Platform.sh","/deploy/providers/platform-sh","2.deploy/20.providers/platform-sh",{"title":200,"path":201,"stem":202},"Render.com","/deploy/providers/render","2.deploy/20.providers/render",{"title":204,"path":205,"stem":206},"StormKit","/deploy/providers/stormkit","2.deploy/20.providers/stormkit",{"title":208,"path":209,"stem":210},"Vercel","/deploy/providers/vercel","2.deploy/20.providers/vercel",{"title":212,"path":213,"stem":214},"Zeabur","/deploy/providers/zeabur","2.deploy/20.providers/zeabur",{"title":216,"path":217,"stem":218},"Zerops","/deploy/providers/zerops","2.deploy/20.providers/zerops",{"title":220,"path":221,"stem":222,"children":223,"icon":65},"Config","/config","3.config/0.index",[224],{"title":220,"path":221,"stem":222,"icon":65},{"id":226,"title":114,"body":227,"description":863,"extension":864,"meta":865,"navigation":866,"path":115,"seo":867,"stem":116,"__hash__":868},"content/2.deploy/2.custom-presets.md",{"type":228,"value":229,"toc":860,"icon":117},"minimark",[230,234,240,245,259,266,428,431,771,774,847,856],[231,232,233],"p",{},"Custom presets are local files that have a preset entry that defines builder configuration and a runtime entry point.",[235,236,237],"warning",{},[231,238,239],{},"Custom local preset support is an experimental feature.",[241,242,244],"h2",{"id":243},"example","Example",[246,247,248],"note",{},[231,249,250,251,258],{},"Check ",[252,253,257],"a",{"href":254,"rel":255},"https://github.com/nitrojs/nitro-preset-starter",[256],"nofollow","nitrojs/nitro-preset-starter"," for a ready-to-use template.",[231,260,261,262],{},"First, we have to define our preset entry point in a local directory ",[263,264,265],"code",{},"preset/nitro.config.ts",[267,268,274],"pre",{"className":269,"code":270,"filename":271,"language":272,"meta":273,"style":273},"language-ts shiki shiki-themes github-light github-dark github-dark","import type { NitroPreset } from \"nitropack\";\nimport { fileURLToPath } from \"node:url\"\n\nexport default \u003CNitroPreset>{\n  // extends: \"node-server\", // You can extend existing presets\n  entry: fileURLToPath(new URL(\"./entry.ts\", import.meta.url)),\n  hooks: {\n    compiled() {\n      // ...\n    },\n  },\n};\n","./preset/nitro.config.ts","ts","",[263,275,276,302,315,322,341,351,389,395,404,410,416,422],{"__ignoreMap":273},[277,278,281,285,288,292,295,299],"span",{"class":279,"line":280},"line",1,[277,282,284],{"class":283},"so5gQ","import",[277,286,287],{"class":283}," type",[277,289,291],{"class":290},"slsVL"," { NitroPreset } ",[277,293,294],{"class":283},"from",[277,296,298],{"class":297},"sfrk1"," \"nitropack\"",[277,300,301],{"class":290},";\n",[277,303,305,307,310,312],{"class":279,"line":304},2,[277,306,284],{"class":283},[277,308,309],{"class":290}," { fileURLToPath } ",[277,311,294],{"class":283},[277,313,314],{"class":297}," \"node:url\"\n",[277,316,318],{"class":279,"line":317},3,[277,319,321],{"emptyLinePlaceholder":320},true,"\n",[277,323,325,328,331,334,338],{"class":279,"line":324},4,[277,326,327],{"class":283},"export",[277,329,330],{"class":283}," default",[277,332,333],{"class":290}," \u003C",[277,335,337],{"class":336},"shcOC","NitroPreset",[277,339,340],{"class":290},">{\n",[277,342,344,348],{"class":279,"line":343},5,[277,345,347],{"class":346},"sCsY4","  // extends: \"node-server\",",[277,349,350],{"class":346}," // You can extend existing presets\n",[277,352,354,357,360,363,366,369,371,374,377,379,382,386],{"class":279,"line":353},6,[277,355,356],{"class":290},"  entry: ",[277,358,359],{"class":336},"fileURLToPath",[277,361,362],{"class":290},"(",[277,364,365],{"class":283},"new",[277,367,368],{"class":336}," URL",[277,370,362],{"class":290},[277,372,373],{"class":297},"\"./entry.ts\"",[277,375,376],{"class":290},", ",[277,378,284],{"class":283},[277,380,381],{"class":290},".",[277,383,385],{"class":384},"suiK_","meta",[277,387,388],{"class":290},".url)),\n",[277,390,392],{"class":279,"line":391},7,[277,393,394],{"class":290},"  hooks: {\n",[277,396,398,401],{"class":279,"line":397},8,[277,399,400],{"class":336},"    compiled",[277,402,403],{"class":290},"() {\n",[277,405,407],{"class":279,"line":406},9,[277,408,409],{"class":346},"      // ...\n",[277,411,413],{"class":279,"line":412},10,[277,414,415],{"class":290},"    },\n",[277,417,419],{"class":279,"line":418},11,[277,420,421],{"class":290},"  },\n",[277,423,425],{"class":279,"line":424},12,[277,426,427],{"class":290},"};\n",[231,429,430],{},"The entry point will be used by your server or provider, and you can fully customize its behavior.",[432,433,434,595],"code-group",{},[267,435,438],{"className":269,"code":436,"filename":437,"language":272,"meta":273,"style":273},"import \"#internal/nitro/virtual/polyfill\";\n\nconst nitroApp = useNitroApp();\n\nexport default {\n  fetch(request: Request) {\n    const url = new URL(request.url);\n    return nitroApp.localFetch(url.pathname + url.search, {\n      context: {},\n      host: url.hostname,\n      protocol: url.protocol,\n      method: request.method,\n      headers: request.headers,\n      body: undefined,\n    });\n  },\n};\n","preset/entry.ts (Workers)",[263,439,440,449,453,470,474,483,503,521,541,546,551,556,561,567,579,585,590],{"__ignoreMap":273},[277,441,442,444,447],{"class":279,"line":280},[277,443,284],{"class":283},[277,445,446],{"class":297}," \"#internal/nitro/virtual/polyfill\"",[277,448,301],{"class":290},[277,450,451],{"class":279,"line":304},[277,452,321],{"emptyLinePlaceholder":320},[277,454,455,458,461,464,467],{"class":279,"line":317},[277,456,457],{"class":283},"const",[277,459,460],{"class":384}," nitroApp",[277,462,463],{"class":283}," =",[277,465,466],{"class":336}," useNitroApp",[277,468,469],{"class":290},"();\n",[277,471,472],{"class":279,"line":324},[277,473,321],{"emptyLinePlaceholder":320},[277,475,476,478,480],{"class":279,"line":343},[277,477,327],{"class":283},[277,479,330],{"class":283},[277,481,482],{"class":290}," {\n",[277,484,485,488,490,494,497,500],{"class":279,"line":353},[277,486,487],{"class":336},"  fetch",[277,489,362],{"class":290},[277,491,493],{"class":492},"sQHwn","request",[277,495,496],{"class":283},":",[277,498,499],{"class":336}," Request",[277,501,502],{"class":290},") {\n",[277,504,505,508,511,513,516,518],{"class":279,"line":391},[277,506,507],{"class":283},"    const",[277,509,510],{"class":384}," url",[277,512,463],{"class":283},[277,514,515],{"class":283}," new",[277,517,368],{"class":336},[277,519,520],{"class":290},"(request.url);\n",[277,522,523,526,529,532,535,538],{"class":279,"line":397},[277,524,525],{"class":283},"    return",[277,527,528],{"class":290}," nitroApp.",[277,530,531],{"class":336},"localFetch",[277,533,534],{"class":290},"(url.pathname ",[277,536,537],{"class":283},"+",[277,539,540],{"class":290}," url.search, {\n",[277,542,543],{"class":279,"line":406},[277,544,545],{"class":290},"      context: {},\n",[277,547,548],{"class":279,"line":412},[277,549,550],{"class":290},"      host: url.hostname,\n",[277,552,553],{"class":279,"line":418},[277,554,555],{"class":290},"      protocol: url.protocol,\n",[277,557,558],{"class":279,"line":424},[277,559,560],{"class":290},"      method: request.method,\n",[277,562,564],{"class":279,"line":563},13,[277,565,566],{"class":290},"      headers: request.headers,\n",[277,568,570,573,576],{"class":279,"line":569},14,[277,571,572],{"class":290},"      body: ",[277,574,575],{"class":384},"undefined",[277,577,578],{"class":290},",\n",[277,580,582],{"class":279,"line":581},15,[277,583,584],{"class":290},"    });\n",[277,586,588],{"class":279,"line":587},16,[277,589,421],{"class":290},[277,591,593],{"class":279,"line":592},17,[277,594,427],{"class":290},[267,596,599],{"className":269,"code":597,"filename":598,"language":272,"meta":273,"style":273},"import \"#internal/nitro/virtual/polyfill\";\nimport { Server } from \"node:http\";\nimport { toNodeListener } from \"h3\";\n\nconst nitroApp = useNitroApp();\nconst server = new Server(toNodeListener(nitroApp.h3App));\n\n// @ts-ignore\nserver.listen(3000, (err) => {\n  if (err) {\n    console.error(err);\n    process.exit(1);\n  }\n  console.log(`Listening on http://localhost:3000 (custom preset)`);\n});\n","preset/entry.ts (Node.js)",[263,600,601,609,623,637,641,653,675,679,684,711,719,730,746,751,766],{"__ignoreMap":273},[277,602,603,605,607],{"class":279,"line":280},[277,604,284],{"class":283},[277,606,446],{"class":297},[277,608,301],{"class":290},[277,610,611,613,616,618,621],{"class":279,"line":304},[277,612,284],{"class":283},[277,614,615],{"class":290}," { Server } ",[277,617,294],{"class":283},[277,619,620],{"class":297}," \"node:http\"",[277,622,301],{"class":290},[277,624,625,627,630,632,635],{"class":279,"line":317},[277,626,284],{"class":283},[277,628,629],{"class":290}," { toNodeListener } ",[277,631,294],{"class":283},[277,633,634],{"class":297}," \"h3\"",[277,636,301],{"class":290},[277,638,639],{"class":279,"line":324},[277,640,321],{"emptyLinePlaceholder":320},[277,642,643,645,647,649,651],{"class":279,"line":343},[277,644,457],{"class":283},[277,646,460],{"class":384},[277,648,463],{"class":283},[277,650,466],{"class":336},[277,652,469],{"class":290},[277,654,655,657,660,662,664,667,669,672],{"class":279,"line":353},[277,656,457],{"class":283},[277,658,659],{"class":384}," server",[277,661,463],{"class":283},[277,663,515],{"class":283},[277,665,666],{"class":336}," Server",[277,668,362],{"class":290},[277,670,671],{"class":336},"toNodeListener",[277,673,674],{"class":290},"(nitroApp.h3App));\n",[277,676,677],{"class":279,"line":391},[277,678,321],{"emptyLinePlaceholder":320},[277,680,681],{"class":279,"line":397},[277,682,683],{"class":346},"// @ts-ignore\n",[277,685,686,689,692,694,697,700,703,706,709],{"class":279,"line":406},[277,687,688],{"class":290},"server.",[277,690,691],{"class":336},"listen",[277,693,362],{"class":290},[277,695,696],{"class":384},"3000",[277,698,699],{"class":290},", (",[277,701,702],{"class":492},"err",[277,704,705],{"class":290},") ",[277,707,708],{"class":283},"=>",[277,710,482],{"class":290},[277,712,713,716],{"class":279,"line":412},[277,714,715],{"class":283},"  if",[277,717,718],{"class":290}," (err) {\n",[277,720,721,724,727],{"class":279,"line":418},[277,722,723],{"class":290},"    console.",[277,725,726],{"class":336},"error",[277,728,729],{"class":290},"(err);\n",[277,731,732,735,738,740,743],{"class":279,"line":424},[277,733,734],{"class":290},"    process.",[277,736,737],{"class":336},"exit",[277,739,362],{"class":290},[277,741,742],{"class":384},"1",[277,744,745],{"class":290},");\n",[277,747,748],{"class":279,"line":563},[277,749,750],{"class":290},"  }\n",[277,752,753,756,759,761,764],{"class":279,"line":569},[277,754,755],{"class":290},"  console.",[277,757,758],{"class":336},"log",[277,760,362],{"class":290},[277,762,763],{"class":297},"`Listening on http://localhost:3000 (custom preset)`",[277,765,745],{"class":290},[277,767,768],{"class":279,"line":581},[277,769,770],{"class":290},"});\n",[231,772,773],{},"Then in your nitro config file, you can use your custom preset.",[432,775,776,808],{},[267,777,780],{"className":269,"code":778,"filename":779,"language":272,"meta":273,"style":273},"export default defineNitroConfig({\n  preset: \"./preset\",\n});\n","nitro.config.ts",[263,781,782,794,804],{"__ignoreMap":273},[277,783,784,786,788,791],{"class":279,"line":280},[277,785,327],{"class":283},[277,787,330],{"class":283},[277,789,790],{"class":336}," defineNitroConfig",[277,792,793],{"class":290},"({\n",[277,795,796,799,802],{"class":279,"line":304},[277,797,798],{"class":290},"  preset: ",[277,800,801],{"class":297},"\"./preset\"",[277,803,578],{"class":290},[277,805,806],{"class":279,"line":317},[277,807,770],{"class":290},[267,809,812],{"className":269,"code":810,"filename":811,"language":272,"meta":273,"style":273},"export default defineNuxtConfig({\n  nitro: {\n    preset: \"./preset\",\n  }\n});\n","nuxt.config.ts",[263,813,814,825,830,839,843],{"__ignoreMap":273},[277,815,816,818,820,823],{"class":279,"line":280},[277,817,327],{"class":283},[277,819,330],{"class":283},[277,821,822],{"class":336}," defineNuxtConfig",[277,824,793],{"class":290},[277,826,827],{"class":279,"line":304},[277,828,829],{"class":290},"  nitro: {\n",[277,831,832,835,837],{"class":279,"line":317},[277,833,834],{"class":290},"    preset: ",[277,836,801],{"class":297},[277,838,578],{"class":290},[277,840,841],{"class":279,"line":324},[277,842,750],{"class":290},[277,844,845],{"class":279,"line":343},[277,846,770],{"class":290},[231,848,849,850,855],{},"Refer to the Nitro ",[252,851,854],{"href":852,"rel":853},"https://github.com/nitrojs/nitro/tree/main/src",[256],"source code"," directly to have a better understanding of presets and entry points.",[857,858,859],"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 .suiK_, html code.shiki .suiK_{--shiki-light:#005CC5;--shiki-default:#79B8FF;--shiki-dark:#79B8FF}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 .sQHwn, html code.shiki .sQHwn{--shiki-light:#E36209;--shiki-default:#FFAB70;--shiki-dark:#FFAB70}",{"title":273,"searchDepth":304,"depth":304,"links":861},[862],{"id":243,"depth":304,"text":244},"If you want to use a provider that Nitro doesn't support, or want to modify an existing one, you can create a local custom preset in your project.","md",{"icon":117,"aside":112},{"icon":117},{"title":114,"description":863},"HmzleX23CO2NZt79X9JR8dnkfj93zM-leAyCN7Rnxcg",[870,872],{"title":108,"path":109,"stem":110,"description":871,"icon":111,"children":-1},"Run Nitro apps with Deno runtime.",{"title":124,"path":125,"stem":126,"description":873,"children":-1},"Deploy Nitro apps to alwaysdata.",1775118357282]