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_runtimestamps for efficient querying - Cost-effective (~$5-10/month for 10K users)
System Flow
- EventBridge triggers Orchestrator at 6am UTC
- Orchestrator queries DynamoDB for schedules with
next_run_date = today - Matching schedules are sent to SQS FIFO queue (grouped by user_id)
- Processor Lambda consumes queue, executes AI prompts with user financial data
- Results stored in DynamoDB,
next_runupdated for next occurrence
Technical Diagram
Data Models
DynamoDB Table: radar_schedules
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 QueuePurpose: 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 schedulesPerformance 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
- Multiple daily triggers - Add 12pm, 6pm, 12am UTC for timezone flexibility
- Priority queue - Separate queue for urgent alerts vs routine checks
- Real-time notifications - Push notifications when high-priority radar completes
- Radar templates - Pre-built radar types users can enable with one click
- AI-powered scheduling - “Analyze my portfolio when volatility spikes”