There are three patterns demonstrated in this code.
- Deploy backend first, then build frontend locally
- Fetch variables on runtime
- Build frontend on deploy time
See cdk/lib/cdk-stack.ts for the CDK code.
Pattern #2 requires specific implementation in frontend code. See frontend-runtime-config for how environment variables are fetched on runtime.
This repository is a demo used on CDK Day 2023 "Deploy web frontend apps with AWS CDK". See the recording or slides below: