Deliver public assets through CDN for Next.js · Ample Computer
Framework operation
Deliver public assets through CDN for Next.js
Deliver public assets for a Next.js app through the Ample CDN. Publish a bucket with `ample bucket publish`, upload versioned assets with long-lived Cache-Control headers, and reference the bucket's public URL (`public_url` from `ample bucket publish`, https://
supportverifiedreleasepublishedagent runready
VerifiedNovember 6, 2026
What it runs on
Computeverified Apps run in isolated x86_64 Firecracker microVMs; sizes are the priced VM sizes.
CDNverified A published bucket's objects are served from its public URL; set Cache-Control when uploading to control caching. App responses are served by the app.
You need
- •
A bucket created with ample bucket create and published with ample bucket publish (its public URL is the CDN base)
- •
An S3 client in the app to upload assets under versioned keys
- •
An Ample account token with servers:write and buckets:write
Exact tested configuration
buildnpm run build --if-present
installnpm install
runtimenode
sizes-1vcpu-1gb
startnpm run start
templatenode-22
Steps
- 1
Publish the bucket. Publishing makes objects readable at the CDN URL; keep private data in a separate, unpublished bucket.
shCopy
$ ample bucket publish <bucket-name>
- 2
Upload versioned assets. Use keys such as assets/
- 3
Reference the CDN URL. Pass S3_PUBLIC_URL to the app and build asset URLs from it.
shCopy
$ ample deploy . --name <app-name> --public --env S3_PUBLIC_URL=... --env S3_ENDPOINT=... --env S3_REGION=... --env S3_BUCKET=... --env S3_ACCESS_KEY_ID=... --env S3_SECRET_ACCESS_KEY=...
- 4
Verify delivery. Fetch /api/asset-url for the asset URL, then fetch that URL: the CDN must return the asset.
- 5
Verify. Fetch the live URL and run the success checks below. On failure read the build log, then the runtime log, fix the cause and deploy again; do not blind-retry.
shCopy
$ ample logs <deployment_id> --kind build
How it was checked
✓asset URL resolves through the CDN· http get/api/asset-url → “/assets/”
Evidence
- November 6, 2026 · canary run
Next.js route handler uploaded a versioned asset to a published bucket and returned its CDN URL; the CDN served the asset publicly.
- November 5, 2026 · canary run
ample bucket create issued credentials; PutObject and GetObject succeeded through the public S3 endpoint; publish exposed the object at its public URL with an ETag; unpublish and delete cleaned up.
Tested examples
- •
Next.js CDN assets canary. Versioned asset uploaded to a published bucket and served from the CDN URL.
What it doesn’t cover
- •
Verified on the node-22 template at s-1vcpu-1gb.
- •
Buckets speak the standard S3 API (PutObject and GetObject with path-style addressing are checked by the fixtures); ample bucket upload-url returns presigned upload URLs.
- •
Bucket credentials are passed as encrypted environment variables; the catalog never creates the bucket for you (use ample bucket create).
- •
Storage counts what you store, within your plan's allowance; the estimate below covers compute only.
- •
The CDN serves objects from published buckets; the app serves its own responses.
- •
Control caching with Cache-Control on upload and versioned asset keys.