Nextjs
Source:
src/AWS/Website/Nextjs.ts
Deploy a Next.js application to AWS with the OpenNext
(@opennextjs/aws) serverless topology: the SSR server on a streaming
Lambda Function URL, static assets in S3 behind CloudFront’s KV-manifest
edge router, the ISR/fetch cache in a dedicated S3 bucket, a dedicated
image optimization Lambda routed at /_next/image, and ISR revalidation
through an SQS FIFO queue plus a DynamoDB tag-cache table.
The build runs through @alchemy.run/frontend-frameworks/nextjs/aws (the
@opennextjs/aws pipeline) — both it and @opennextjs/aws must be
installed in your project. When the project has no open-next.config.ts,
a minimal default with the streaming server wrapper is generated.
During alchemy dev the site is Next’s own dev server (next dev) and
no cloud resources are declared; Alchemy.remote() opts back into the
full live deployment.
Creating Next.js Sites
Section titled “Creating Next.js Sites”Basic Next.js App
const site = yield* AWS.Website.Nextjs("Web", { rootDir: "./app",});Custom Domain
const site = yield* AWS.Website.Nextjs("Web", { rootDir: "./app", domain: { name: "app.example.com", hostedZoneId: zone.hostedZoneId, },});Server Configuration
Section titled “Server Configuration”const site = yield* AWS.Website.Nextjs("Web", { rootDir: "./app", server: { memorySize: 2048, environment: { API_BASE: api.url, }, },});