{"id":13454670,"url":"https://github.com/jetbridge/cdk-nextjs","last_synced_at":"2025-05-15T01:05:25.529Z","repository":{"id":61013208,"uuid":"543825999","full_name":"jetbridge/cdk-nextjs","owner":"jetbridge","description":"Deploy a NextJS application using AWS CDK","archived":false,"fork":false,"pushed_at":"2025-04-09T23:41:24.000Z","size":9180,"stargazers_count":317,"open_issues_count":20,"forks_count":50,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-12T11:09:00.262Z","etag":null,"topics":["aws","cdk","cloudfront","lambda","next","nextjs","serverless"],"latest_commit_sha":null,"homepage":"https://constructs.dev/packages/cdk-nextjs-standalone","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jetbridge.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-09-30T23:32:38.000Z","updated_at":"2025-05-06T03:24:41.000Z","dependencies_parsed_at":"2023-09-24T02:59:12.084Z","dependency_job_id":"34fa1e96-9ef7-4738-aef8-ab1719d916d9","html_url":"https://github.com/jetbridge/cdk-nextjs","commit_stats":{"total_commits":241,"total_committers":21,"mean_commits":"11.476190476190476","dds":0.5684647302904564,"last_synced_commit":"97cc0f8eb7d1de2827e4d28291ac5e16a4a072fd"},"previous_names":[],"tags_count":111,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jetbridge%2Fcdk-nextjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jetbridge%2Fcdk-nextjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jetbridge%2Fcdk-nextjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jetbridge%2Fcdk-nextjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jetbridge","download_url":"https://codeload.github.com/jetbridge/cdk-nextjs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254254039,"owners_count":22039792,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","cdk","cloudfront","lambda","next","nextjs","serverless"],"created_at":"2024-07-31T08:00:56.653Z","updated_at":"2025-05-15T01:05:25.481Z","avatar_url":"https://github.com/jetbridge.png","language":"TypeScript","readme":"# Deploy NextJS with CDK\n\n[![View on Construct Hub](https://constructs.dev/badge?package=cdk-nextjs-standalone)](https://constructs.dev/packages/cdk-nextjs-standalone)\n\n## What is this?\n\nA CDK construct to deploy a NextJS app using AWS CDK.\nSupported NextJs versions: \u003e=12.3.0+ (includes 13.0.0+)\n\nUses the [standalone output](https://nextjs.org/docs/advanced-features/output-file-tracing) build mode.\n\n## Quickstart\n\n```ts\nimport { App, Stack, StackProps } from 'aws-cdk-lib';\nimport { Construct } from 'constructs';\nimport { Nextjs } from 'cdk-nextjs-standalone';\n\nclass WebStack extends Stack {\n  constructor(scope: Construct, id: string, props?: StackProps) {\n    super(scope, id, props);\n    const nextjs = new Nextjs(this, 'Nextjs', {\n      nextjsPath: './web', // relative path from your project root to NextJS\n    });\n    new CfnOutput(this, 'CloudFrontDistributionDomain', {\n      value: nextjs.distribution.distributionDomain,\n    });\n  }\n}\n\nconst app = new App();\nnew WebStack(app, 'web');\n```\n\n## Important Notes\n\n- Due to CloudFront's Distribution Cache Behavior pattern matching limitations, a cache behavior will be created for each top level file or directory in your `public/` folder. CloudFront has a soft limit of [25 cache behaviors per distribution](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html#limits-web-distributions). Therefore, it's recommended to include all assets that can be under a top level folder like `public/static/`. Learn more in open-next docs [here](https://github.com/sst/open-next/blob/main/README.md#workaround-create-one-cache-behavior-per-top-level-file-and-folder-in-public-aws-specific).\n\n## Documentation\n\nAvailable on [Construct Hub](https://constructs.dev/packages/cdk-nextjs-standalone/).\n\n## Examples\n\nSee example CDK apps [here](./examples) including:\n\n- App Router\n- Pages Router\n- App/Pages Router\n- High Security\n- Multiple Sites\n\nTo deploy an example, make sure to read the [README.md](./examples/README.md)\n\n### Discord Chat\n\nWe're in the #aws channel on the [Open-Next Discord](https://discord.gg/VqFVt4YtSq).\n\n## About\n\nDeploys a NextJs static site with server-side rendering and API support. Uses AWS lambda and CloudFront.\n\nThere is a new (since Next 12) [standalone output mode which uses output tracing](https://nextjs.org/docs/advanced-features/output-file-tracing) to generate a minimal server and static files.\nThis standalone server can be converted into a CloudFront distribution and a lambda handler that handles SSR, API, and routing.\n\nThe CloudFront default origin first checks S3 for static files and falls back to an HTTP origin using a lambda function URL.\n\n## Benefits\n\nThis approach is most compatible with new NextJs features such as ESM configuration, [middleware](https://nextjs.org/docs/advanced-features/middleware), next-auth, and React server components (\"appDir\").\n\nThe unmaintained [@serverless-nextjs project](https://github.com/serverless-nextjs/serverless-next.js) uses the deprecated `serverless` NextJs build target which [prevents the use of new features](https://github.com/serverless-nextjs/serverless-next.js/pull/2478).\nThis construct was created to use the new `standalone` output build and newer AWS features like lambda function URLs and fallback origins.\n\nYou may want to look at [Serverless Stack](https://sst.dev) and its [NextjsSite](https://docs.sst.dev/constructs/NextjsSite) construct for an improved developer experience if you are building serverless applications on CDK.\n\n## Dependencies\n\nBuilt on top of [open-next](https://open-next.js.org/), which was partially built using the original core of cdk-nextjs-standalone.\n\n## Heavily based on\n\n- [Open-next](https://open-next.js.org/)\n- \u003chttps://github.com/iiroj/iiro.fi/commit/bd43222032d0dbb765e1111825f64dbb5db851d9\u003e\n- \u003chttps://github.com/sladg/nextjs-lambda\u003e\n- \u003chttps://github.com/serverless-nextjs/serverless-next.js/tree/master/packages/compat-layers/apigw-lambda-compat\u003e\n- [Serverless Stack](https://github.com/serverless-stack/sst)\n  - [RemixSite](https://github.com/serverless-stack/sst/blob/master/packages/resources/src/NextjsSite.ts) construct\n  - [NextjsSite](https://github.com/serverless-stack/sst/blob/master/packages/resources/src/RemixSite.ts) construct\n\n## Contribute\n\nSee [Contribute](./docs/contribute.md).\n\n## Breaking changes\n\nSee [Major Changes](./docs/major-changes.md).\n","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjetbridge%2Fcdk-nextjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjetbridge%2Fcdk-nextjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjetbridge%2Fcdk-nextjs/lists"}