{"catalogRevision":"cat_f13ab9a494120b5e","recipeId":"page:guides:next-js:build-and-start","recipeRevision":"r1","canonicalPath":"/guides/next-js/build-and-start","label":"Configure build and start for Next.js","family":"Framework operation","summary":"Configure build and start for a Next.js app on Ample. A server-rendered app runs next build then next start on the node-22 template with the detected package manager; a static export is published as a static site. The app must bind 0.0.0.0 on PORT.","representativeQueries":["Configure build and start for Next.js","Where can I host Configure build and start built with Next.js?","I need pinned build/start commands, port binding and a tested process lifecycle."],"breadcrumbIds":["discovery","stack","stack:frameworks","stack:framework-next-js","page:guides:next-js:build-and-start"],"breadcrumbs":[{"id":"discovery","label":"Agent hosting discovery","canonicalPath":"/discover/discovery","kind":"root"},{"id":"stack","label":"Frameworks and execution targets","canonicalPath":"/discover/stack","kind":"facet"},{"id":"stack:frameworks","label":"Frameworks","canonicalPath":"/discover/stack/frameworks","kind":"group"},{"id":"stack:framework-next-js","label":"Next.js","canonicalPath":"/discover/stack/framework-next-js","kind":"atom"},{"id":"page:guides:next-js:build-and-start","label":"Configure build and start for Next.js","canonicalPath":"/guides/next-js/build-and-start","kind":"recipe"}],"parentIds":["stack:framework-next-js","intent:configure-deployment","pattern:public-web-service"],"parents":[{"id":"stack:framework-next-js","label":"Next.js","canonicalPath":"/discover/stack/framework-next-js","kind":"atom"},{"id":"intent:configure-deployment","label":"Configure deployment","canonicalPath":"/discover/intent/configure-deployment","kind":"atom"},{"id":"pattern:public-web-service","label":"Public web service","canonicalPath":"/discover/pattern/public-web-service","kind":"atom"}],"resourceRequirements":["primitive:compute"],"infrastructureRequirements":[{"primitiveId":"primitive:compute","label":"Compute","canonicalPath":"/discover/primitive/compute","status":"verified","summary":"Apps run in isolated x86_64 Firecracker microVMs that auto-pause when idle and wake on request; sizes are the priced VM sizes."}],"framework":"Next.js","workload":"Configure build and start","releaseStatus":"published","supportStatus":"verified","executionStatus":"ready","docsOnly":false,"prerequisites":["A package.json with build and start scripts (next build, next start -H 0.0.0.0 -p ${PORT:-3000})","Node 22 compatible dependencies","An Ample account token with servers:write"],"testedConfiguration":{"template":"node-22","runtime":"node","size":"s-1vcpu-1gb","install":"npm install","build":"npm run build --if-present","start":"npm run start"},"inputSchema":{"additionalProperties":false,"properties":{"name":{"description":"App name (lowercase, digits and dashes)","maxLength":63,"minLength":1,"pattern":"^[a-z0-9-]+$","type":"string"},"path":{"description":"Project directory to deploy, or one service name from ample.toml","maxLength":512,"minLength":1,"type":"string"},"size":{"description":"VM size; omit to let Ample pick a runtime-safe size","enum":["s-1vcpu-256mb","s-1vcpu-1gb","s-1vcpu-2gb","s-2vcpu-2gb","s-2vcpu-4gb"],"type":"string"}},"required":["name","path"],"type":"object"},"outputSchema":null,"workflowSteps":[{"title":"Make next start listen correctly","body":"Use next start -H 0.0.0.0 -p ${PORT:-3000} so the health check reaches the server."},{"title":"Deploy","body":"Run the existing synchronous deploy once from the project directory and read the result. Exit 0 is live, 1 is failed, 2 is blocked on a required preflight action. Re-running with no change is a content-addressed no-op.","command":"ample deploy . --name <app-name> --public --format json"},{"title":"Static exports","body":"With output: 'export' the build is published as a static site with correct 404 handling; no server process runs."},{"title":"Verify","body":"Fetch the live URL and run the success checks below. On failure read the build log, then the runtime log, fix the cause and deploy again; do not blind-retry.","command":"ample logs <deployment_id> --kind build"}],"examples":[{"title":"Next.js SSR canary","description":"next build and next start with a page and an API route.","sourceRef":"tests/deploy-canaries/next-basic-ssr"},{"title":"pnpm Next.js canary","description":"Package manager detection with pnpm.","sourceRef":"tests/deploy-canaries/pnpm-next-basic"},{"title":"Static export canary","description":"output: 'export' published as a static site.","sourceRef":"tests/deploy-canaries/next-static-export"}],"successChecks":[{"description":"page renders","kind":"http_get","path":"/","expect":"ample canary next basic ssr"},{"description":"API route stays a Next route","kind":"http_get","path":"/api/canary","expect":"next api stays next"}],"limitations":["Verified on the node-22 template at s-1vcpu-1gb; other templates and sizes are not verified by this recipe.","Region, compliance attestations and request-duration limits are unknown and not claimed.","Apps auto-pause when idle and wake on the next request; always-on is an operator setting, not a plan feature.","Next.js 15 was tested; other majors are not verified.","Image optimization, ISR and middleware behavior are not verified."],"costEstimate":{"currency":"USD","monthlyAmount":5.0,"authoritative":true,"basis":"size prices from pricing.toml (loaded by the API) at build revision c580c64e344ac6391cd4873bd47103b1c5701b48","components":[{"name":"app server","size":"s-1vcpu-1gb","quantity":1.0,"monthlyAmount":5.0}],"note":"Apps and managed databases auto-pause when idle; the estimate is the always-on monthly price of the tested sizes. Plan quotas and budgets apply."},"evidenceSummary":[{"kind":"canary_run","summary":"Next.js 15 SSR app (next build, next start) deployed on node-22; the page and an API route served correctly.","observedAt":"2026-09-19T23:55:33Z","implementationRevision":"1764076-tls-account-903d345","expiresAt":"2027-03-18T23:55:33Z","scope":{"cliVersion":"0.1.20","platform":"hosted","template":"node-22"}},{"kind":"canary_run","summary":"Next.js app using pnpm deployed with the detected package manager.","observedAt":"2026-09-19T23:55:33Z","implementationRevision":"1764076-tls-account-903d345","expiresAt":"2027-03-18T23:55:33Z","scope":{"cliVersion":"0.1.20","platform":"hosted","template":"node-22"}},{"kind":"canary_run","summary":"Next.js static export (Vercel-style output) was published and served, including a nested route and a correct 404.","observedAt":"2026-09-19T23:55:33Z","implementationRevision":"1764076-tls-account-903d345","expiresAt":"2027-03-18T23:55:33Z","scope":{"cliVersion":"0.1.20","platform":"hosted","template":"node-22"}}],"lastVerifiedAt":"2026-09-19T23:55:33Z","mcpBinding":{"registryRef":"mcp:ample_deploy","toolName":"ample_deploy","schemaHash":"876465fce906da0c224d62961d3343064108ebe30af80cf1b87094974e948853","observedAt":"2026-09-20T01:55:48.667900+00:00","implementationRevision":"199ff1dfd526","requiredScopes":["servers:write"],"bindingState":"current"},"unknowns":["region availability is unknown until a verified region fact is recorded","compliance attestations are unknown; none are claimed"],"formats":{"html":"https://ample.computer/guides/next-js/build-and-start","markdown":"https://ample.computer/guides/next-js/build-and-start.md","json":"https://api.ample.computer/v1/catalog/recipes/page%3Aguides%3Anext-js%3Abuild-and-start"},"nextActions":[{"actionId":"browse-catalog","label":"Browse the catalog index","operationId":"catalog_index","method":"GET","relativePath":"/v1/catalog","origin":"api","parameters":{},"requiresAuthentication":false,"requiresApproval":false},{"actionId":"search-recipes","label":"Search published recipes by intent, stack and constraints","operationId":"search_recipes","method":"POST","relativePath":"/v1/catalog/search","origin":"api","parameters":{"body":{"limit":5,"query":"Configure build and start for Next.js"}},"requiresAuthentication":false,"requiresApproval":false},{"actionId":"plan:page:guides:next-js:build-and-start","label":"Prepare a side-effect-free deployment plan for an authorized project","operationId":"plan_deployment","method":"POST","relativePath":"/v1/catalog/plan","origin":"api","parameters":{"body":{"inputs":{},"projectId":"<workspace or server id you own>","recipeId":"page:guides:next-js:build-and-start","recipeRevision":"r1"}},"requiresAuthentication":true,"requiresApproval":false},{"actionId":"auth-setup","label":"Read the existing agent authentication setup","operationId":"existing_auth_setup","method":"GET","relativePath":"/mcp/setup","origin":"api","parameters":{},"requiresAuthentication":false,"requiresApproval":false},{"actionId":"browse:stack:framework-next-js","label":"Browse Next.js","operationId":"browse_node","method":"GET","relativePath":"/v1/catalog/nodes/stack%3Aframework-next-js","origin":"api","parameters":{"nodeId":"stack:framework-next-js"},"requiresAuthentication":false,"requiresApproval":false},{"actionId":"browse:intent:configure-deployment","label":"Browse Configure deployment","operationId":"browse_node","method":"GET","relativePath":"/v1/catalog/nodes/intent%3Aconfigure-deployment","origin":"api","parameters":{"nodeId":"intent:configure-deployment"},"requiresAuthentication":false,"requiresApproval":false},{"actionId":"browse:pattern:public-web-service","label":"Browse Public web service","operationId":"browse_node","method":"GET","relativePath":"/v1/catalog/nodes/pattern%3Apublic-web-service","origin":"api","parameters":{"nodeId":"pattern:public-web-service"},"requiresAuthentication":false,"requiresApproval":false}]}