Next.js Static Deployments

An AWS code pipeline is created for each Next.js application. This pipeline is responsible for deploying the infrastructure and the application code. The pipeline is triggered when a new commit is pushed to the specified branch of the application's repository.

Architecture

Next.js Static Deployment

Static Files

Static files of the Next.js application are deployed to an S3 bucket. The deployed bucket is private and all static files are served using CloudFront.

Image Optimization

An image optimization lambda handles image optimization for the Next.js application. Optimization requests are made when the Next.js <Image /> component is used. The lambda uses the sharp library to optimize images.