cdk-nextjs 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.jsii CHANGED
@@ -3880,7 +3880,7 @@
3880
3880
  },
3881
3881
  "name": "cdk-nextjs",
3882
3882
  "readme": {
3883
- "markdown": "# CDK Next.js Construct Library\n\n<!--BEGIN STABILITY BANNER-->\n\n---\n\n![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge)\n\n> The APIs of higher level constructs in this module are experimental and under active development.\n> They are subject to non-backward compatible changes or removal in any future version. These are\n> not subject to the [Semantic Versioning](https://semver.org/) model and breaking changes will be\n> announced in the release notes. This means that while you may use them, you may need to update\n> your source code when upgrading to a newer version of this package.\n\n---\n\n<!--END STABILITY BANNER-->\n\nDeploy [Next.js](https://nextjs.org/) apps on [AWS](https://aws.amazon.com/) with the [AWS CDK](https://aws.amazon.com/cdk/).\n\n## Features\n\n- Supports all features of Next.js App and Pages Router for [Node.js Runtime](https://nextjs.org/docs/app/building-your-application/rendering/edge-and-nodejs-runtimes#nodejs-runtime)\n- Choose your AWS architecture for Next.js with the supported constructs: `NextjsGlobalFunctions`, `NextjsGlobalContainers`, `NextjsRegionalContainers`.\n- Global Content Delivery Network (CDN) built with [Amazon CloudFront](https://aws.amazon.com/cloudfront/) to deliver content with low latency and high transfer speeds.\n- Serverless functions powered by [AWS Lambda](https://aws.amazon.com/lambda/) or serverless containers powered by [AWS Fargate](https://aws.amazon.com/fargate/).\n- Static assets (JS, CSS, public folder) are stored and served from [Amazon Simple Storage Service (S3)](https://aws.amazon.com/s3/) for global constructs to decrease latency and reduce compute costs.\n- [Optimized images](https://nextjs.org/docs/pages/building-your-application/optimizing/images), [data cache](https://nextjs.org/docs/app/building-your-application/caching#data-cache), and [full route cache](https://nextjs.org/docs/app/building-your-application/caching#full-route-cache) are shared across compute with [Amazon Elastic File System (EFS)](https://aws.amazon.com/efs/).\n- Customize every construct via `overrides`.\n- When using AWS Lambda for compute, async revalidation is supported with [Amazon Simple Queue Service (SQS)](https://aws.amazon.com/sqs/).\n- AWS security and operational best practices are utilized, guided by [cdk-nag](https://github.com/cdklabs/cdk-nag).\n- First class support for [monorepos](https://monorepo.tools/).\n- [AWS GovCloud (US)](https://aws.amazon.com/govcloud-us) compatible (with `NextjsRegionalContainers`).\n\n## Getting Started\n\n1. Install [Docker](https://www.docker.com/). We recommend [Rancher Desktop](https://rancherdesktop.io/) with dockerd (moby) container engine enabled.\n1. Install [Node.js](https://nodejs.org/en). We recommend the long term support (LTS) version.\n1. Set your [next.config.js](https://nextjs.org/docs/pages/api-reference/next-config-js) [output](https://nextjs.org/docs/pages/api-reference/next-config-js/output) key to `\"standalone\"`. Learn more here about [Standalone Output](https://nextjs.org/docs/pages/api-reference/next-config-js/output#automatically-copying-traced-files).\n1. Setup [AWS Cloud Development Kit](https://docs.aws.amazon.com/cdk/v2/guide/home.html) app.\n1. Install the construct package: `npm install cdk-nextjs`\n1. `cdk deploy`\n1. Visit URL printed in terminal (CloudFormation Output) to view your Next.js app!\n\n## Basic Example CDK App\n\n```ts\nimport { App, Stack } from \"aws-cdk-lib\";\nimport { Construct } from \"constructs\";\nimport { fileURLToPath } from \"node:url\";\nimport { NextjsGlobalFunctions } from \"cdk-nextjs\";\n\nclass NextjsStack extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id, props);\n new NextjsGlobalFunctions(this, \"Nextjs\", {\n healthCheckPath: \"/api/health\",\n buildContext: fileURLToPath(new URL(\"..\", import.meta.url)),\n });\n }\n}\n\nconst app = new App();\n\nnew NextjsStack(app, \"nextjs\");\n```\n\nSee [examples/](./examples/) for more usage examples.\n\n## Architecture\n\n### `NextjsGlobalFunctions`\n\n![NextjsGlobalFunctions](./docs/cdk-nextjs-NextjsGlobalFunctions.png)\n\n### `NextjsGlobalContainers`\n\n![NextjsGlobalContainers](./docs/cdk-nextjs-NextjsGlobalContainers.png)\n\n### `NextjsRegionalContainers`\n\n![NextjsRegionalContainers](./docs/cdk-nextjs-NextjsRegionalContainers.png)\n\n## Why\n\nThe simplest path to deploy Next.js is on [Vercel](https://vercel.com/) - the Platform-as-a-Service company behind Next.js. However, deploying to Vercel can be expensive and some developers want all of their workloads running _directly_ on AWS. Developers can deploy Next.js on AWS through [AWS Amplify Hosting](https://docs.aws.amazon.com/amplify/latest/userguide/ssr-Amplifysupport.html), but Amplify does not support all Next.js features and manages AWS resources for you so they cannot be customized. If Amplify meets your requirements we recommend you use it, but if you want to use all Next.js features or want more visibility into the AWS resources checkout cdk-nextjs.\n\n## Design Principles\n\n- Treat Next.js as black box. Minimize reliance on Next.js internal APIs to reduce chance of incompatibility between this construct and future versions of Next.js.\n- Security first.\n- One size does not fit all.\n- Enable customization everywhere.\n\n## Limitations\n\n- If using `NextjsGlobalFunctions` or `NextjsGlobalContainers` (which use CloudFront), the number of top level files/directories cannot exceed 25, the max number of behaviors a CloudFront Distrubtion supports. We recommend you put all of your public assets into one top level directory (i.e. public/static) so you don't reach this limit. See [CloudFront Quotas](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html) for more information.\n- If using `NextjsGlobalFunctions`, when [revalidating data in Next.js](https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating#on-demand-revalidation) (i.e. [revalidatePath](https://nextjs.org/docs/app/api-reference/functions/revalidatePath)), the CloudFront Cache will still hold stale data. You'll need to use AWS SDK JS V3 [CreateInvalidationCommand](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudfront/Class/CreateInvalidationCommand/) to manually invalidate the path in CloudFront. See more [here](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html).\n- If using `NextjsGlobalFunctions`, setting an Authorization header won't work by default because of Lambda Function URL with IAM Auth is already using the Authorization header. You can use the `AWS_LWA_AUTHORIZATION_SOURCE` environment variable of [AWS Lambda Web Adapter](https://github.com/awslabs/aws-lambda-web-adapter) to set an alternative Authorization header in the client which will then be set to the Authorization header when it reaches your app.\n\n## Additional Security Recommendations\n\nThis construct by default implements all AWS security best practices that a CDK construct library reasonably can considering cost and complexity. Below are additional security practices we recommend you implement within your CDK app. Please see them below:\n\n- [VPC Flow Logs](https://docs.aws.amazon.com/vpc/latest/userguide/flow-logs.html). See [examples/](./examples) for sample implementation.\n- [Scan ECR Images For Vulnerabilities](https://docs.aws.amazon.com/AmazonECR/latest/userguide/image-scanning.html).\n- For `NextjsGlobalFunctions` and `NextjsGlobalContainers`, [CloudFront Access Logs](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/AccessLogs.html). See [examples/](./examples) for sample implementation.\n- For `NextjsGlobalContainers` and `NextjsRegionalContainers`, [ALB HTTPS Listener](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/create-https-listener.html)\n\n## Estimated Costs\n\nWIP\n\n## Acknowledgements\n\nThis construct was built on the shoulders of giants. Thank you to the contributors of [cdk-nextjs-standalone](https://github.com/jetbridge/cdk-nextjs) and [open-next](https://github.com/sst/open-next).\n\n## Contributing\n\nSteps to build locally:\n\n1. `git clone https://github.com/cdklabs/cdk-nextjs.git`\n2. `cd cdk-nextjs`\n3. `pnpm i && pnpm compile && pnpm build`\n\nThis project uses Projen, so make sure to not edit [Projen](https://projen.io/) created files and only edit .projenrc.ts.\n\n## FAQ\n\nQ: How does this compare to [cdk-nextjs-standalone](https://github.com/jetbridge/cdk-nextjs)?\nA: cdk-nextjs-standalone relies on [OpenNext](https://github.com/sst/open-next). OpenNext injects custom code to interact with private Next.js APIs. While OpenNext is able to make some optimizations that are great for serverless environments, this comes at an increase maintenance cost and increased chances for breaking changes. A goal of cdk-nextjs is to customize Next.js as little as possible to reduce the maintenance burden and decrease chances of breaking changes.\n\nQ: Why not offer API Gateway version of construct?\nA: API Gateway does not support streaming.\n\nQ: Why EFS instead of S3?\nA: Next.js has 3 types of server caching that are persisted to disk: [Data Cache](https://nextjs.org/docs/app/building-your-application/caching#data-cache), [Full Route Cache](https://nextjs.org/docs/app/building-your-application/caching#full-route-cache), and [Image Optimization](https://nextjs.org/docs/pages/building-your-application/optimizing/images). Cached data is persisted at .next/cache/fetch-cache, cached full routes are persisted at .next/server/app, and optimized images are persisted at .next/cache/images. Next.js provides a way to customize where cached data or cached full routes are persisted through the [Custom Next.js Cache Handler](https://nextjs.org/docs/app/api-reference/next-config-js/incrementalCacheHandlerPath), but there currently is no way to persist optimized images. Therefore, we need a way to persist cached data at the file system level which is transparent to Next.js. To do this, we use [Amazon Elastic File System (EFS)](https://aws.amazon.com/efs/). Benefits of EFS include being able to cache any Next.js data persisted to disk and therefore being flexible to adapt to Next.js as the framework evolves caching additional types of data. One exception to not using the Custom Next.js Cache Handler is to support [Data Cache Time-based Revalidation](https://nextjs.org/docs/app/building-your-application/caching#time-based-revalidation) when using AWS Lambda functions. Functions only run when they are responding to a request preventing time-based revalidation unlike containers with AWS Fargate which run continually. For functions, an [Amazon SQS Queue](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/welcome.html) and consuming function that will make a HEAD request with x-prerender-revalidate header needed for Next.js to update cache.\n"
3883
+ "markdown": "![Version](https://img.shields.io/github/v/release/cdklabs/cdk-nextjs)\n[![npm version](https://img.shields.io/npm/v/cdk-nextjs.svg?style=flat-square)](https://www.npmjs.org/package/cdk-nextjs)\n![License](https://img.shields.io/github/license/cdklabs/cdk-nextjs)\n\n# CDK Next.js Construct Library\n\n<!--BEGIN STABILITY BANNER-->\n\n---\n\n![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge)\n\n> The APIs of higher level constructs in this module are experimental and under active development.\n> They are subject to non-backward compatible changes or removal in any future version. These are\n> not subject to the [Semantic Versioning](https://semver.org/) model and breaking changes will be\n> announced in the release notes. This means that while you may use them, you may need to update\n> your source code when upgrading to a newer version of this package.\n\n---\n\n<!--END STABILITY BANNER-->\n\nDeploy [Next.js](https://nextjs.org/) apps on [AWS](https://aws.amazon.com/) with the [AWS CDK](https://aws.amazon.com/cdk/).\n\n## Features\n\n- Supports all features of Next.js App and Pages Router for [Node.js Runtime](https://nextjs.org/docs/app/building-your-application/rendering/edge-and-nodejs-runtimes#nodejs-runtime)\n- Choose your AWS architecture for Next.js with the supported constructs: `NextjsGlobalFunctions`, `NextjsGlobalContainers`, `NextjsRegionalContainers`.\n- Global Content Delivery Network (CDN) built with [Amazon CloudFront](https://aws.amazon.com/cloudfront/) to deliver content with low latency and high transfer speeds.\n- Serverless functions powered by [AWS Lambda](https://aws.amazon.com/lambda/) or serverless containers powered by [AWS Fargate](https://aws.amazon.com/fargate/).\n- Static assets (JS, CSS, public folder) are stored and served from [Amazon Simple Storage Service (S3)](https://aws.amazon.com/s3/) for global constructs to decrease latency and reduce compute costs.\n- [Optimized images](https://nextjs.org/docs/pages/building-your-application/optimizing/images), [data cache](https://nextjs.org/docs/app/building-your-application/caching#data-cache), and [full route cache](https://nextjs.org/docs/app/building-your-application/caching#full-route-cache) are shared across compute with [Amazon Elastic File System (EFS)](https://aws.amazon.com/efs/).\n- Customize every construct via `overrides`.\n- WIP: When using AWS Lambda for compute, async revalidation is supported with [Amazon Simple Queue Service (SQS)](https://aws.amazon.com/sqs/).\n- AWS security and operational best practices are utilized, guided by [cdk-nag](https://github.com/cdklabs/cdk-nag).\n- First class support for [monorepos](https://monorepo.tools/).\n- [AWS GovCloud (US)](https://aws.amazon.com/govcloud-us) compatible (with `NextjsRegionalContainers`).\n\n## Getting Started\n\n1. If you don’t have a Next.js project yet, follow [these steps](https://nextjs.org/docs/getting-started) to create one.\n1. Install [Docker](https://www.docker.com/). We recommend [Rancher Desktop](https://rancherdesktop.io/) with dockerd (moby) container engine enabled.\n1. Install [Node.js](https://nodejs.org/en). We recommend the long term support (LTS) version.\n1. Set your [next.config.js](https://nextjs.org/docs/pages/api-reference/next-config-js) [output](https://nextjs.org/docs/pages/api-reference/next-config-js/output) key to `\"standalone\"`. Learn more here about [Standalone Output](https://nextjs.org/docs/pages/api-reference/next-config-js/output#automatically-copying-traced-files).\n1. Setup [AWS Cloud Development Kit](https://docs.aws.amazon.com/cdk/v2/guide/home.html) app.\n1. Install the construct package: `npm install cdk-nextjs`\n1. `cdk deploy`\n1. Visit URL printed in terminal (CloudFormation Output) to view your Next.js app!\n\n## Basic Example CDK App\n\n```ts\nimport { App, Stack } from \"aws-cdk-lib\";\nimport { Construct } from \"constructs\";\nimport { fileURLToPath } from \"node:url\";\nimport { NextjsGlobalFunctions } from \"cdk-nextjs\";\n\nclass NextjsStack extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id, props);\n new NextjsGlobalFunctions(this, \"Nextjs\", {\n healthCheckPath: \"/api/health\",\n buildContext: fileURLToPath(new URL(\"..\", import.meta.url)),\n });\n }\n}\n\nconst app = new App();\n\nnew NextjsStack(app, \"nextjs\");\n```\n\nSee [examples/](./examples/) for more usage examples.\n\n## Architecture\n\n### `NextjsGlobalFunctions`\n\nArchitecture includes [AWS Lambda](https://docs.aws.amazon.com/lambda/latest/dg/welcome.html) Functions to respond to dynamic requests and [CloudFront](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Introduction.html) Distribution to globally serve requests and distribute static assets. Use this construct when you have unpredictable traffic, can afford occasional latency (i.e. cold starts - [typically 1% of production traffic](https://aws.amazon.com/blogs/compute/operating-lambda-performance-optimization-part-1/)), and/or want the most granular pricing model. ([code](./src/root-constructs/nextjs-global-functions.ts#L81))\n\n![NextjsGlobalFunctions](./docs/cdk-nextjs-NextjsGlobalFunctions.png)\n\n### `NextjsGlobalContainers`\n\nArchitecture includes [ECS Fargate](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/AWS_Fargate.html) containers to respond to dynamic requests and [CloudFront](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Introduction.html) Distribution to globally serve requests and distribute static assets. Use this option when you have predictable traffic, need the lowest latency, and/or can afford a less granular pricing model. ([code](./src/root-constructs/nextjs-global-containers.ts#L76))\n\n![NextjsGlobalContainers](./docs/cdk-nextjs-NextjsGlobalContainers.png)\n\n### `NextjsRegionalContainers`\n\nArchitecture includes [ECS Fargate](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/AWS_Fargate.html) containers to respond to dynamic requests and [Application Load Balancer](https://aws.amazon.com/elasticloadbalancing/application-load-balancer/) to regionally serve requests. Use this options when you cannot use Amazon CloudFront (i.e. [AWS GovCloud](https://aws.amazon.com/govcloud-us/?whats-new.sort-by=item.additionalFields.postDateTime&whats-new.sort-order=desc)). ([code](./src/root-constructs/nextjs-regional-containers.ts#L41))\n\n![NextjsRegionalContainers](./docs/cdk-nextjs-NextjsRegionalContainers.png)\n\n## Why\n\nThe simplest path to deploy Next.js is on [Vercel](https://vercel.com/) - the Platform-as-a-Service company behind Next.js. However, deploying to Vercel can be expensive and some developers want all of their workloads running _directly_ on AWS. Developers can deploy Next.js on AWS through [AWS Amplify Hosting](https://docs.aws.amazon.com/amplify/latest/userguide/ssr-Amplifysupport.html), but Amplify does not support all Next.js features and manages AWS resources for you so they cannot be customized. If Amplify meets your requirements we recommend you use it, but if you want to use all Next.js features or want more visibility into the AWS resources then this construct is for you.\n\n## Design Principles\n\n- Treat Next.js as black box. Minimize reliance on Next.js internal APIs to reduce chance of incompatibility between this construct and future versions of Next.js.\n- Security first.\n- One architecture does not fit all.\n- Enable customization everywhere.\n\n## Limitations\n\n- If using `NextjsGlobalFunctions` or `NextjsGlobalContainers` (which use CloudFront), the number of top level files/directories cannot exceed 25, the max number of behaviors a CloudFront Distrubtion supports. We recommend you put all of your public assets into one top level directory (i.e. public/static) so you don't reach this limit. See [CloudFront Quotas](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html) for more information.\n- If using `NextjsGlobalFunctions`, when [revalidating data in Next.js](https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating#on-demand-revalidation) (i.e. [revalidatePath](https://nextjs.org/docs/app/api-reference/functions/revalidatePath)), the CloudFront Cache will still hold stale data. You'll need to use AWS SDK JS V3 [CreateInvalidationCommand](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudfront/Class/CreateInvalidationCommand/) to manually invalidate the path in CloudFront. See more [here](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html).\n- If using `NextjsGlobalFunctions`, setting an Authorization header won't work by default because of Lambda Function URL with IAM Auth is already using the Authorization header. You can use the `AWS_LWA_AUTHORIZATION_SOURCE` environment variable of [AWS Lambda Web Adapter](https://github.com/awslabs/aws-lambda-web-adapter) to set an alternative Authorization header in the client which will then be set to the Authorization header when it reaches your app.\n\n## Additional Security Recommendations\n\nThis construct by default implements all AWS security best practices that a CDK construct library reasonably can considering cost and complexity. Below are additional security practices we recommend you implement within your CDK app. Please see them below:\n\n- [VPC Flow Logs](https://docs.aws.amazon.com/vpc/latest/userguide/flow-logs.html). See [examples/](./examples) for sample implementation.\n- [Scan ECR Images For Vulnerabilities](https://docs.aws.amazon.com/AmazonECR/latest/userguide/image-scanning.html).\n- For `NextjsGlobalFunctions` and `NextjsGlobalContainers`, [CloudFront Access Logs](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/AccessLogs.html). See [examples/](./examples) for sample implementation.\n- For `NextjsGlobalContainers` and `NextjsRegionalContainers`, [ALB HTTPS Listener](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/create-https-listener.html)\n\n## Estimated Costs\n\nWIP\n\n## Contributing\n\nSteps to build locally:\n\n1. `git clone https://github.com/cdklabs/cdk-nextjs.git`\n2. `cd cdk-nextjs`\n3. `pnpm i && pnpm compile && pnpm build`\n\nThis project uses Projen, so make sure to not edit [Projen](https://projen.io/) created files and only edit .projenrc.ts.\n\n## FAQ\n\nQ: How does this compare to [cdk-nextjs-standalone](https://github.com/jetbridge/cdk-nextjs)?\nA: cdk-nextjs-standalone relies on [OpenNext](https://github.com/sst/open-next). OpenNext injects custom code to interact with private Next.js APIs. While OpenNext is able to make some optimizations that are great for serverless environments, this comes at an increase maintenance cost and increased chances for breaking changes. A goal of cdk-nextjs is to customize Next.js as little as possible to reduce the maintenance burden and decrease chances of breaking changes.\n\nQ: Why not offer API Gateway version of construct?\nA: API Gateway does not support streaming.\n\nQ: Why EFS instead of S3?\nA: Next.js has 3 types of server caching that are persisted to disk: [Data Cache](https://nextjs.org/docs/app/building-your-application/caching#data-cache), [Full Route Cache](https://nextjs.org/docs/app/building-your-application/caching#full-route-cache), and [Image Optimization](https://nextjs.org/docs/pages/building-your-application/optimizing/images). Cached data is persisted at .next/cache/fetch-cache, cached full routes are persisted at .next/server/app, and optimized images are persisted at .next/cache/images. Next.js provides a way to customize where cached data or cached full routes are persisted through the [Custom Next.js Cache Handler](https://nextjs.org/docs/app/api-reference/next-config-js/incrementalCacheHandlerPath), but there currently is no way to persist optimized images. Therefore, we need a way to persist cached data at the file system level which is transparent to Next.js. To do this, we use [Amazon Elastic File System (EFS)](https://aws.amazon.com/efs/). Benefits of EFS include being able to cache any Next.js data persisted to disk and therefore being flexible to adapt to Next.js as the framework evolves caching additional types of data. One exception to not using the Custom Next.js Cache Handler is to support [Data Cache Time-based Revalidation](https://nextjs.org/docs/app/building-your-application/caching#time-based-revalidation) when using AWS Lambda functions. Functions only run when they are responding to a request preventing time-based revalidation unlike containers with AWS Fargate which run continually. For functions, an [Amazon SQS Queue](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/welcome.html) and consuming function that will make a HEAD request with x-prerender-revalidate header needed for Next.js to update cache.\n\nQ: How customizable is the `cdk-nextjs` package for different use cases?\nA: The `cdk-nextjs` package offers deep customization through _prop-based_ overrides. These can be accessed in the construct props, allowing you to override settings like VPC configurations, CloudFront distribution, and ECS/Fargate setup. For example, you can modify `nextjsBuildProps` to customize the build process or use `nextjsDistributionProps` to adjust how CloudFront handles caching and routing. This level of control makes it easy to adapt the infrastructure to your application’s specific performance, networking, or deployment needs.\n\nQ: How can I use a custom domain with `cdk-nextjs`?\nA: To use a custom domain, you can configure the `distribution` prop within constructs like `NextjsGlobalFunctions` or `NextjsGlobalContainers`. By providing an ACM certificate and overriding relevant properties such as `nextjsDistributionProps`, you can customize the CloudFront distribution to handle your domain. This allows CloudFront to route traffic through your custom domain while managing SSL termination for secure HTTPS connections.\n\n## Acknowledgements\n\nThis construct was built on the shoulders of giants. Thank you to the contributors of [cdk-nextjs-standalone](https://github.com/jetbridge/cdk-nextjs) and [open-next](https://github.com/sst/open-next).\n\n## 🥂 Thanks Contributors\n\nThank you for helping other developers deploy Next.js apps on AWS\n\n<a href=\"https://github.com/cdklabs/cdk-nextjs/graphs/contributors\">\n <img src=\"https://contrib.rocks/image?repo=cdklabs/cdk-nextjs\" />\n</a>\n"
3884
3884
  },
3885
3885
  "repository": {
3886
3886
  "type": "git",
@@ -5322,7 +5322,7 @@
5322
5322
  },
5323
5323
  "locationInModule": {
5324
5324
  "filename": "src/nextjs-distribution.ts",
5325
- "line": 148
5325
+ "line": 131
5326
5326
  },
5327
5327
  "parameters": [
5328
5328
  {
@@ -5348,7 +5348,7 @@
5348
5348
  "kind": "class",
5349
5349
  "locationInModule": {
5350
5350
  "filename": "src/nextjs-distribution.ts",
5351
- "line": 103
5351
+ "line": 94
5352
5352
  },
5353
5353
  "name": "NextjsDistribution",
5354
5354
  "properties": [
@@ -5358,7 +5358,7 @@
5358
5358
  },
5359
5359
  "locationInModule": {
5360
5360
  "filename": "src/nextjs-distribution.ts",
5361
- "line": 104
5361
+ "line": 95
5362
5362
  },
5363
5363
  "name": "distribution",
5364
5364
  "type": {
@@ -5378,7 +5378,7 @@
5378
5378
  "kind": "interface",
5379
5379
  "locationInModule": {
5380
5380
  "filename": "src/nextjs-distribution.ts",
5381
- "line": 56
5381
+ "line": 47
5382
5382
  },
5383
5383
  "name": "NextjsDistributionOverrides",
5384
5384
  "properties": [
@@ -5390,7 +5390,7 @@
5390
5390
  "immutable": true,
5391
5391
  "locationInModule": {
5392
5392
  "filename": "src/nextjs-distribution.ts",
5393
- "line": 58
5393
+ "line": 49
5394
5394
  },
5395
5395
  "name": "distributionProps",
5396
5396
  "optional": true,
@@ -5406,7 +5406,7 @@
5406
5406
  "immutable": true,
5407
5407
  "locationInModule": {
5408
5408
  "filename": "src/nextjs-distribution.ts",
5409
- "line": 62
5409
+ "line": 53
5410
5410
  },
5411
5411
  "name": "dynamicBehaviorOptions",
5412
5412
  "optional": true,
@@ -5422,7 +5422,7 @@
5422
5422
  "immutable": true,
5423
5423
  "locationInModule": {
5424
5424
  "filename": "src/nextjs-distribution.ts",
5425
- "line": 63
5425
+ "line": 54
5426
5426
  },
5427
5427
  "name": "dynamicCachePolicyProps",
5428
5428
  "optional": true,
@@ -5438,7 +5438,7 @@
5438
5438
  "immutable": true,
5439
5439
  "locationInModule": {
5440
5440
  "filename": "src/nextjs-distribution.ts",
5441
- "line": 65
5441
+ "line": 56
5442
5442
  },
5443
5443
  "name": "dynamicHttpOriginProps",
5444
5444
  "optional": true,
@@ -5454,7 +5454,7 @@
5454
5454
  "immutable": true,
5455
5455
  "locationInModule": {
5456
5456
  "filename": "src/nextjs-distribution.ts",
5457
- "line": 64
5457
+ "line": 55
5458
5458
  },
5459
5459
  "name": "dynamicResponseHeadersPolicyProps",
5460
5460
  "optional": true,
@@ -5470,7 +5470,7 @@
5470
5470
  "immutable": true,
5471
5471
  "locationInModule": {
5472
5472
  "filename": "src/nextjs-distribution.ts",
5473
- "line": 57
5473
+ "line": 48
5474
5474
  },
5475
5475
  "name": "edgeFunctionProps",
5476
5476
  "optional": true,
@@ -5486,7 +5486,7 @@
5486
5486
  "immutable": true,
5487
5487
  "locationInModule": {
5488
5488
  "filename": "src/nextjs-distribution.ts",
5489
- "line": 59
5489
+ "line": 50
5490
5490
  },
5491
5491
  "name": "imageBehaviorOptions",
5492
5492
  "optional": true,
@@ -5502,7 +5502,7 @@
5502
5502
  "immutable": true,
5503
5503
  "locationInModule": {
5504
5504
  "filename": "src/nextjs-distribution.ts",
5505
- "line": 60
5505
+ "line": 51
5506
5506
  },
5507
5507
  "name": "imageCachePolicyProps",
5508
5508
  "optional": true,
@@ -5518,7 +5518,7 @@
5518
5518
  "immutable": true,
5519
5519
  "locationInModule": {
5520
5520
  "filename": "src/nextjs-distribution.ts",
5521
- "line": 61
5521
+ "line": 52
5522
5522
  },
5523
5523
  "name": "imageResponseHeadersPolicyProps",
5524
5524
  "optional": true,
@@ -5534,12 +5534,12 @@
5534
5534
  "immutable": true,
5535
5535
  "locationInModule": {
5536
5536
  "filename": "src/nextjs-distribution.ts",
5537
- "line": 68
5537
+ "line": 59
5538
5538
  },
5539
- "name": "s3OriginProps",
5539
+ "name": "s3BucketOriginProps",
5540
5540
  "optional": true,
5541
5541
  "type": {
5542
- "fqn": "cdk-nextjs.OptionalS3OriginProps"
5542
+ "fqn": "cdk-nextjs.OptionalS3OriginBucketWithOACProps"
5543
5543
  }
5544
5544
  },
5545
5545
  {
@@ -5550,7 +5550,7 @@
5550
5550
  "immutable": true,
5551
5551
  "locationInModule": {
5552
5552
  "filename": "src/nextjs-distribution.ts",
5553
- "line": 66
5553
+ "line": 57
5554
5554
  },
5555
5555
  "name": "staticBehaviorOptions",
5556
5556
  "optional": true,
@@ -5566,7 +5566,7 @@
5566
5566
  "immutable": true,
5567
5567
  "locationInModule": {
5568
5568
  "filename": "src/nextjs-distribution.ts",
5569
- "line": 67
5569
+ "line": 58
5570
5570
  },
5571
5571
  "name": "staticResponseHeadersPolicyProps",
5572
5572
  "optional": true,
@@ -5587,7 +5587,7 @@
5587
5587
  "kind": "interface",
5588
5588
  "locationInModule": {
5589
5589
  "filename": "src/nextjs-distribution.ts",
5590
- "line": 71
5590
+ "line": 62
5591
5591
  },
5592
5592
  "name": "NextjsDistributionProps",
5593
5593
  "properties": [
@@ -5601,7 +5601,7 @@
5601
5601
  "immutable": true,
5602
5602
  "locationInModule": {
5603
5603
  "filename": "src/nextjs-distribution.ts",
5604
- "line": 76
5604
+ "line": 67
5605
5605
  },
5606
5606
  "name": "assetsBucket",
5607
5607
  "type": {
@@ -5617,7 +5617,7 @@
5617
5617
  "immutable": true,
5618
5618
  "locationInModule": {
5619
5619
  "filename": "src/nextjs-distribution.ts",
5620
- "line": 86
5620
+ "line": 77
5621
5621
  },
5622
5622
  "name": "dynamicUrl",
5623
5623
  "type": {
@@ -5632,7 +5632,7 @@
5632
5632
  "immutable": true,
5633
5633
  "locationInModule": {
5634
5634
  "filename": "src/nextjs-distribution.ts",
5635
- "line": 91
5635
+ "line": 82
5636
5636
  },
5637
5637
  "name": "nextjsType",
5638
5638
  "type": {
@@ -5648,7 +5648,7 @@
5648
5648
  "immutable": true,
5649
5649
  "locationInModule": {
5650
5650
  "filename": "src/nextjs-distribution.ts",
5651
- "line": 100
5651
+ "line": 91
5652
5652
  },
5653
5653
  "name": "publicDirEntries",
5654
5654
  "type": {
@@ -5668,7 +5668,7 @@
5668
5668
  "immutable": true,
5669
5669
  "locationInModule": {
5670
5670
  "filename": "src/nextjs-distribution.ts",
5671
- "line": 77
5671
+ "line": 68
5672
5672
  },
5673
5673
  "name": "basePath",
5674
5674
  "optional": true,
@@ -5685,7 +5685,7 @@
5685
5685
  "immutable": true,
5686
5686
  "locationInModule": {
5687
5687
  "filename": "src/nextjs-distribution.ts",
5688
- "line": 81
5688
+ "line": 72
5689
5689
  },
5690
5690
  "name": "certificate",
5691
5691
  "optional": true,
@@ -5701,7 +5701,7 @@
5701
5701
  "immutable": true,
5702
5702
  "locationInModule": {
5703
5703
  "filename": "src/nextjs-distribution.ts",
5704
- "line": 82
5704
+ "line": 73
5705
5705
  },
5706
5706
  "name": "distribution",
5707
5707
  "optional": true,
@@ -5718,7 +5718,7 @@
5718
5718
  "immutable": true,
5719
5719
  "locationInModule": {
5720
5720
  "filename": "src/nextjs-distribution.ts",
5721
- "line": 90
5721
+ "line": 81
5722
5722
  },
5723
5723
  "name": "functionArn",
5724
5724
  "optional": true,
@@ -5735,7 +5735,7 @@
5735
5735
  "immutable": true,
5736
5736
  "locationInModule": {
5737
5737
  "filename": "src/nextjs-distribution.ts",
5738
- "line": 95
5738
+ "line": 86
5739
5739
  },
5740
5740
  "name": "overrides",
5741
5741
  "optional": true,
@@ -13092,20 +13092,20 @@
13092
13092
  ],
13093
13093
  "symbolId": "src/generated-structs/OptionalNextjsVpcProps:OptionalNextjsVpcProps"
13094
13094
  },
13095
- "cdk-nextjs.OptionalS3OriginProps": {
13095
+ "cdk-nextjs.OptionalS3OriginBucketWithOACProps": {
13096
13096
  "assembly": "cdk-nextjs",
13097
13097
  "datatype": true,
13098
13098
  "docs": {
13099
13099
  "stability": "stable",
13100
- "summary": "OptionalS3OriginProps."
13100
+ "summary": "OptionalS3OriginBucketWithOACProps."
13101
13101
  },
13102
- "fqn": "cdk-nextjs.OptionalS3OriginProps",
13102
+ "fqn": "cdk-nextjs.OptionalS3OriginBucketWithOACProps",
13103
13103
  "kind": "interface",
13104
13104
  "locationInModule": {
13105
- "filename": "src/generated-structs/OptionalS3OriginProps.ts",
13105
+ "filename": "src/generated-structs/OptionalS3OriginBucketWithOACProps.ts",
13106
13106
  "line": 7
13107
13107
  },
13108
- "name": "OptionalS3OriginProps",
13108
+ "name": "OptionalS3OriginBucketWithOACProps",
13109
13109
  "properties": [
13110
13110
  {
13111
13111
  "abstract": true,
@@ -13117,8 +13117,8 @@
13117
13117
  },
13118
13118
  "immutable": true,
13119
13119
  "locationInModule": {
13120
- "filename": "src/generated-structs/OptionalS3OriginProps.ts",
13121
- "line": 65
13120
+ "filename": "src/generated-structs/OptionalS3OriginBucketWithOACProps.ts",
13121
+ "line": 71
13122
13122
  },
13123
13123
  "name": "connectionAttempts",
13124
13124
  "optional": true,
@@ -13136,8 +13136,8 @@
13136
13136
  },
13137
13137
  "immutable": true,
13138
13138
  "locationInModule": {
13139
- "filename": "src/generated-structs/OptionalS3OriginProps.ts",
13140
- "line": 58
13139
+ "filename": "src/generated-structs/OptionalS3OriginBucketWithOACProps.ts",
13140
+ "line": 64
13141
13141
  },
13142
13142
  "name": "connectionTimeout",
13143
13143
  "optional": true,
@@ -13154,8 +13154,8 @@
13154
13154
  },
13155
13155
  "immutable": true,
13156
13156
  "locationInModule": {
13157
- "filename": "src/generated-structs/OptionalS3OriginProps.ts",
13158
- "line": 51
13157
+ "filename": "src/generated-structs/OptionalS3OriginBucketWithOACProps.ts",
13158
+ "line": 57
13159
13159
  },
13160
13160
  "name": "customHeaders",
13161
13161
  "optional": true,
@@ -13168,6 +13168,24 @@
13168
13168
  }
13169
13169
  }
13170
13170
  },
13171
+ {
13172
+ "abstract": true,
13173
+ "docs": {
13174
+ "default": "- an Origin Access Control will be created.",
13175
+ "stability": "stable",
13176
+ "summary": "An optional Origin Access Control."
13177
+ },
13178
+ "immutable": true,
13179
+ "locationInModule": {
13180
+ "filename": "src/generated-structs/OptionalS3OriginBucketWithOACProps.ts",
13181
+ "line": 19
13182
+ },
13183
+ "name": "originAccessControl",
13184
+ "optional": true,
13185
+ "type": {
13186
+ "fqn": "aws-cdk-lib.aws_cloudfront.IOriginAccessControl"
13187
+ }
13188
+ },
13171
13189
  {
13172
13190
  "abstract": true,
13173
13191
  "docs": {
@@ -13177,8 +13195,8 @@
13177
13195
  },
13178
13196
  "immutable": true,
13179
13197
  "locationInModule": {
13180
- "filename": "src/generated-structs/OptionalS3OriginProps.ts",
13181
- "line": 45
13198
+ "filename": "src/generated-structs/OptionalS3OriginBucketWithOACProps.ts",
13199
+ "line": 51
13182
13200
  },
13183
13201
  "name": "originAccessControlId",
13184
13202
  "optional": true,
@@ -13189,19 +13207,24 @@
13189
13207
  {
13190
13208
  "abstract": true,
13191
13209
  "docs": {
13192
- "default": "- An Origin Access Identity will be created.",
13210
+ "default": "[AccessLevel.READ]",
13193
13211
  "stability": "stable",
13194
- "summary": "An optional Origin Access Identity of the origin identity cloudfront will use when calling your s3 bucket."
13212
+ "summary": "The level of permissions granted in the bucket policy and key policy (if applicable) to the CloudFront distribution."
13195
13213
  },
13196
13214
  "immutable": true,
13197
13215
  "locationInModule": {
13198
- "filename": "src/generated-structs/OptionalS3OriginProps.ts",
13216
+ "filename": "src/generated-structs/OptionalS3OriginBucketWithOACProps.ts",
13199
13217
  "line": 13
13200
13218
  },
13201
- "name": "originAccessIdentity",
13219
+ "name": "originAccessLevels",
13202
13220
  "optional": true,
13203
13221
  "type": {
13204
- "fqn": "aws-cdk-lib.aws_cloudfront.IOriginAccessIdentity"
13222
+ "collection": {
13223
+ "elementtype": {
13224
+ "fqn": "aws-cdk-lib.aws_cloudfront.AccessLevel"
13225
+ },
13226
+ "kind": "array"
13227
+ }
13205
13228
  }
13206
13229
  },
13207
13230
  {
@@ -13214,8 +13237,8 @@
13214
13237
  },
13215
13238
  "immutable": true,
13216
13239
  "locationInModule": {
13217
- "filename": "src/generated-structs/OptionalS3OriginProps.ts",
13218
- "line": 39
13240
+ "filename": "src/generated-structs/OptionalS3OriginBucketWithOACProps.ts",
13241
+ "line": 45
13219
13242
  },
13220
13243
  "name": "originId",
13221
13244
  "optional": true,
@@ -13233,8 +13256,8 @@
13233
13256
  },
13234
13257
  "immutable": true,
13235
13258
  "locationInModule": {
13236
- "filename": "src/generated-structs/OptionalS3OriginProps.ts",
13237
- "line": 20
13259
+ "filename": "src/generated-structs/OptionalS3OriginBucketWithOACProps.ts",
13260
+ "line": 26
13238
13261
  },
13239
13262
  "name": "originPath",
13240
13263
  "optional": true,
@@ -13251,8 +13274,8 @@
13251
13274
  },
13252
13275
  "immutable": true,
13253
13276
  "locationInModule": {
13254
- "filename": "src/generated-structs/OptionalS3OriginProps.ts",
13255
- "line": 32
13277
+ "filename": "src/generated-structs/OptionalS3OriginBucketWithOACProps.ts",
13278
+ "line": 38
13256
13279
  },
13257
13280
  "name": "originShieldEnabled",
13258
13281
  "optional": true,
@@ -13269,8 +13292,8 @@
13269
13292
  },
13270
13293
  "immutable": true,
13271
13294
  "locationInModule": {
13272
- "filename": "src/generated-structs/OptionalS3OriginProps.ts",
13273
- "line": 26
13295
+ "filename": "src/generated-structs/OptionalS3OriginBucketWithOACProps.ts",
13296
+ "line": 32
13274
13297
  },
13275
13298
  "name": "originShieldRegion",
13276
13299
  "optional": true,
@@ -13279,7 +13302,7 @@
13279
13302
  }
13280
13303
  }
13281
13304
  ],
13282
- "symbolId": "src/generated-structs/OptionalS3OriginProps:OptionalS3OriginProps"
13305
+ "symbolId": "src/generated-structs/OptionalS3OriginBucketWithOACProps:OptionalS3OriginBucketWithOACProps"
13283
13306
  },
13284
13307
  "cdk-nextjs.OptionalVpcProps": {
13285
13308
  "assembly": "cdk-nextjs",
@@ -13806,6 +13829,6 @@
13806
13829
  "symbolId": "src/nextjs-build/nextjs-build:PublicDirEntry"
13807
13830
  }
13808
13831
  },
13809
- "version": "0.0.1",
13810
- "fingerprint": "qqe06XVMyhws/iq1QQtAUp35ro4xPE9YF3c/Vo61gac="
13832
+ "version": "0.0.3",
13833
+ "fingerprint": "5yIruzTH8JMCvjGdmdxhrPhRyBegv5XDYj+n53mqmOI="
13811
13834
  }