This is a static next.js site built using next-static-utils.
See the live demo here!
It demonstrates hosting a static site with dynamic routes and the app router.
- clone repo
pnpm install
- Generate fallback routes:
pnpm next-static-utils generate cloudfront
- Build the application:
pnpm build
- Set up your local aws credentials
- Create an S3 bucket
your-bucket
- Upload the static site
cd out && aws s3 sync . s3://your-bucket
- Ensure the bucket is public and has public read policy, instructions here
- Create a cloudfront distribution and connect it to the s3 bucket as the origin
- Ensure your cloudfront distribution has a root object (index.html).
- Create a cloudfront function and paste the generated
cloudfrontFunc.js
from the repo root - Associate the cloudfront function with your distribution's origin behavior (under viewer request)
TODO: We will likely make a script to automate the above, via terraform or the AWS SDK 👀
If you run into problems, open an issue!