Skip to main content

Radar Backend Architecture

Overview

Radar is a proactive AI insights system that runs scheduled prompts for users. The system executes financial analysis on a schedule (daily/weekly/monthly/custom) and stores results for users to review later. Key Features:
  • Scheduled execution of AI prompts (portfolio analysis, spending alerts, goal tracking)
  • Single daily EventBridge trigger with smart filtering
  • Scalable architecture supporting millions of users
  • Pre-calculated next_run timestamps for efficient querying
  • Cost-effective (~$5-10/month for 10K users)

System Flow

Daily Execution:
  1. EventBridge triggers Orchestrator at 6am UTC
  2. Orchestrator queries DynamoDB for schedules with next_run_date = today
  3. Matching schedules are sent to SQS FIFO queue (grouped by user_id)
  4. Processor Lambda consumes queue, executes AI prompts with user financial data
  5. Results stored in DynamoDB, next_run updated for next occurrence

Technical Diagram


Data Models

DynamoDB Table: radar_schedules

GSI: next_run_date-index
  • Partition Key: next_run_date (string, format: YYYY-MM-DD)
  • Enables efficient query: “Find all schedules due today”

DynamoDB Table: radar_results


File Structure


Lambda Functions

Orchestrator Lambda

Trigger: EventBridge (daily at 6am UTC)
Purpose: Query schedules due today and send to SQS

Processor Lambda

Trigger: SQS FIFO Queue
Purpose: Execute AI prompts and store results

CDK Infrastructure

Key Resources


Frontend Integration

API Routes

Components


Schedule Configuration Examples

Daily Schedule

Weekly Schedule

Monthly Schedule

Custom Schedule


Cost Estimation

Assumptions: 10,000 active users, mix of daily/weekly schedules

Performance Metrics

  • Orchestrator execution time: ~750ms for 10K users
  • Queue processing: ~3,770 jobs/day = ~2.6 jobs/minute
  • Processor execution time: 10-30 seconds per job (AI call)
  • End-to-end latency: 1-5 minutes from trigger to result stored

Monitoring & Alerts

CloudWatch Metrics

  • Orchestrator invocation count & duration
  • Processor invocation count & duration
  • SQS queue depth & age of oldest message
  • DynamoDB read/write capacity utilization

CloudWatch Alarms

  • Processor error rate > 5%
  • DLQ message count > 0
  • Queue depth > 1000 messages
  • Lambda timeout errors

Deployment


Future Enhancements

  1. Multiple daily triggers - Add 12pm, 6pm, 12am UTC for timezone flexibility
  2. Priority queue - Separate queue for urgent alerts vs routine checks
  3. Real-time notifications - Push notifications when high-priority radar completes
  4. Radar templates - Pre-built radar types users can enable with one click
  5. AI-powered scheduling - “Analyze my portfolio when volatility spikes”