cdk-nextjs 0.0.1 → 0.0.2

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",
@@ -13806,6 +13806,6 @@
13806
13806
  "symbolId": "src/nextjs-build/nextjs-build:PublicDirEntry"
13807
13807
  }
13808
13808
  },
13809
- "version": "0.0.1",
13810
- "fingerprint": "qqe06XVMyhws/iq1QQtAUp35ro4xPE9YF3c/Vo61gac="
13809
+ "version": "0.0.2",
13810
+ "fingerprint": "lksAxc42HMEu9kv7hsHxMBINOWHD4XnbINhwaNVFseA="
13811
13811
  }
package/README.md CHANGED
@@ -1,3 +1,7 @@
1
+ ![Version](https://img.shields.io/github/v/release/cdklabs/cdk-nextjs)
2
+ [![npm version](https://img.shields.io/npm/v/cdk-nextjs.svg?style=flat-square)](https://www.npmjs.org/package/cdk-nextjs)
3
+ ![License](https://img.shields.io/github/license/cdklabs/cdk-nextjs)
4
+
1
5
  # CDK Next.js Construct Library
2
6
 
3
7
  <!--BEGIN STABILITY BANNER-->
@@ -27,13 +31,14 @@ Deploy [Next.js](https://nextjs.org/) apps on [AWS](https://aws.amazon.com/) wit
27
31
  - 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.
28
32
  - [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/).
29
33
  - Customize every construct via `overrides`.
30
- - When using AWS Lambda for compute, async revalidation is supported with [Amazon Simple Queue Service (SQS)](https://aws.amazon.com/sqs/).
34
+ - WIP: When using AWS Lambda for compute, async revalidation is supported with [Amazon Simple Queue Service (SQS)](https://aws.amazon.com/sqs/).
31
35
  - AWS security and operational best practices are utilized, guided by [cdk-nag](https://github.com/cdklabs/cdk-nag).
32
36
  - First class support for [monorepos](https://monorepo.tools/).
33
37
  - [AWS GovCloud (US)](https://aws.amazon.com/govcloud-us) compatible (with `NextjsRegionalContainers`).
34
38
 
35
39
  ## Getting Started
36
40
 
41
+ 1. If you don’t have a Next.js project yet, follow [these steps](https://nextjs.org/docs/getting-started) to create one.
37
42
  1. Install [Docker](https://www.docker.com/). We recommend [Rancher Desktop](https://rancherdesktop.io/) with dockerd (moby) container engine enabled.
38
43
  1. Install [Node.js](https://nodejs.org/en). We recommend the long term support (LTS) version.
39
44
  1. 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).
@@ -71,25 +76,31 @@ See [examples/](./examples/) for more usage examples.
71
76
 
72
77
  ### `NextjsGlobalFunctions`
73
78
 
79
+ Architecture 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))
80
+
74
81
  ![NextjsGlobalFunctions](./docs/cdk-nextjs-NextjsGlobalFunctions.png)
75
82
 
76
83
  ### `NextjsGlobalContainers`
77
84
 
85
+ Architecture 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))
86
+
78
87
  ![NextjsGlobalContainers](./docs/cdk-nextjs-NextjsGlobalContainers.png)
79
88
 
80
89
  ### `NextjsRegionalContainers`
81
90
 
91
+ Architecture 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))
92
+
82
93
  ![NextjsRegionalContainers](./docs/cdk-nextjs-NextjsRegionalContainers.png)
83
94
 
84
95
  ## Why
85
96
 
86
- The 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.
97
+ The 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.
87
98
 
88
99
  ## Design Principles
89
100
 
90
101
  - 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.
91
102
  - Security first.
92
- - One size does not fit all.
103
+ - One architecture does not fit all.
93
104
  - Enable customization everywhere.
94
105
 
95
106
  ## Limitations
@@ -111,10 +122,6 @@ This construct by default implements all AWS security best practices that a CDK
111
122
 
112
123
  WIP
113
124
 
114
- ## Acknowledgements
115
-
116
- This 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).
117
-
118
125
  ## Contributing
119
126
 
120
127
  Steps to build locally:
@@ -135,3 +142,21 @@ A: API Gateway does not support streaming.
135
142
 
136
143
  Q: Why EFS instead of S3?
137
144
  A: 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.
145
+
146
+ Q: How customizable is the `cdk-nextjs` package for different use cases?
147
+ A: 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.
148
+
149
+ Q: How can I use a custom domain with `cdk-nextjs`?
150
+ A: 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.
151
+
152
+ ## Acknowledgements
153
+
154
+ This 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).
155
+
156
+ ## 🥂 Thanks Contributors
157
+
158
+ Thank you for helping other developers deploy Next.js apps on AWS
159
+
160
+ <a href="https://github.com/cdklabs/cdk-nextjs/graphs/contributors">
161
+ <img src="https://contrib.rocks/image?repo=cdklabs/cdk-nextjs" />
162
+ </a>
@@ -8671,7 +8671,7 @@ function fsToFs(props) {
8671
8671
  // src/lambdas/assets-deployment/fs-to-s3.ts
8672
8672
  var import_node_fs3 = require("node:fs");
8673
8673
  var import_node_path2 = require("node:path");
8674
- var import_client_s32 = require("@aws-sdk/client-s3");
8674
+ var import_lib_storage = require("@aws-sdk/lib-storage");
8675
8675
  var mime = __toESM(require_mime_types());
8676
8676
 
8677
8677
  // src/lambdas/assets-deployment/common.ts
@@ -8744,7 +8744,7 @@ async function fsToS3(props) {
8744
8744
  );
8745
8745
  debug({ putObjectInputs });
8746
8746
  await Promise.all(
8747
- putObjectInputs.map((input) => s3.send(new import_client_s32.PutObjectCommand(input)))
8747
+ putObjectInputs.map((input) => new import_lib_storage.Upload({ client: s3, params: input }))
8748
8748
  );
8749
8749
  }
8750
8750
  }
@@ -8756,7 +8756,7 @@ function createS3Key({ keyPrefix, path, basePath }) {
8756
8756
  }
8757
8757
 
8758
8758
  // src/lambdas/assets-deployment/prune-s3.ts
8759
- var import_client_s33 = require("@aws-sdk/client-s3");
8759
+ var import_client_s32 = require("@aws-sdk/client-s3");
8760
8760
  async function pruneS3(props) {
8761
8761
  props;
8762
8762
  }
@@ -33,7 +33,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
33
33
  ));
34
34
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
35
 
36
- // node_modules/.pnpm/tslib@2.7.0/node_modules/tslib/tslib.es6.mjs
36
+ // node_modules/.pnpm/tslib@2.8.0/node_modules/tslib/tslib.es6.mjs
37
37
  var tslib_es6_exports = {};
38
38
  __export(tslib_es6_exports, {
39
39
  __addDisposableResource: () => __addDisposableResource,
@@ -61,6 +61,7 @@ __export(tslib_es6_exports, {
61
61
  __propKey: () => __propKey,
62
62
  __read: () => __read,
63
63
  __rest: () => __rest,
64
+ __rewriteRelativeImportExtension: () => __rewriteRelativeImportExtension,
64
65
  __runInitializers: () => __runInitializers,
65
66
  __setFunctionName: () => __setFunctionName,
66
67
  __spread: () => __spread,
@@ -461,9 +462,17 @@ function __disposeResources(env) {
461
462
  }
462
463
  return next();
463
464
  }
465
+ function __rewriteRelativeImportExtension(path, preserveJsx) {
466
+ if (typeof path === "string" && /^\.\.?\//.test(path)) {
467
+ return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m, tsx, d, ext, cm) {
468
+ return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : d + ext + "." + cm.toLowerCase() + "js";
469
+ });
470
+ }
471
+ return path;
472
+ }
464
473
  var extendStatics, __assign, __createBinding, __setModuleDefault, _SuppressedError, tslib_es6_default;
465
474
  var init_tslib_es6 = __esm({
466
- "node_modules/.pnpm/tslib@2.7.0/node_modules/tslib/tslib.es6.mjs"() {
475
+ "node_modules/.pnpm/tslib@2.8.0/node_modules/tslib/tslib.es6.mjs"() {
467
476
  "use strict";
468
477
  extendStatics = function(d, b) {
469
478
  extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
@@ -511,6 +520,10 @@ var init_tslib_es6 = __esm({
511
520
  __rest,
512
521
  __decorate,
513
522
  __param,
523
+ __esDecorate,
524
+ __runInitializers,
525
+ __propKey,
526
+ __setFunctionName,
514
527
  __metadata,
515
528
  __awaiter,
516
529
  __generator,
@@ -532,7 +545,8 @@ var init_tslib_es6 = __esm({
532
545
  __classPrivateFieldSet,
533
546
  __classPrivateFieldIn,
534
547
  __addDisposableResource,
535
- __disposeResources
548
+ __disposeResources,
549
+ __rewriteRelativeImportExtension
536
550
  };
537
551
  }
538
552
  });
@@ -4,7 +4,7 @@ exports.fsToS3 = fsToS3;
4
4
  const node_fs_1 = require("node:fs");
5
5
  const node_path_1 = require("node:path");
6
6
  // eslint-disable-next-line import/no-extraneous-dependencies
7
- const client_s3_1 = require("@aws-sdk/client-s3");
7
+ const lib_storage_1 = require("@aws-sdk/lib-storage");
8
8
  // eslint-disable-next-line import/no-extraneous-dependencies
9
9
  const mime = require("mime-types");
10
10
  const common_1 = require("./common");
@@ -29,7 +29,7 @@ async function fsToS3(props) {
29
29
  };
30
30
  });
31
31
  (0, utils_1.debug)({ putObjectInputs });
32
- await Promise.all(putObjectInputs.map((input) => s3_1.s3.send(new client_s3_1.PutObjectCommand(input))));
32
+ await Promise.all(putObjectInputs.map((input) => new lib_storage_1.Upload({ client: s3_1.s3, params: input })));
33
33
  }
34
34
  }
35
35
  /**
@@ -42,4 +42,4 @@ function createS3Key({ keyPrefix, path, basePath }) {
42
42
  objectKeyParts.push((0, node_path_1.relative)(basePath, path));
43
43
  return (0, node_path_1.join)(...objectKeyParts);
44
44
  }
45
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZnMtdG8tczMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvbGFtYmRhcy9hc3NldHMtZGVwbG95bWVudC9mcy10by1zMy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQVdBLHdCQXlCQztBQXBDRCxxQ0FBMkM7QUFDM0MseUNBQTJDO0FBQzNDLDZEQUE2RDtBQUM3RCxrREFBNkU7QUFDN0UsNkRBQTZEO0FBQzdELG1DQUFtQztBQUNuQyxxQ0FBcUQ7QUFDckQsNkJBQTBCO0FBQzFCLG1DQUFnQztBQUd6QixLQUFLLFVBQVUsTUFBTSxDQUFDLEtBQW1CO0lBQzlDLE1BQU0sRUFBRSxxQkFBcUIsRUFBRSxvQkFBb0IsRUFBRSxVQUFVLEVBQUUsR0FBRyxLQUFLLENBQUM7SUFDMUUsTUFBTSxlQUFlLEdBQUcsSUFBQSxzQkFBYSxFQUFDLFVBQVUsQ0FBQyxDQUFDO0lBQ2xELElBQUksS0FBSyxFQUFFLE1BQU0sYUFBYSxJQUFJLElBQUEsbUJBQVUsRUFBQyxlQUFlLEVBQUUsR0FBRyxDQUFDLEVBQUUsQ0FBQztRQUNuRSxNQUFNLGVBQWUsR0FBNEIsYUFBYSxDQUFDLEdBQUcsQ0FDaEUsQ0FBQyxJQUFJLEVBQUUsRUFBRTtZQUNQLE1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g/OiBzdHJpbmc7XG4gIHBhdGg6IHN0cmluZztcbiAgYmFzZVBhdGg6IHN0cmluZztcbn1cbi8qKlxuICogQ3JlYXRlIFMzIEtleSBnaXZlbiBsb2NhbCBwYXRoXG4gKi9cbmZ1bmN0aW9uIGNyZWF0ZVMzS2V5KHsga2V5UHJlZml4LCBwYXRoLCBiYXNlUGF0aCB9OiBDcmVhdGVTM0tleVByb3BzKSB7XG4gIGNvbnN0IG9iamVjdEtleVBhcnRzOiBzdHJpbmdbXSA9IFtdO1xuICBpZiAoa2V5UHJlZml4KSBvYmplY3RLZXlQYXJ0cy5wdXNoKGtleVByZWZpeCk7XG4gIG9iamVjdEtleVBhcnRzLnB1c2gocmVsYXRpdmUoYmFzZVBhdGgsIHBhdGgpKTtcbiAgcmV0dXJuIGpvaW4oLi4ub2JqZWN0S2V5UGFydHMpO1xufVxuIl19
@@ -89,5 +89,5 @@ class NextjsAssetsDeployment extends constructs_1.Construct {
89
89
  }
90
90
  exports.NextjsAssetsDeployment = NextjsAssetsDeployment;
91
91
  _a = JSII_RTTI_SYMBOL_1;
92
- NextjsAssetsDeployment[_a] = { fqn: "cdk-nextjs.NextjsAssetsDeployment", version: "0.0.1" };
92
+ NextjsAssetsDeployment[_a] = { fqn: "cdk-nextjs.NextjsAssetsDeployment", version: "0.0.2" };
93
93
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmV4dGpzLWFzc2V0cy1kZXBsb3ltZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL25leHRqcy1hc3NldHMtZGVwbG95bWVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLHNDQUFrQztBQUNsQyw2Q0FBdUQ7QUFHdkQsdURBS2dDO0FBRWhDLDJDQUF1QztBQUN2QyxxQ0FJa0I7QUFzR2xCOztHQUVHO0FBQ0gsTUFBYSxzQkFBdUIsU0FBUSxzQkFBUztJ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GhpbmcgdG8gZGVwbG95XG4gICAgKTtcbiAgICBjb25zdCBwcm9wZXJ0aWVzOiBDdXN0b21SZXNvdXJjZVByb3BlcnRpZXMgPSB7XG4gICAgICBhY3Rpb25zLFxuICAgICAgYnVpbGRJbWFnZURpZ2VzdDogdGhpcy5wcm9wcy5idWlsZEltYWdlRGlnZXN0LFxuICAgICAgaW1hZ2VDYWNoZVBhdGg6IGpvaW4oXG4gICAgICAgIHRoaXMucHJvcHMuY29udGFpbmVyTW91bnRQYXRoRm9yRWZzLFxuICAgICAgICBJTUFHRV9DQUNIRV9ESVIsXG4gICAgICApLFxuICAgICAgcHJlcmVuZGVyTWFuaWZlc3RQYXRoOiBqb2luKHJvb3QsIFwiLm5leHRcIiwgXCJwcmVyZW5kZXItbWFuaWZlc3QuanNvblwiKSxcbiAgICB9O1xuICAgIHJldHVybiBuZXcgQ3VzdG9tUmVzb3VyY2UodGhpcywgXCJDdXN0b21SZXNvdXJjZVwiLCB7XG4gICAgICBwcm9wZXJ0aWVzLFxuICAgICAgcmVzb3VyY2VUeXBlOiBcIkN1c3RvbTo6TmV4dGpzQXNzZXRzRGVwbG95bWVudFwiLFxuICAgICAgc2VydmljZVRva2VuOiB0aGlzLmRvY2tlckltYWdlRnVuY3Rpb24uZnVuY3Rpb25Bcm4sXG4gICAgfSk7XG4gIH1cbn1cbiJdfQ==
@@ -19,11 +19,7 @@ RUN \
19
19
  fi
20
20
  ARG BUILD_COMMAND
21
21
  ARG RELATIVE_PATH_TO_WORKSPACE
22
- RUN \
23
- if [ -f ./cdk-nextjs-load-env-vars.sh ]; then \
24
- chmod u+x ./cdk-nextjs-load-env-vars.sh && \
25
- . ./cdk-nextjs-load-env-vars.sh; \
26
- fi && \
27
- cd $RELATIVE_PATH_TO_WORKSPACE && \
28
- $BUILD_COMMAND
29
- # TODO: remove unnecessary node_modules: https://github.com/sst/open-next/pull/242
22
+ RUN if [ -f ./cdk-nextjs-load-env-vars.sh ]; then chmod u+x ./cdk-nextjs-load-env-vars.sh && . ./cdk-nextjs-load-env-vars.sh; fi
23
+ RUN cd $RELATIVE_PATH_TO_WORKSPACE && $BUILD_COMMAND
24
+ # after building, node_modules aren't needed anymore. this reduces image size by over 50mb
25
+ RUN rm -rf node_modules