Weight Loss Plan
Weight Loss Plan helps make healthier food choices, set weight loss goals to helps users get more active and burn more calories.
The app follows the standard pattern. It uses a Static Assets S3 bucket to pull information using its “Calorie Search” function. The name of this bucket is hardcoded into the mobile app which makes replacing it more difficult.
Architecture Overview
graph TD;
User[User Request]
CloudFront[CloudFront CDN]
S3Media[S3 Media Bucket]
StaticAssets[S3 StaticAssets Bucket]
ALB[Application Load Balancer]
ECS[ECS Fargate - Django CMS/API]
RDS[Aurora PostgreSQL]
OpenSearch[Amazon OpenSearch]
Firebase[Firebase / Push Services]
SurveyMonkey[SurveyMonkey API]
Secrets[Secrets Manager / SSM]
User --> CloudFront --> S3Media
User --> CloudFront --> StaticAssets
User --> ALB --> ECS --> RDS
ECS --> OpenSearch
ECS --> S3Media
ECS --> Firebase
ECS --> SurveyMonkey
ECS --> Secrets
Components
Applications
- Repo: weightloss-cms-iac – Django CMS for the app.
Infrastructure as Code
- Repo: weightloss-iac – Terraform modules that infrastructure.
Environments
| Environment | URL | Notes |
|---|---|---|
| Production | https://weightloss-cms-prod.phedigital.co.uk | Static assets served from https://cdn.weightloss-cms-prod.phedigital.co.uk. |
| Staging | https://weightloss-cms-stg.phedigital.co.uk | Mirrors production integrations; CDN https://cdn.weightloss-cms-stg.phedigital.co.uk. |
| Dev | https://weightloss-cms-dev.phedigital.co.uk | First landing-zone account; CDN https://cdn.weightloss-cms-dev.phedigital.co.uk. |
DNS Overview
Every environment manages two Route 53 hosted zones inside its AWS account: one for the CMS hostname (weightloss-cms-<env>.phedigital.co.uk) that ALIASes the environment’s ALB, and one for the CDN hostname (cdn.<env>.weightloss.phedigital.co.uk) that ALIASes the CloudFront distribution (issued out of us-east-1). The root phedigital.co.uk zone in the phe-prd account delegates both hostnames to the environment accounts.
Subdomains:
- weightloss-cms-prd.phedigital.co.uk / -stg / -dev – CMS and API entrypoints (ALB).
- cdn.weightloss-cms-prod.phedigital.co.uk / cdn.weightloss-cms-stg.phedigital.co.uk / cdn.weightloss-cms-dev.phedigital.co.uk – CloudFront distributions that front the S3 media bucket.
graph TD
subgraph PHE_PRD[phedigital.co.uk – phe-prd account]
ROOT[phedigital.co.uk Root Zone]
end
subgraph DEV_ACC[dev account]
DEV_CMS[weightloss-cms-dev.phedigital.co.uk]
DEV_CDN[cdn.weightloss-cms-dev.phedigital.co.uk]
ALB_DEV[ALB - dev]
CF_DEV[CloudFront - dev]
end
subgraph STG_ACC[stg account]
STG_CMS[weightloss-cms-stg.phedigital.co.uk]
STG_CDN[cdn.weightloss-cms-stg.phedigital.co.uk]
ALB_STG[ALB - stg]
CF_STG[CloudFront - stg]
end
subgraph PRD_ACC[prd account]
PRD_CMS[weightloss-cms-prd.phedigital.co.uk]
PRD_CDN[cdn.weightloss-cms-prod.phedigital.co.uk]
ALB_PRD[ALB - prd]
CF_PRD[CloudFront - prd]
end
ROOT -->|NS| DEV_CMS
ROOT -->|NS| STG_CMS
ROOT -->|NS| PRD_CMS
ROOT -->|NS| DEV_CDN
ROOT -->|NS| STG_CDN
ROOT -->|NS| PRD_CDN
DEV_CMS --> ALB_DEV
STG_CMS --> ALB_STG
PRD_CMS --> ALB_PRD
DEV_CDN --> CF_DEV
STG_CDN --> CF_STG
PRD_CDN --> CF_PRD
If a hosted zone is recreated, update the NS entries held in the phe-prd root zone so delegation stays correct.