Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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

  1. 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.”

  2. 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:

ModuleFunctionMigration Status
Order AppOrder entry and campaign management✅ Migrated (Shipment in progress)
Data ToolsData processing utilitiesPlanned
DashboardsReporting and analyticsPlanned (serverless plan exists)
Response AnalysisCampaign response measurementPlanned

Order App Migration

Order App functionality has been migrated to BERT. The legacy orders deployment remains operational while final functionality is ported:

FunctionalityStatus
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

LayerTechnologies
FrontendReact 19.2, TypeScript, Material-UI 7.3, Redux, React Router
BackendNode.js, TypeScript, AWS CDK 2.233, AWS Lambda, API Gateway
DatabaseMongoDB 7.0 (Atlas hosted)
InfrastructureAWS VPC, EFS, S3, CloudFront, Cognito, SQS, SNS
CI/CDAWS CodePipeline, CodeBuild, CodeStar, Bitbucket
TestingJest, 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:

ConstructPurpose
BertAppSecretsAWS Secrets (Mongo, Slack, Dashboards, Jira)
P2RUserPoolCognito User Pool with Google OIDC
BertAppCognitoApiAPI Gateway, Lambdas, WAF, monitoring
BertAppCloudfrontS3 + CloudFront for frontend
BertAppProcessingQueuesSQS FIFO queues for async jobs
BertAppEventRulesCloudWatch Events for scheduled tasks
BertAppEmailTemplatesSES email templates

API Endpoints: 38+ namespaces in /cdk/api/proxy-mongo-backed-readonly/endpoints/:

NamespacePurpose
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:

DirectoryPurpose
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:

  1. Define - API contract in react-frontend/src/common-shared/api/definitions/
  2. Generate - Run npm run generate from root
  3. Generated Artifacts:
    • common-shared/api/gen/ - Shared types & validation
    • react-frontend/src/lib/api/gen/ - Frontend API client
    • cdk/api/proxy-mongo-backed-readonly/gen/ - Backend routing
  4. 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

EnvironmentBERT DeploymentLegacy Orders
Productionbert (prod02)orders (orders legacy)
Dev/Stagingbert-staging (dev02)orders-staging
RCbert-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

  1. Define contract in react-frontend/src/common-shared/api/definitions/{namespace}/{fn}.ts
  2. Run npm run generate from root
  3. Implement handler at cdk/api/.../endpoints/{namespace}/{fn}/handler.ts
  4. Frontend uses: import { fn } from "@lib/api/gen/..."

Branch-Based Deployment

Each Git branch deploys as a separate CloudFormation stack:

  • Push to feature-xyz → deploys BertAppStack-feature-xyz
  • Separate URL, separate resources
  • Clean up via cdk destroy when done

Configuration

AWS Secrets (Secrets Manager)

SecretPurpose
BertAppSlackSlack API credentials
BertAppMongoMongoDB Atlas connection
DashboardsConnectionDashboards integration
BertAppJiraJira API credentials
BertAppIdentityProviderGoogle 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

SystemIntegration
MongoDB AtlasPrimary data store
JiraBidirectional sync via jira.js
SlackNotifications via @slack/web-api
DashboardsData exchange (targeted for migration INTO BERT)
Data ToolsData exchange (targeted for migration INTO BERT)
AWS BatchHeavy compute jobs
SESEmail notifications


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