# Host order tracking with Nuxt: public product media

## Summary

Deploy an order tracking system built with Nuxt on Ample using the public media library pattern. This setup runs the app in an isolated microVM behind a public HTTPS URL. A managed PostgreSQL 16 database is auto-provisioned and injected as DATABASE_URL. A private S3-compatible bucket holds objects with credentials delivered as encrypted environment variables, while a published bucket serves public assets from the CDN host. Verified on Nuxt with an object written to a published bucket with an immutable Cache-Control header, a mapping row, and the CDN URL serving it publicly. The order tracking-specific behavior should be treated as application code.

## Infrastructure requirements

- **Compute:** verified (Apps run in isolated x86_64 Firecracker microVMs that auto-pause when idle and wake on request; sizes are the priced VM sizes.)  
- **Postgres:** verified (Managed PostgreSQL 16 runs in its own microVM and is auto-provisioned when an app needs a database and no DATABASE_URL is supplied.)  
- **S3-compatible object storage:** verified (Buckets are S3-compatible with issued credentials; basic object storage operations are verified.)  
- **CDN:** verified (The CDN host serves objects from published buckets.)

## Prerequisites

- A Nuxt project that builds and starts with the documented commands (nuxt build then node .output/server/index.mjs on the node-22 template).
- A PostgreSQL driver reading DATABASE_URL at runtime.
- An Ample account token with servers:write, databases:read, buckets:read.

## Exact tested configuration

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

## Steps

1. **Build and start.** run `nuxt build` then `node .output/server/index.mjs` (reads HOST and PORT on the node-22 template).
2. **Implement the pattern on PostgreSQL.** The fixture's module implements a public media library; copy the approach into your schema and ensure migrations are idempotent.
3. **Wire object storage.** Create the bucket(s), passing endpoint, region, bucket and keys as environment values. Keep private data in an unpublished bucket and publish only the bucket serving public assets.
4. **Deploy.** Run the synchronous deploy once and read the result.  
   ```  
   ample deploy . --name <app-name> --public --env S3_ENDPOINT=... --env S3_REGION=... --env S3_BUCKET=... --env S3_ACCESS_KEY_ID=... --env S3_SECRET_ACCESS_KEY=... --env CDN_PUBLIC_URL=...  
   ```  
5. **Verify.** Fetch the live URL and check the pattern self-test route(s) from the example; run your own checks. 
   ```  
   ample logs <deployment_id> --kind build  
   ```

## Tested examples

- **Nuxt pattern fixture:** Multi-pattern Nuxt app with the public media library module checked live; the module is under tests/deploy-canaries/_pattern-modules.

## Success checks

- App responds on its public URL; check public-media-library self-test.

## Limitations

- Verified only on the node-22 template; other sizes and templates are not verified.  
- The order tracking itself was not separately tested; behavior should be covered by application code.
- Managed PostgreSQL 16; some functionalities are not verified.

## Cost estimate

Estimated 10.00 USD per month (size prices from pricing.toml).

## Verification evidence

- Canary run on 2026-09-20...: Nuxt pattern fixture deployed on Ample; checks passed for public-media-library and configuration-secrets.

## Execution binding

MCP tool `ample_deploy`, schema hash `876465fce906da0c` observed.

## Input schema
```json
{
  "additionalProperties": false,
  "properties": {
    "env": {
      "description": "Encrypted environment variables (bucket credentials, secrets)",
      "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": [
    "env",
    "name",
    "path"
  ],
  "type": "object"
}
```
