# Deliver public assets through CDN for Fastify

## Summary
Cdn assets for a Fastify app on Ample. Verified on Fastify: a versioned, immutable-cached asset uploaded to a published bucket and served from the CDN URL. Build and start: `npm install`, `npm run build --if-present`, `npm run start` on the node-22 template.

## Prerequisites
- A Fastify project (`npm install`, `npm run build --if-present`, `npm run start` on the node-22 template)
- A bucket from `ample bucket create` with credentials passed as encrypted S3_* environment variables
- An Ample account token with `servers:write`, `buckets:read`

## Workload
Deliver public assets through CDN

## Framework
Fastify

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

## Example
### Fastify pattern fixture
**Description**: Verified CDN assets on Fastify.  
**Source Reference**: tests/deploy-canaries/fastify-patterns

## Success Checks
1. **Description**: App responds on its public URL
   - **Kind**: `http_get`
   - **Path**: `/`
   - **Expect**: `ample canary fastify patterns`
2. **Description**: Versioned-static-assets check from the example
   - **Kind**: `http_get`
   - **Path**: `/p/versioned-static-assets`
   - **Expect**: See the pattern fixture checks.

## Limitations
- Verified on the node-22 template at s-1vcpu-1gb; other sizes and Fastify major versions are not verified.
- Region, compliance attestations and request-duration limits are unknown and not claimed.
- The CDN serves published-bucket objects only; cache rules, purge and TTL control are not verified.

## 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.

## Evidence Summary
- **Kind**: Canary run  
- **Summary**: Fastify pattern fixture deployed on Ample (npm install, npm run build --if-present, npm run start on the node-22 template); for this guide: a versioned, immutable-cached asset uploaded to a published bucket and served from the CDN URL.  
- **Observed At**: 2026-09-21T01:14:18Z  
- **Implementation Revision**: 50dbac567d2c5cc8e55e6c748a646be0025d9cfb-dirty (CLI 0.1.21)  
- **Expires At**: 2027-03-20T01:14:18Z

## Next Actions
1. **Action ID**: browse-catalog  
   **Label**: Browse the catalog index  
   **Operation ID**: catalog_index  
   **Method**: GET  
   **Relative Path**: /v1/catalog
2. **Action ID**: search-recipes  
   **Label**: Search published recipes by intent, stack and constraints  
   **Operation ID**: search_recipes  
   **Method**: POST  
   **Relative Path**: /v1/catalog/search  
   **Parameters**: {"body":{"limit":5,"query":"Deliver public assets through CDN for Fastify"}}
3. **Action ID**: plan:page:guides:fastify:cdn-assets  
   **Label**: Prepare a side-effect-free deployment plan for an authorized project  
   **Operation ID**: plan_deployment  
   **Method**: POST  
   **Relative Path**: /v1/catalog/plan  
   **Parameters**: {"body":{"inputs":{},"projectId":"","recipeId":"page:guides:fastify:cdn-assets","recipeRevision":"r1"}}
4. **Action ID**: auth-setup  
   **Label**: Read the existing agent authentication setup  
   **Operation ID**: existing_auth_setup  
   **Method**: GET  
   **Relative Path**: /mcp/setup
