Nextjs component lets you deploy Next.js apps on AWS. It uses OpenNext to build your Next.js app for AWS.
Constructor
sst.config.ts
Parameters
path
Path to the Next.js app directory relative to
sst.config.ts.domain
Set a custom domain for your Next.js app. Supports AWS Route 53, Cloudflare, and Vercel.Redirect
www to apex domain:link
Link resources to your Next.js app. This grants permissions and allows you to access them via the SDK.
environment
Set environment variables for your Next.js app.
Prefix with
NEXT_PUBLIC_ to access variables in the browser.openNextVersion
Configure the OpenNext version for building your app. By default, SST auto-detects based on your Next.js version.
imageOptimization
Configure the Lambda function for image optimization.
Properties
url
nodes
SDK
Access linked resources in your Next.js app:app/page.tsx
Examples
Change the path
sst.config.ts
Add a custom domain
sst.config.ts
Link resources
sst.config.ts
app/page.tsx
Redirect www to apex
sst.config.ts