# Deliver public assets through CDN for Starlette

### Summary
Cdn assets for a Starlette app on Ample. Verified on Starlette: a versioned, immutable-cached asset uploaded to a published bucket and served from the CDN URL. Build and start: `pip install into .ample/python from requirements.txt`, then `uvicorn from run.py reading PORT on the python-3.12 template`.

### Prerequisites
- A Starlette project (`pip install into .ample/python from requirements.txt`, then `uvicorn from run.py reading PORT on the python-3.12 template`)
- A bucket from `ample bucket create` with credentials passed as encrypted S3_* environment variables
- An Ample account token with `servers:write`, `buckets:read`

### Workflow Steps
1. **Build and start**  
   `pip install into .ample/python from requirements.txt`, then `uvicorn from run.py reading PORT on the python-3.12 template`; the server must bind `0.0.0.0` on PORT.
2. **Publish a bucket for public assets**  
   Publish only the asset bucket; upload versioned keys with an immutable Cache-Control header and build URLs from its public URL.  
   Command: `ample bucket publish `
3. **Verify**  
   Fetch the live URL and `/p/versioned-static-assets` on the example; on failure read the build and runtime logs.  
   Command: `ample logs --kind build`

### Cost Estimate
- Currency: USD
- Monthly Amount: $5.00
- Basis: size prices from pricing.toml (loaded by the API) at build revision 1ac5595375130d45290090e82ed0f554ccd45405-dirty

### Limitations
- Verified on the python-3.12 template at s-1vcpu-1gb; other sizes and Starlette 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.
