[{"data":1,"prerenderedAt":674},["ShallowReactive",2],{"navigation":3,"-deploy-providers-heroku":225,"-deploy-providers-heroku-surround":669},[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":180,"body":227,"description":663,"extension":664,"meta":665,"navigation":666,"path":181,"seo":667,"stem":182,"__hash__":668},"content/2.deploy/20.providers/heroku.md",{"type":228,"value":229,"toc":659},"minimark",[230,242,247,252,387,391,655],[231,232,233,237,238],"p",{},[234,235,236],"strong",{},"Preset:"," ",[239,240,241],"code",{},"heroku",[243,244],"read-more",{"title":245,"to":246},"heroku.com","https://heroku.com/",[248,249,251],"h2",{"id":250},"using-the-heroku-cli","Using the heroku CLI",[253,254,256,284,302,320],"steps",{"level":255},"4",[257,258,259,260],"h4",{},"Create a new Heroku app.",[261,262,267],"pre",{"className":263,"code":264,"language":265,"meta":266,"style":266},"language-bash shiki shiki-themes github-light github-dark github-dark","heroku create myapp\n","bash","",[239,268,269],{"__ignoreMap":266},[270,271,274,277,281],"span",{"class":272,"line":273},"line",1,[270,275,241],{"class":276},"shcOC",[270,278,280],{"class":279},"sfrk1"," create",[270,282,283],{"class":279}," myapp\n",[257,285,286,287],{},"Configure Heroku to use the nodejs buildpack.",[261,288,290],{"className":263,"code":289,"language":265,"meta":266,"style":266},"heroku buildpacks:set heroku/nodejs\n",[239,291,292],{"__ignoreMap":266},[270,293,294,296,299],{"class":272,"line":273},[270,295,241],{"class":276},[270,297,298],{"class":279}," buildpacks:set",[270,300,301],{"class":279}," heroku/nodejs\n",[257,303,304,305],{},"Configure your app.",[261,306,308],{"className":263,"code":307,"language":265,"meta":266,"style":266},"heroku config:set NITRO_PRESET=heroku\n",[239,309,310],{"__ignoreMap":266},[270,311,312,314,317],{"class":272,"line":273},[270,313,241],{"class":276},[270,315,316],{"class":279}," config:set",[270,318,319],{"class":279}," NITRO_PRESET=heroku\n",[257,321,322,323,326,327,330,331,334,335],{},"Ensure you have ",[239,324,325],{},"start"," and ",[239,328,329],{},"build"," commands in your ",[239,332,333],{},"package.json"," file.",[261,336,340],{"className":337,"code":338,"language":339,"meta":266,"style":266},"language-json5 shiki shiki-themes github-light github-dark github-dark","\"scripts\": {\n  \"build\": \"nitro build\", // or `nuxt build` if using nuxt\n  \"start\": \"node .output/server/index.mjs\"\n}\n","json5",[239,341,342,351,370,381],{"__ignoreMap":266},[270,343,344,347],{"class":272,"line":273},[270,345,346],{"class":279},"\"scripts\"",[270,348,350],{"class":349},"slsVL",": {\n",[270,352,354,357,360,363,366],{"class":272,"line":353},2,[270,355,356],{"class":279},"  \"build\"",[270,358,359],{"class":349},": ",[270,361,362],{"class":279},"\"nitro build\"",[270,364,365],{"class":349},", ",[270,367,369],{"class":368},"sCsY4","// or `nuxt build` if using nuxt\n",[270,371,373,376,378],{"class":272,"line":372},3,[270,374,375],{"class":279},"  \"start\"",[270,377,359],{"class":349},[270,379,380],{"class":279},"\"node .output/server/index.mjs\"\n",[270,382,384],{"class":272,"line":383},4,[270,385,386],{"class":349},"}\n",[248,388,390],{"id":389},"with-nginx","With nginx",[253,392,393,403,439,450,537,646,652],{"level":255},[257,394,395,396],{},"Add the heroku Nginx buildpack ",[397,398,402],"a",{"href":399,"rel":400},"https://github.com/heroku/heroku-buildpack-nginx.git",[401],"nofollow","here",[257,404,405,406,409],{},"Change to the 'node' preset in your ",[239,407,408],{},"nuxt.config",[261,410,412],{"className":337,"code":411,"language":339,"meta":266,"style":266},"\"nitro\": {\n   \"preset\":\"node\",\n}\n",[239,413,414,421,435],{"__ignoreMap":266},[270,415,416,419],{"class":272,"line":273},[270,417,418],{"class":279},"\"nitro\"",[270,420,350],{"class":349},[270,422,423,426,429,432],{"class":272,"line":353},[270,424,425],{"class":279},"   \"preset\"",[270,427,428],{"class":349},":",[270,430,431],{"class":279},"\"node\"",[270,433,434],{"class":349},",\n",[270,436,437],{"class":272,"line":372},[270,438,386],{"class":349},[257,440,441,442,445,446,449],{},"From the ",[234,443,444],{},"Existing app"," section of buildpack doc, 2 key steps are required to get things running",[447,448],"br",{},"Step 1: Listen on a socket at 'tmp/nginx.socket'\nStep 2: Create a file '/tmp/app-initialized' when your app is ready to accept connections",[257,451,452,453],{},"Create custom app runner, eg: apprunner.mjs at the root of the project (or any other preferred location), in this file, create a server, using the listener generated by the node preset, then listen on the socket as detailed in the buildpack doc",[261,454,458],{"className":455,"code":456,"language":457,"meta":266,"style":266},"language-ts shiki shiki-themes github-light github-dark github-dark","import { createServer } from 'node:http'\nimport { listener } from './.output/server/index.mjs'\n\nconst server = createServer(listener)\n\nserver.listen('/tmp/nginx.socket') //following the buildpack doc\n","ts",[239,459,460,475,487,493,511,516],{"__ignoreMap":266},[270,461,462,466,469,472],{"class":272,"line":273},[270,463,465],{"class":464},"so5gQ","import",[270,467,468],{"class":349}," { createServer } ",[270,470,471],{"class":464},"from",[270,473,474],{"class":279}," 'node:http'\n",[270,476,477,479,482,484],{"class":272,"line":353},[270,478,465],{"class":464},[270,480,481],{"class":349}," { listener } ",[270,483,471],{"class":464},[270,485,486],{"class":279}," './.output/server/index.mjs'\n",[270,488,489],{"class":272,"line":372},[270,490,492],{"emptyLinePlaceholder":491},true,"\n",[270,494,495,498,502,505,508],{"class":272,"line":383},[270,496,497],{"class":464},"const",[270,499,501],{"class":500},"suiK_"," server",[270,503,504],{"class":464}," =",[270,506,507],{"class":276}," createServer",[270,509,510],{"class":349},"(listener)\n",[270,512,514],{"class":272,"line":513},5,[270,515,492],{"emptyLinePlaceholder":491},[270,517,519,522,525,528,531,534],{"class":272,"line":518},6,[270,520,521],{"class":349},"server.",[270,523,524],{"class":276},"listen",[270,526,527],{"class":349},"(",[270,529,530],{"class":279},"'/tmp/nginx.socket'",[270,532,533],{"class":349},") ",[270,535,536],{"class":368},"//following the buildpack doc\n",[257,538,539,540],{},"To create the 'tmp/app-initialized' file, use a nitro plugin, create file 'initServer.ts' at the root of the project (or any other preferred location)",[261,541,543],{"className":455,"code":542,"language":457,"meta":266,"style":266},"import fs from \"fs\"\n\nexport default defineNitroPlugin((nitroApp) => {\n   if((process.env.NODE_ENV || 'development') != 'development') {\n      fs.openSync('/tmp/app-initialized', 'w')\n   }\n})\n",[239,544,545,557,561,587,614,635,640],{"__ignoreMap":266},[270,546,547,549,552,554],{"class":272,"line":273},[270,548,465],{"class":464},[270,550,551],{"class":349}," fs ",[270,553,471],{"class":464},[270,555,556],{"class":279}," \"fs\"\n",[270,558,559],{"class":272,"line":353},[270,560,492],{"emptyLinePlaceholder":491},[270,562,563,566,569,572,575,579,581,584],{"class":272,"line":372},[270,564,565],{"class":464},"export",[270,567,568],{"class":464}," default",[270,570,571],{"class":276}," defineNitroPlugin",[270,573,574],{"class":349},"((",[270,576,578],{"class":577},"sQHwn","nitroApp",[270,580,533],{"class":349},[270,582,583],{"class":464},"=>",[270,585,586],{"class":349}," {\n",[270,588,589,592,595,598,601,604,606,609,611],{"class":272,"line":383},[270,590,591],{"class":464},"   if",[270,593,594],{"class":349},"((process.env.",[270,596,597],{"class":500},"NODE_ENV",[270,599,600],{"class":464}," ||",[270,602,603],{"class":279}," 'development'",[270,605,533],{"class":349},[270,607,608],{"class":464},"!=",[270,610,603],{"class":279},[270,612,613],{"class":349},") {\n",[270,615,616,619,622,624,627,629,632],{"class":272,"line":513},[270,617,618],{"class":349},"      fs.",[270,620,621],{"class":276},"openSync",[270,623,527],{"class":349},[270,625,626],{"class":279},"'/tmp/app-initialized'",[270,628,365],{"class":349},[270,630,631],{"class":279},"'w'",[270,633,634],{"class":349},")\n",[270,636,637],{"class":272,"line":518},[270,638,639],{"class":349},"   }\n",[270,641,643],{"class":272,"line":642},7,[270,644,645],{"class":349},"})\n",[257,647,648,649,651],{},"Finally, create file 'Procfile' at the root of the project, with the Procfile, we tell heroku to start nginx and use the custom apprunner.mjs to start the server",[447,650],{},"web: bin/start-nginx node apprunner.mjs",[257,653,654],{},"Bonus: create file 'config/nginx.conf.erb' to customize your nginx config. With the node preset, by default, static files handlers will not be generated, you can use nginx to server static files, just add the right location rule to the server block(s), or, force the node preset to generate handlers for the static files by setting serveStatic to true.",[656,657,658],"style",{},"html pre.shiki code .shcOC, html code.shiki .shcOC{--shiki-light:#6F42C1;--shiki-default:#B392F0;--shiki-dark:#B392F0}html pre.shiki code .sfrk1, html code.shiki .sfrk1{--shiki-light:#032F62;--shiki-default:#9ECBFF;--shiki-dark:#9ECBFF}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 .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 .suiK_, html code.shiki .suiK_{--shiki-light:#005CC5;--shiki-default:#79B8FF;--shiki-dark:#79B8FF}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}",{"title":266,"searchDepth":353,"depth":353,"links":660},[661,662],{"id":250,"depth":353,"text":251},{"id":389,"depth":353,"text":390},"Deploy Nitro apps to Heroku.","md",{},{},{"title":180,"description":663},"ZFa1jhJDd6X4EQLKIDq-XqDRDJcFnoPUcJueCYvNxQA",[670,672],{"title":176,"path":177,"stem":178,"description":671,"children":-1},"Deploy Nitro apps to GitLab Pages.",{"title":184,"path":185,"stem":186,"description":673,"children":-1},"Deploy Nitro apps to IIS.",1775119640176]