# Configure build and start for NestJS

## Summary
Build and start for a NestJS app on Ample. Verified on NestJS: the app built and started with the documented commands and answered on its public HTTPS URL. Build and start: `npm install`, `nest build` (TypeScript) then `node dist/main.js` on the node-22 template.

## Prerequisites
- A NestJS project (`npm install`, `nest build` (TypeScript) then `node dist/main.js` on the node-22 template)  
- An Ample account token with `servers:write`

## Workflow Steps
### 1. Build and start  
`npm install`, `nest build` (TypeScript) then `node dist/main.js` on the node-22 template; the server must bind `0.0.0.0` on `PORT`.

### 2. Deploy  
Run the synchronous deploy once and read the result.  
**Command:**  
`ample deploy . --name  --public`

### 3. Verify  
Fetch the live URL on the example; on failure read the build and runtime logs.  
**Command:**  
`ample logs --kind build`

## Tested Configuration
- **Template:** node-22  
- **Runtime:** node  
- **Size:** s-1vcpu-1gb  
- **Install:** `npm install`  
- **Build:** `npm run build --if-present`  
- **Start:** `npm run start`

## Examples
### NestJS pattern fixture
**Description:** Verified build and start on NestJS.  
**Source Ref:** tests/deploy-canaries/nestjs-patterns

## Success Checks
- App responds on its public URL  
  - **Kind:** http_get  
  - **Path:** `/`  
  - **Expect:** ample canary nestjs patterns

## Limitations
- Verified on the node-22 template at s-1vcpu-1gb; other sizes and NestJS major versions are not verified.  
- Region, compliance attestations, and request-duration limits are unknown and not claimed.

## Cost Estimate
- **Currency:** USD  
- **Monthly Amount:** 5.0  
- **Basis:** size prices from pricing.toml (loaded by the API) at build revision 1ac5595375130d45290090e82ed0f554ccd45405-dirty  
- **Components:**  
  - **Name:** app server  
  - **Size:** s-1vcpu-1gb  
  - **Quantity:** 1.0  
  - **Monthly Amount:** 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.

## Infrastructure Requirements
- **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.

## Evidence Summary
- **Kind:** canary_run  
  - **Summary:** NestJS pattern fixture deployed on Ample; for this guide: the app built and started with the documented commands and answered on its public HTTPS URL.  
  - **Observed At:** 2026-09-21T02:34:39Z  
  - **Implementation Revision:** 1d28ae0-dirty (CLI 0.1.21)  
  - **Expires At:** 2027-03-20T02:34:39Z

## Next Actions
- **Browse the catalog index:**  
  - **Action ID:** browse-catalog  
  - **Method:** GET  
  - **Relative Path:** /v1/catalog  
- **Search published recipes by intent, stack and constraints:**  
  - **Action ID:** search-recipes  
  - **Method:** POST  
  - **Relative Path:** /v1/catalog/search  
  - **Parameters:**  
    - **Body:**  
      - **Limit:** 5  
      - **Query:** "Configure build and start for NestJS"  
- **Prepare a side-effect-free deployment plan for an authorized project:**  
  - **Action ID:** plan:page:guides:nestjs:build-and-start  
  - **Method:** POST  
  - **Relative Path:** /v1/catalog/plan  
- **Read the existing agent authentication setup:**  
  - **Action ID:** auth-setup  
  - **Method:** GET  
  - **Relative Path:** /mcp/setup  
- **Browse NestJS:**  
  - **Action ID:** browse:stack:framework-nestjs  
  - **Method:** GET  
  - **Relative Path:** /v1/catalog/nodes/stack%3Aframework-nestjs  
- **Browse Configure deployment:**  
  - **Action ID:** browse:intent:configure-deployment  
  - **Method:** GET  
  - **Relative Path:** /v1/catalog/nodes/intent%3Aconfigure-deployment  
- **Browse Public web service:**  
  - **Action ID:** browse:pattern:public-web-service  
  - **Method:** GET  
  - **Relative Path:** /v1/catalog/nodes/pattern%3Apublic-web-service
