BERT Application Overview
Base Environment for Re-tooled Technology
BERT is Path2Response’s unified backend and frontend application platform. It’s a TypeScript monorepo containing AWS CDK infrastructure, a React frontend, and an API generation layer that maintains synchronized contracts between frontend and backend.
Origin & Naming
Named: August 2023 Submitted by: Wells Selection: Executive team vote following company-wide naming contest
Name Inspiration
-
Albert Einstein — Championed the pursuit of a unified field theory, merging “seemingly un-mergable knowledge of the universe into a new paradigm, facilitating all kinds of good new pursuits/iterations and breakthroughs.”
-
Sesame Street — Bert (short for Albert) enables a naming convention for related tools: Ernie, Big Bird, Oscar, etc.
Purpose
BERT serves as the consolidation target for legacy systems and provides:
- Job Management - 25+ job types for data processing workflows
- Model Runs - Data science model execution and monitoring
- Order Fulfillment - End-to-end order processing workflows
- Jira Integration - Bidirectional sync with Jira for operations
- Reporting & Dashboards - Business intelligence and metrics
- Data Management - Client, title, and audience management
Target Users: Data Scientists, Operations, Developers, Stakeholders
Migration Status
BERT incorporates and will incorporate the following internal applications:
| Module | Function | Migration Status |
|---|---|---|
| Order App | Order entry and campaign management | ✅ Migrated (Shipment in progress) |
| Data Tools | Data processing utilities | Planned |
| Dashboards | Reporting and analytics | Planned (serverless plan exists) |
| Response Analysis | Campaign response measurement | Planned |
Order App Migration
Order App functionality has been migrated to BERT. The legacy orders deployment remains operational while final functionality is ported:
| Functionality | Status |
|---|---|
| Order entry | ✅ In BERT |
| Order processing | ✅ In BERT |
| Queue management | ✅ In BERT |
| Shipment | 🔄 In progress (last remaining) |
Architecture
Monorepo Structure
/bert/
├── api-generation/ # API contract generation engine (TypeScript)
├── cdk/ # AWS CDK infrastructure & Lambda functions
├── react-frontend/ # React SPA frontend
├── scripts/ # Deployment & utility scripts
├── common-shared/ # Shared types (symlinked to react-frontend)
└── package.json # Root workspace orchestration
Version: 335.0.0-SNAPSHOT Node Requirements: Node ~24, npm ~11
Technology Stack
| Layer | Technologies |
|---|---|
| Frontend | React 19.2, TypeScript, Material-UI 7.3, Redux, React Router |
| Backend | Node.js, TypeScript, AWS CDK 2.233, AWS Lambda, API Gateway |
| Database | MongoDB 7.0 (Atlas hosted) |
| Infrastructure | AWS VPC, EFS, S3, CloudFront, Cognito, SQS, SNS |
| CI/CD | AWS CodePipeline, CodeBuild, CodeStar, Bitbucket |
| Testing | Jest, React Testing Library (90% coverage threshold) |
Core Components
1. CDK Backend (/cdk/)
AWS CDK infrastructure-as-code containing Lambda functions and serverless orchestration.
Entry Point: bin/bert-app.ts
Two CDK Stacks:
- BertAppStack - Application infrastructure
- BertAppCodePipelineStack - CI/CD pipeline
Primary Constructs:
| Construct | Purpose |
|---|---|
| BertAppSecrets | AWS Secrets (Mongo, Slack, Dashboards, Jira) |
| P2RUserPool | Cognito User Pool with Google OIDC |
| BertAppCognitoApi | API Gateway, Lambdas, WAF, monitoring |
| BertAppCloudfront | S3 + CloudFront for frontend |
| BertAppProcessingQueues | SQS FIFO queues for async jobs |
| BertAppEventRules | CloudWatch Events for scheduled tasks |
| BertAppEmailTemplates | SES email templates |
API Endpoints: 38+ namespaces in /cdk/api/proxy-mongo-backed-readonly/endpoints/:
| Namespace | Purpose |
|---|---|
admin/ | Administrative functions |
cache/ | Cache management |
clients/ | Client operations |
digitalaudience/ | Digital audience management |
fulfillment/ | Fulfillment workflows |
job/ | Job management (25+ job types) |
jira/ | Jira integration |
mail/ | Mail calendar & operations |
model/ | Model runs |
order/ | Order processing |
queue/ | Job queue operations |
recency/ | Recency analysis |
scheduler/ | Event scheduling |
shipment/ | Shipment tracking |
title/ | Title/program management |
workflow/ | Workflow execution |
2. React Frontend (/react-frontend/)
Single Page Application built with React and Material-UI.
Entry Point: src/index.tsx
Application Providers:
- Redux store
- AWS configuration
- Cognito authentication
- User preferences
- Alerts & notifications
- Dark mode theming
44 Page Routes including:
- Dashboards, Queue, Scheduler
- Orders, Fulfillments, Shipments
- Digital Audiences, Title Management
- Recency Analysis, Model Runs
- Admin, Preferences, Alerts
- API Debug (developers)
- Jira Sync Status
Component Organization:
| Directory | Purpose |
|---|---|
components/ | 20+ component subdirectories |
pages/ | 44 route components |
lib/ | Utility functions |
hooks/ | Custom React hooks |
store/ | Redux slices + context providers |
themes/ | Material-UI themes |
3. API Generation (/api-generation/)
Maintains single source of truth for API contracts, preventing frontend/backend type mismatches.
Workflow:
- Define - API contract in
react-frontend/src/common-shared/api/definitions/ - Generate - Run
npm run generatefrom root - Generated Artifacts:
common-shared/api/gen/- Shared types & validationreact-frontend/src/lib/api/gen/- Frontend API clientcdk/api/proxy-mongo-backed-readonly/gen/- Backend routing
- Implement - Lambda handler at
cdk/api/.../endpoints/{namespace}/{function}/handler.ts
Infrastructure
Authentication
- Cognito User Pool with Google OIDC social login
- JWT tokens for API authorization
- Cognito App Client tied to CloudFront
Networking
- CloudFront - CDN for frontend (OAI-protected S3)
- API Gateway - REST API with Cognito authorizer
- WAF - Web Application Firewall (VPN CIDR restricted)
- VPC - Private Lambda subnets whitelisted on MongoDB Atlas
Data Storage
- MongoDB Atlas - Primary database (external)
- EFS - Elastic File System for Lambda file processing
- S3 - Frontend hosting + caching
Async Processing
- SQS FIFO Queues - Background job processing
- EventBridge - Scheduled tasks (cron)
- Step Functions - Workflow orchestration
Monitoring
- CloudWatch Logs - API and Lambda execution
- CloudWatch Alarms - Operational alerts
- Slack Integration - Pipeline notifications
Server Deployments
| Environment | BERT Deployment | Legacy Orders |
|---|---|---|
| Production | bert (prod02) | orders (orders legacy) |
| Dev/Staging | bert-staging (dev02) | orders-staging |
| RC | bert-rc (rc02) | orders-rc |
Development Workflows
Build & Deploy (Full)
npm run reinstall-full # Full reinstall + lint + build
npm run build # Build all layers
npm run test # Run all tests
npm run synth # Generate CloudFormation
npm run deploy # Build and deploy to AWS
Local Frontend Development
npm run deploy-local-dev # Gets aws_config.json from deployed stack
cd react-frontend/
npm start # Dev server on localhost:3000
Frontend connects to deployed backend - fast UI iteration without CDK deploy.
Adding a New API
- Define contract in
react-frontend/src/common-shared/api/definitions/{namespace}/{fn}.ts - Run
npm run generatefrom root - Implement handler at
cdk/api/.../endpoints/{namespace}/{fn}/handler.ts - Frontend uses:
import { fn } from "@lib/api/gen/..."
Branch-Based Deployment
Each Git branch deploys as a separate CloudFormation stack:
- Push to
feature-xyz→ deploysBertAppStack-feature-xyz - Separate URL, separate resources
- Clean up via
cdk destroywhen done
Configuration
AWS Secrets (Secrets Manager)
| Secret | Purpose |
|---|---|
| BertAppSlack | Slack API credentials |
| BertAppMongo | MongoDB Atlas connection |
| DashboardsConnection | Dashboards integration |
| BertAppJira | Jira API credentials |
| BertAppIdentityProvider | Google OIDC config |
Frontend Config (aws_config.json)
Injected at deployment with stack outputs:
{
"DEPLOY_STACK_ID": "...",
"MAINTENANCE_MODE": false,
"COGNITO_AUTH_BASE_URL": "...",
"API_BASE_URL": "https://...execute-api.../prod/",
"BRANCH_NAME": "...",
"CLOUDFRONT_URL": "..."
}
Key Integrations
| System | Integration |
|---|---|
| MongoDB Atlas | Primary data store |
| Jira | Bidirectional sync via jira.js |
| Slack | Notifications via @slack/web-api |
| Dashboards | Data exchange (targeted for migration INTO BERT) |
| Data Tools | Data exchange (targeted for migration INTO BERT) |
| AWS Batch | Heavy compute jobs |
| SES | Email notifications |
Related Documentation
- Dashboards Overview - Legacy system with migration plan
- Data Tools Overview - Legacy data processing
- Project Inventory - Complete P2R codebase inventory
- Tools and Systems - Overview of all P2R tools
- Path2Acquisition Flow - How BERT modules fit in the data flow
Important Notes
- Type Safety - Full end-to-end TypeScript from API definitions through Lambda implementations
- Branch Isolation - Each branch deploys as separate stack (clean up unused branches to control costs)
- MongoDB Atlas - Requires VPN/whitelisted IPs for Lambda access
- Memory Requirements - TypeScript compilation needs 4GB allocation
- Test Coverage - 90% threshold enforced
- Shiny → DRAX - Legacy Shiny Reports have been ported to DRAX reports
Source: /Users/mpelikan/Documents/code/p2r/bert (README.md, cdk/README.md, react-frontend/README.md, api-generation/README.md, .amazonq/rules/memory-bank/) Documentation created: 2026-01-24