[{"data":1,"prerenderedAt":829},["ShallowReactive",2],{"navigation":3,"page-\u002Fguides\u002Fdeploy-a-nextjs-application":213,"surround-\u002Fguides\u002Fdeploy-a-nextjs-application":824},[4,17,48,79,95,118,133,144,155,167,186],{"title":5,"path":6,"stem":7,"children":8,"icon":16,"exact":11},"Getting started","\u002Fgetting-started","1.getting-started\u002F1.index",[9,12],{"title":10,"path":6,"stem":7,"exact":11,"children":-1},"Introduction",true,{"title":13,"path":14,"stem":15,"exact":11,"children":-1},"Quickstart","\u002Fgetting-started\u002Fquickstart","1.getting-started\u002F2.quickstart","i-lucide-rocket",{"title":18,"path":19,"stem":20,"children":21,"icon":47,"exact":11},"Reference","\u002Freference","10.reference\u002F1.index",[22,23,27,31,35,39,43],{"title":18,"path":19,"stem":20,"exact":11,"children":-1},{"title":24,"path":25,"stem":26,"exact":11,"children":-1},"Variables","\u002Freference\u002Fvariables","10.reference\u002F2.variables",{"title":28,"path":29,"stem":30,"exact":11,"children":-1},"Hostnames and DNS","\u002Freference\u002Fhostnames-and-dns","10.reference\u002F3.hostnames-and-dns",{"title":32,"path":33,"stem":34,"exact":11,"children":-1},"Statuses","\u002Freference\u002Fstatuses","10.reference\u002F4.statuses",{"title":36,"path":37,"stem":38,"exact":11,"children":-1},"Limits","\u002Freference\u002Flimits","10.reference\u002F5.limits",{"title":40,"path":41,"stem":42,"exact":11,"children":-1},"Sizes","\u002Freference\u002Fsizes","10.reference\u002F6.sizes",{"title":44,"path":45,"stem":46,"exact":11,"children":-1},"The GitHub App","\u002Freference\u002Fgithub-app","10.reference\u002F7.github-app","i-lucide-book-open",{"title":49,"path":50,"stem":51,"children":52,"icon":78,"exact":11},"Troubleshooting","\u002Ftroubleshooting","11.troubleshooting\u002F1.index",[53,54,58,62,66,70,74],{"title":49,"path":50,"stem":51,"exact":11,"children":-1},{"title":55,"path":56,"stem":57,"exact":11,"children":-1},"Build failures","\u002Ftroubleshooting\u002Fbuild-failures","11.troubleshooting\u002F2.build-failures",{"title":59,"path":60,"stem":61,"exact":11,"children":-1},"Start and health failures","\u002Ftroubleshooting\u002Fstart-and-health-failures","11.troubleshooting\u002F3.start-and-health-failures",{"title":63,"path":64,"stem":65,"exact":11,"children":-1},"Reference failures","\u002Ftroubleshooting\u002Freference-failures","11.troubleshooting\u002F4.reference-failures",{"title":67,"path":68,"stem":69,"exact":11,"children":-1},"Failures that are Kuppit's","\u002Ftroubleshooting\u002Ffailures-that-are-kuppits","11.troubleshooting\u002F5.failures-that-are-kuppits",{"title":71,"path":72,"stem":73,"exact":11,"children":-1},"Domain issues","\u002Ftroubleshooting\u002Fdomain-issues","11.troubleshooting\u002F6.domain-issues",{"title":75,"path":76,"stem":77,"exact":11,"children":-1},"No preview for a pull request","\u002Ftroubleshooting\u002Fno-preview-for-a-pull-request","11.troubleshooting\u002F7.no-preview-for-a-pull-request","i-lucide-life-buoy",{"title":80,"path":81,"stem":82,"children":83,"icon":94,"exact":11},"Concepts","\u002Fconcepts","2.concepts\u002F1.index",[84,86,90],{"title":85,"path":81,"stem":82,"exact":11,"children":-1},"The Kuppit model",{"title":87,"path":88,"stem":89,"exact":11,"children":-1},"The application graph","\u002Fconcepts\u002Fthe-application-graph","2.concepts\u002F2.the-application-graph",{"title":91,"path":92,"stem":93,"exact":11,"children":-1},"How a service runs","\u002Fconcepts\u002Fhow-a-service-runs","2.concepts\u002F3.how-a-service-runs","i-lucide-shapes",{"title":96,"path":97,"stem":98,"children":99,"icon":117,"exact":11},"Deployments","\u002Fdeployments","3.deployments\u002F1.index",[100,101,105,109,113],{"title":96,"path":97,"stem":98,"exact":11,"children":-1},{"title":102,"path":103,"stem":104,"exact":11,"children":-1},"Builds","\u002Fdeployments\u002Fbuilds","3.deployments\u002F2.builds",{"title":106,"path":107,"stem":108,"exact":11,"children":-1},"Redeploy and roll back","\u002Fdeployments\u002Fredeploy-and-rollback","3.deployments\u002F3.redeploy-and-rollback",{"title":110,"path":111,"stem":112,"exact":11,"children":-1},"Logs","\u002Fdeployments\u002Flogs","3.deployments\u002F4.logs",{"title":114,"path":115,"stem":116,"exact":11,"children":-1},"When a deployment fails","\u002Fdeployments\u002Fwhen-a-deployment-fails","3.deployments\u002F5.when-a-deployment-fails","i-lucide-cloud-upload",{"title":119,"path":120,"stem":121,"children":122,"icon":132,"exact":11},"Resources","\u002Fresources","4.resources\u002F1.index",[123,124,128],{"title":119,"path":120,"stem":121,"exact":11,"children":-1},{"title":125,"path":126,"stem":127,"exact":11,"children":-1},"Web services","\u002Fresources\u002Fweb-services","4.resources\u002F2.web-services",{"title":129,"path":130,"stem":131,"exact":11,"children":-1},"PostgreSQL","\u002Fresources\u002Fpostgresql","4.resources\u002F3.postgresql","i-lucide-boxes",{"title":134,"icon":135,"path":136,"stem":137,"children":138,"page":143,"exact":11},"Configuration","i-lucide-sliders-horizontal","\u002Fconfiguration","5.configuration",[139],{"title":140,"path":141,"stem":142,"exact":11,"children":-1},"Environment variables","\u002Fconfiguration\u002Fvariables","5.configuration\u002F1.variables",false,{"title":145,"path":146,"stem":147,"children":148,"icon":154,"exact":11},"Networking","\u002Fnetworking","6.networking\u002F1.index",[149,150],{"title":145,"path":146,"stem":147,"exact":11,"children":-1},{"title":151,"path":152,"stem":153,"exact":11,"children":-1},"Reaching a database","\u002Fnetworking\u002Freaching-a-database","6.networking\u002F2.reaching-a-database","i-lucide-network",{"title":156,"path":157,"stem":158,"children":159,"icon":166,"exact":11},"Domains","\u002Fdomains","7.domains\u002F1.index",[160,162],{"title":161,"path":157,"stem":158,"exact":11,"children":-1},"Hostnames",{"title":163,"path":164,"stem":165,"exact":11,"children":-1},"Custom domains","\u002Fdomains\u002Fcustom-domains","7.domains\u002F2.custom-domains","i-lucide-globe",{"title":168,"path":169,"stem":170,"children":171,"icon":185,"exact":11},"Environments","\u002Fenvironments","8.environments\u002F1.index",[172,173,177,181],{"title":168,"path":169,"stem":170,"exact":11,"children":-1},{"title":174,"path":175,"stem":176,"exact":11,"children":-1},"Preview environments","\u002Fenvironments\u002Fpreview-environments","8.environments\u002F2.preview-environments",{"title":178,"path":179,"stem":180,"exact":11,"children":-1},"Named environments","\u002Fenvironments\u002Fnamed-environments","8.environments\u002F3.named-environments",{"title":182,"path":183,"stem":184,"exact":11,"children":-1},"Deleting an environment","\u002Fenvironments\u002Fdeleting-an-environment","8.environments\u002F4.deleting-an-environment","i-lucide-git-branch",{"title":187,"path":188,"stem":189,"children":190,"icon":212,"exact":11},"Guides","\u002Fguides","9.guides\u002F1.index",[191,192,196,200,204,208],{"title":187,"path":188,"stem":189,"exact":11,"children":-1},{"title":193,"path":194,"stem":195,"exact":11,"children":-1},"Deploy a Nuxt application","\u002Fguides\u002Fdeploy-a-nuxt-application","9.guides\u002F2.deploy-a-nuxt-application",{"title":197,"path":198,"stem":199,"exact":11,"children":-1},"Deploy a Next.js application","\u002Fguides\u002Fdeploy-a-nextjs-application","9.guides\u002F3.deploy-a-nextjs-application",{"title":201,"path":202,"stem":203,"exact":11,"children":-1},"Deploy an Express application","\u002Fguides\u002Fdeploy-an-express-application","9.guides\u002F4.deploy-an-express-application",{"title":205,"path":206,"stem":207,"exact":11,"children":-1},"Deploy with a Dockerfile","\u002Fguides\u002Fdeploy-with-a-dockerfile","9.guides\u002F5.deploy-with-a-dockerfile",{"title":209,"path":210,"stem":211,"exact":11,"children":-1},"Create a staging environment","\u002Fguides\u002Fcreate-a-staging-environment","9.guides\u002F6.create-a-staging-environment","i-lucide-map",{"id":214,"title":197,"badge":215,"body":216,"category":215,"description":818,"draft":143,"extension":819,"links":215,"meta":820,"navigation":11,"path":198,"seo":821,"sitemap":822,"stem":199,"__hash__":823},"docs\u002F9.guides\u002F3.deploy-a-nextjs-application.md",null,{"type":217,"value":218,"toc":810},"minimark",[219,240,245,401,405,434,445,449,463,467,484,487,520,530,534,566,788,792,806],[220,221,222,223,227,228,231,232,235,236,239],"p",{},"Kuppit detects a Next.js application from the ",[224,225,226],"code",{},"next"," dependency, builds it with your ",[224,229,230],{},"build"," script, and starts it with ",[224,233,234],{},"next start",". The one thing to know before the first deployment is how Next.js treats ",[224,237,238],{},"NEXT_PUBLIC_"," values, because it changes where they come from on Kuppit.",[241,242,244],"h2",{"id":243},"what-kuppit-detects","What Kuppit detects",[246,247,248,264],"table",{},[249,250,251],"thead",{},[252,253,254,258,261],"tr",{},[255,256,257],"th",{},"Setting",[255,259,260],{},"Value",[255,262,263],{},"From",[265,266,267,289,313,330,360,385],"tbody",{},[252,268,269,276,279],{},[270,271,272],"td",{},[273,274,275],"strong",{},"Framework",[270,277,278],{},"Next.js",[270,280,281,282,284,285,288],{},"The ",[224,283,226],{}," dependency, and ",[224,286,287],{},"next.config.ts"," if present.",[252,290,291,296,307],{},[270,292,293],{},[273,294,295],{},"Node version",[270,297,298,299,302,303,306],{},"24, or what ",[224,300,301],{},"engines.node"," in ",[224,304,305],{},"package.json"," admits",[270,308,309,310,312],{},"Only ",[224,311,301],{}," is read. 24 and 22 are supported.",[252,314,315,320,323],{},[270,316,317],{},[273,318,319],{},"Package manager",[270,321,322],{},"pnpm, npm or Yarn",[270,324,325,326,329],{},"The lockfile, or the ",[224,327,328],{},"packageManager"," field.",[252,331,332,337,350],{},[270,333,334],{},[273,335,336],{},"Build command",[270,338,339,342,343,346,347],{},[224,340,341],{},"pnpm build",", ",[224,344,345],{},"npm run build"," or ",[224,348,349],{},"yarn build",[270,351,352,353,355,356,359],{},"Your ",[224,354,230],{}," script, which should run ",[224,357,358],{},"next build",".",[252,361,362,367,377],{},[270,363,364],{},[273,365,366],{},"Start command",[270,368,352,369,372,373,376],{},[224,370,371],{},"start"," script, or ",[224,374,375],{},"node_modules\u002F.bin\u002Fnext start"," when there is none",[270,378,379,381,382,359],{},[224,380,234],{}," reads ",[224,383,384],{},"PORT",[252,386,387,392,395],{},[270,388,389],{},[273,390,391],{},"Port",[270,393,394],{},"3000",[270,396,397,398,400],{},"A default; ",[224,399,384],{}," overrides it at runtime.",[241,402,404],{"id":403},"before-you-deploy","Before you deploy",[220,406,407,409,410,412,413,420,421,423,424,426,427,429,430,433],{},[224,408,234],{}," listens on ",[224,411,384],{}," and on all interfaces, so the ",[414,415,417,419],"a",{"href":416},"\u002Fresources\u002Fweb-services#the-port-contract",[224,418,384],{}," contract"," is met as long as your ",[224,422,371],{}," script is ",[224,425,234],{}," or absent. A custom server must read ",[224,428,384],{}," and bind to ",[224,431,432],{},"0.0.0.0"," itself.",[220,435,436,437,440,441,444],{},"Do not set ",[224,438,439],{},"output: 'export'",": a static export has no server to start. ",[224,442,443],{},"output: 'standalone'"," is unnecessary; Kuppit runs the ordinary build.",[241,446,448],{"id":447},"deploy","Deploy",[220,450,451,452,454,455,458,459,462],{},"Follow the ",[414,453,13],{"href":14},": install the GitHub App, choose the repository and branch, confirm the proposal, and choose ",[273,456,457],{},"Deploy analyzed commit",". The deployment reaches ",[273,460,461],{},"Live"," and the service's hostname opens your application.",[241,464,466],{"id":465},"values-the-browser-needs","Values the browser needs",[220,468,469,470,472,473,476,477,480,481,483],{},"Next.js inlines ",[224,471,238],{}," variables into the client bundle ",[273,474,475],{},"at build time",". Kuppit's variables reach the running server, not the build, so a ",[224,478,479],{},"NEXT_PUBLIC_API_URL"," set on the service's ",[273,482,24],{}," tab is present in server code and absent from the bundle.",[220,485,486],{},"Two ways to handle it:",[488,489,490,504],"ul",{},[491,492,493,496,497,381,500,503],"li",{},[273,494,495],{},"Read it on the server and pass it down."," A Server Component, a route handler or ",[224,498,499],{},"getServerSideProps",[224,501,502],{},"process.env.API_URL"," at request time, and the client receives it as a prop. This is the usual answer, and it means the value changes with a redeploy rather than a rebuild.",[491,505,506,509,510,512,513,516,517,359],{},[273,507,508],{},"Commit it."," A value that is the same for every environment and not secret can live in ",[224,511,287],{}," under ",[224,514,515],{},"env",", or in a committed ",[224,518,519],{},".env.production",[220,521,522,523,526,527,529],{},"Server-side values, ",[224,524,525],{},"process.env.DATABASE_URL"," in a route handler, work as they do anywhere: set them on the ",[273,528,24],{}," tab, redeploy, and they are there.",[241,531,533],{"id":532},"add-a-database","Add a database",[220,535,536,537,342,540,342,543,545,546,549,550,552,553,556,557,559,560,562,563,565],{},"On the environment's ",[273,538,539],{},"Overview",[273,541,542],{},"Add resource",[273,544,129],{},". Keep the name ",[224,547,548],{},"database",". On the service's ",[273,551,24],{}," tab, add ",[224,554,555],{},"DATABASE_URL"," as a ",[273,558,18],{}," to ",[224,561,548],{}," → ",[224,564,555],{},", then redeploy. In a route handler:",[567,568,574],"pre",{"className":569,"code":570,"filename":571,"language":572,"meta":573,"style":573},"language-ts shiki shiki-themes material-theme-lighter github-light github-dark","import { Client } from 'pg'\n\nexport async function GET() {\n    const db = new Client({ connectionString: process.env.DATABASE_URL })\n    await db.connect()\n    const { rows } = await db.query('select now()')\n    await db.end()\n    return Response.json(rows[0])\n}\n","app\u002Fapi\u002Fhealth\u002Froute.ts","ts","",[224,575,576,610,616,639,687,703,739,753,782],{"__ignoreMap":573},[577,578,581,585,589,593,596,599,603,607],"span",{"class":579,"line":580},"line",1,[577,582,584],{"class":583},"sVHd0","import",[577,586,588],{"class":587},"sP7_E"," {",[577,590,592],{"class":591},"su5hD"," Client",[577,594,595],{"class":587}," }",[577,597,598],{"class":583}," from",[577,600,602],{"class":601},"sjJ54"," '",[577,604,606],{"class":605},"s_sjI","pg",[577,608,609],{"class":601},"'\n",[577,611,613],{"class":579,"line":612},2,[577,614,615],{"emptyLinePlaceholder":11},"\n",[577,617,619,622,626,629,633,636],{"class":579,"line":618},3,[577,620,621],{"class":583},"export",[577,623,625],{"class":624},"sbsja"," async",[577,627,628],{"class":624}," function",[577,630,632],{"class":631},"sGLFI"," GET",[577,634,635],{"class":587},"()",[577,637,638],{"class":587}," {\n",[577,640,642,645,649,653,656,658,662,665,668,671,674,676,678,680,682,684],{"class":579,"line":641},4,[577,643,644],{"class":624},"    const",[577,646,648],{"class":647},"s_hVV"," db",[577,650,652],{"class":651},"smGrS"," =",[577,654,655],{"class":651}," new",[577,657,592],{"class":631},[577,659,661],{"class":660},"skxfh","(",[577,663,664],{"class":587},"{",[577,666,667],{"class":660}," connectionString",[577,669,670],{"class":587},":",[577,672,673],{"class":591}," process",[577,675,359],{"class":587},[577,677,515],{"class":591},[577,679,359],{"class":587},[577,681,555],{"class":647},[577,683,595],{"class":587},[577,685,686],{"class":660},")\n",[577,688,690,693,695,697,700],{"class":579,"line":689},5,[577,691,692],{"class":583},"    await",[577,694,648],{"class":591},[577,696,359],{"class":587},[577,698,699],{"class":631},"connect",[577,701,702],{"class":660},"()\n",[577,704,706,708,710,713,715,717,720,722,724,727,729,732,735,737],{"class":579,"line":705},6,[577,707,644],{"class":624},[577,709,588],{"class":587},[577,711,712],{"class":647}," rows",[577,714,595],{"class":587},[577,716,652],{"class":651},[577,718,719],{"class":583}," await",[577,721,648],{"class":591},[577,723,359],{"class":587},[577,725,726],{"class":631},"query",[577,728,661],{"class":660},[577,730,731],{"class":601},"'",[577,733,734],{"class":605},"select now()",[577,736,731],{"class":601},[577,738,686],{"class":660},[577,740,742,744,746,748,751],{"class":579,"line":741},7,[577,743,692],{"class":583},[577,745,648],{"class":591},[577,747,359],{"class":587},[577,749,750],{"class":631},"end",[577,752,702],{"class":660},[577,754,756,759,762,764,767,769,772,775,779],{"class":579,"line":755},8,[577,757,758],{"class":583},"    return",[577,760,761],{"class":591}," Response",[577,763,359],{"class":587},[577,765,766],{"class":631},"json",[577,768,661],{"class":660},[577,770,771],{"class":591},"rows",[577,773,774],{"class":660},"[",[577,776,778],{"class":777},"srdBf","0",[577,780,781],{"class":660},"])\n",[577,783,785],{"class":579,"line":784},9,[577,786,787],{"class":587},"}\n",[241,789,791],{"id":790},"from-here","From here",[220,793,794,795,798,799,802,803,805],{},"Every push to the branch deploys again, and every pull request gets a ",[414,796,797],{"href":175},"preview environment",". A build that fails is almost always in the ",[273,800,801],{},"Build"," log; ",[414,804,55],{"href":56}," walks through the messages.",[807,808,809],"style",{},"html pre.shiki code .sVHd0, html code.shiki .sVHd0{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#D73A49;--shiki-default-font-style:inherit;--shiki-dark:#F97583;--shiki-dark-font-style:inherit}html pre.shiki code .sP7_E, html code.shiki .sP7_E{--shiki-light:#39ADB5;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .su5hD, html code.shiki .su5hD{--shiki-light:#90A4AE;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sjJ54, html code.shiki .sjJ54{--shiki-light:#39ADB5;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .s_sjI, html code.shiki .s_sjI{--shiki-light:#91B859;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sbsja, html code.shiki .sbsja{--shiki-light:#9C3EDA;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sGLFI, html code.shiki .sGLFI{--shiki-light:#6182B8;--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .s_hVV, html code.shiki .s_hVV{--shiki-light:#90A4AE;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .smGrS, html code.shiki .smGrS{--shiki-light:#39ADB5;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .skxfh, html code.shiki .skxfh{--shiki-light:#E53935;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .srdBf, html code.shiki .srdBf{--shiki-light:#F76D47;--shiki-default:#005CC5;--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);}",{"title":573,"searchDepth":618,"depth":618,"links":811},[812,813,814,815,816,817],{"id":243,"depth":612,"text":244},{"id":403,"depth":612,"text":404},{"id":447,"depth":612,"text":448},{"id":465,"depth":612,"text":466},{"id":532,"depth":612,"text":533},{"id":790,"depth":612,"text":791},"From a Next.js repository to a live URL, and where public and server values live when the build cannot see your variables.","md",{},{"title":197,"description":818},{"loc":198},"09R60VI1j1y-htyT7rsleYXph6FQsw4rx4Xu_EfhXjY",[825,827],{"title":193,"path":194,"stem":195,"description":826,"children":-1},"From a Nuxt repository to a live URL, with runtime config from variables and a database behind it.",{"title":201,"path":202,"stem":203,"description":828,"children":-1},"From an Express repository to a live URL. The one requirement is that your server listens where Kuppit routes.",1788549619876]