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://./) from your pages. The CDN serves bucket objects; the app's own responses are still served by the app.

supportverifiedreleasepublishedagent runready

VerifiedNovember 6, 2026

What it runs on

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. 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>
  1. 2

Upload versioned assets. Use keys such as assets//file and set Cache-Control: public, max-age=31536000, immutable; change the version to invalidate.

  1. 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=...
  1. 4

Verify delivery. Fetch /api/asset-url for the asset URL, then fetch that URL: the CDN must return the asset.

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

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

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