page:recipes:company website:next js:public media
Host company website with Next.js: object-stored public media
Deploy a company website built with Next.js on Ample using the public media library pattern. Compute 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, and a published bucket serves public assets from the CDN host. Verified on Next.js: an object written to a published bucket with an immutable Cache-Control header, a mapping row, and the CDN URL serving it publicly.
Summary
Not separately tested: your media processing, object layout and cache policy; treat the company website-specific behavior as your application code.
Representative Queries
- Host company website with Next.js: object-stored public media
- Where can I host Company website built with Next.js?
- I need an object layout, public asset URL policy and CDN delivery configuration.
Resource Requirements
- primitive:compute
- primitive:postgres
- primitive:s3-compatible-object-storage
- primitive:cdn
Infrastructure Requirements
- Compute: Apps run in isolated x86_64 Firecracker microVMs.
- Postgres: Managed PostgreSQL 16 runs in its own microVM.
- S3-compatible object storage: Buckets are S3-compatible with issued credentials.
- CDN: The CDN host serves objects from published buckets.
Prerequisites
- A Next.js project that builds and starts with the documented commands (next build then next start -H 0.0.0.0 -p $PORT on the node-22 template)
- A PostgreSQL driver reading DATABASE_URL at runtime
- A bucket from
ample bucket createwith its credentials passed as encrypted S3_* environment variables - An Ample account token with servers:write, databases:read, buckets:read
Workflow Steps
- Build and start: next build then next start -H 0.0.0.0 -p $PORT on the node-22 template.
- Implement the pattern on PostgreSQL: Copy the approach into your schema; keep migrations idempotent.
- Wire object storage: Create the bucket(s), then pass endpoint, region, bucket and keys as --env values.
- Deploy: Run the synchronous deploy once and read the result.
Command: ample deploy . --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=... - Verify: Fetch the live URL and run your own checks.
Command: ample logs --kind build
Examples
- Next.js pattern fixture: Multi-pattern Next.js app whose public media library module was checked live.
Success Checks
- App responds on its public URL.
- Public-media-library self-test.
Limitations
- Verified on the node-22 template at s-1vcpu-1gb with the example fixture; other sizes, templates and Next.js major versions are not verified.
Cost Estimate
- Monthly Amount: $10.00
- App server: $5.00
- Managed PostgreSQL database: $5.00
Next Actions
- Browse the catalog index: GET /v1/catalog
- Search published recipes: POST /v1/catalog/search
Body: {"limit":5, "query":"Host company website with Next.js: object-stored public media"} - Prepare a deployment plan: POST /v1/catalog/plan Body: {"inputs":{}, "projectId":"", "recipeId":"page:recipes:company-website:next-js:public-media", "recipeRevision":"r1"}