{"catalogRevision":"cat_f13ab9a494120b5e","recipeId":"page:guides:next-js:schema-changes","recipeRevision":"r1","canonicalPath":"/guides/next-js/schema-changes","label":"Apply database schema changes for Next.js","family":"Framework operation","summary":"Schema changes for a Next.js app on Ample. Verified on Next.js: a --release-command migration ran before activation and its marker was readable by the live app (migrated=release-ok). Build and start: next build then next start -H 0.0.0.0 -p $PORT on the node-22 template.","representativeQueries":["Apply database schema changes for Next.js","Where can I host Apply database schema changes built with Next.js?","I need a framework-specific schema migration and rollback procedure; no managed migration service is assumed."],"breadcrumbIds":["discovery","stack","stack:frameworks","stack:framework-next-js","page:guides:next-js:schema-changes"],"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:schema-changes","label":"Apply database schema changes for Next.js","canonicalPath":"/guides/next-js/schema-changes","kind":"recipe"}],"parentIds":["stack:framework-next-js","intent:configure-deployment","pattern:transactional-workflows"],"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:transactional-workflows","label":"Transactional workflows","canonicalPath":"/discover/pattern/transactional-workflows","kind":"atom"}],"resourceRequirements":["primitive:compute","primitive:postgres"],"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."},{"primitiveId":"primitive:postgres","label":"Postgres","canonicalPath":"/discover/primitive/postgres","status":"verified","summary":"Managed PostgreSQL 16 runs in its own microVM and is auto-provisioned when an app needs a database and no DATABASE_URL is supplied."}],"framework":"Next.js","workload":"Apply database schema changes","releaseStatus":"published","supportStatus":"verified","executionStatus":"ready","docsOnly":false,"prerequisites":["A Next.js project (next build then next start -H 0.0.0.0 -p $PORT on the node-22 template)","A PostgreSQL driver reading DATABASE_URL at runtime","An Ample account token with servers:write, databases:read"],"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":{"env":{"description":"Encrypted environment variables","items":{"pattern":"^[A-Z][A-Z0-9_]*=.*$","type":"string"},"maxItems":50,"type":"array"},"name":{"description":"App name","maxLength":63,"minLength":1,"pattern":"^[a-z0-9-]+$","type":"string"},"path":{"description":"Project directory or ample.toml service","maxLength":512,"minLength":1,"type":"string"},"release_command":{"description":"Migration command run before activation","maxLength":512,"type":"string"}},"required":["name","path","release_command"],"type":"object"},"outputSchema":null,"workflowSteps":[{"title":"Build and start","body":"next build then next start -H 0.0.0.0 -p $PORT on the node-22 template; the server must bind 0.0.0.0 on PORT."},{"title":"Run migrations as the release command","body":"Ample runs the command before activation and fails the release if it exits non-zero; keep migrations idempotent.","command":"ample deploy . --name <app-name> --public --release-command \"node migrate.cjs\""},{"title":"Verify","body":"Fetch the live URL and /p/migrated on the example; on failure read the build and runtime logs.","command":"ample logs <deployment_id> --kind build"}],"examples":[{"title":"Next.js pattern fixture","description":"Verified schema changes on Next.js.","sourceRef":"tests/deploy-canaries/next-js-patterns"}],"successChecks":[{"description":"app responds on its public URL","kind":"http_get","path":"/","expect":"ample canary next js patterns"},{"description":"migrated check from the example","kind":"http_get","path":"/p/migrated","expect":"see the pattern fixture checks"}],"limitations":["Verified on the node-22 template at s-1vcpu-1gb; other sizes and Next.js major versions are not verified.","Region, compliance attestations and request-duration limits are unknown and not claimed.","Managed PostgreSQL 16 only; extensions, connection limits and backup or restore procedures are not verified."],"costEstimate":{"currency":"USD","monthlyAmount":10.0,"authoritative":true,"basis":"size prices from pricing.toml (loaded by the API) at build revision 7cf090725a6f16dd91af7d28356fe72c1b404d6e","components":[{"name":"app server","size":"s-1vcpu-1gb","quantity":1.0,"monthlyAmount":5.0},{"name":"managed PostgreSQL database","size":"s-1vcpu-1gb","quantity":1.0,"monthlyAmount":5.0}],"note":"Always-on monthly price of the tested sizes; apps auto-pause when idle. Buckets are allocation-priced per quota and not included."},"evidenceSummary":[{"kind":"canary_run","summary":"Next.js pattern fixture deployed on Ample (next build then next start -H 0.0.0.0 -p $PORT on the node-22 template); for this guide: a --release-command migration ran before activation and its marker was readable by the live app (migrated=release-ok).","observedAt":"2026-09-21T02:34:39Z","implementationRevision":"1d28ae0 (CLI 0.1.21)","expiresAt":"2027-03-20T02:34:39Z","scope":{"checks":["/p/migrated"],"template":"node-22"}}],"lastVerifiedAt":"2026-09-21T02:34:39Z","mcpBinding":{"registryRef":"mcp:ample_deploy","toolName":"ample_deploy","schemaHash":"876465fce906da0c224d62961d3343064108ebe30af80cf1b87094974e948853","observedAt":"2026-09-22T00:31:22.774679+00:00","implementationRevision":"e6446ceea69b","requiredScopes":["servers:write","databases:read"],"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/schema-changes","markdown":"https://ample.computer/guides/next-js/schema-changes.md","json":"https://api.ample.computer/v1/catalog/recipes/page%3Aguides%3Anext-js%3Aschema-changes"},"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":"Apply database schema changes for Next.js"}},"requiresAuthentication":false,"requiresApproval":false},{"actionId":"plan:page:guides:next-js:schema-changes","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:schema-changes","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:transactional-workflows","label":"Browse Transactional workflows","operationId":"browse_node","method":"GET","relativePath":"/v1/catalog/nodes/pattern%3Atransactional-workflows","origin":"api","parameters":{"nodeId":"pattern:transactional-workflows"},"requiresAuthentication":false,"requiresApproval":false}]}