README

TrendDraw

A lottery trend analysis app. It ingests real Mega Millions and Powerball draw results on schedule, computes hot/cold/overdue statistics, and uses Claude to suggest number sets — always disclaimed as entertainment only, never as predictions.

React 19 FastAPI AWS Lambda API Gateway DynamoDB EventBridge Anthropic Claude CloudFront Terraform

What's Inside

Trend Analytics

Hot/cold/overdue frequency stats and frequent-pair detection, computed per game and time window.

AI Picks (Claude)

claude-sonnet-4-5 blends the computed trends into suggested sets with a one-sentence rationale each, always disclaimed as non-predictive.

Backtesting

Every strategy (hot, overdue, cold) is compared against a random baseline, so the app can't quietly overstate its own accuracy.

Draw Alerts

Subscribers opt into email alerts (SES or Resend) fired by the scheduled ingest pipeline, with working unsubscribe tokens.

Architecture Overview

API Lambda (FastAPI + Mangum)

Handles every read/write endpoint behind API Gateway's HTTP API: games, draws, analytics, AI picks, saved picks, subscriptions, backtests.

Ingest Lambda (Scheduled)

Triggered by EventBridge cron rules matched to real draw days. Fetches new results, writes to DynamoDB, and fires subscriber alerts on genuinely new draws.

AWS Resources (Terraform)

Security & Repository Hygiene

Testing

Local Development

Backend:

cd backend
pip install -r requirements.txt
uvicorn server:app --reload

Frontend:

cd frontend
yarn install
yarn start

Deployment

Infrastructure:

cd infra/terraform
terraform init
terraform apply

Frontend (builds and syncs to the portfolio's S3 bucket, then invalidates CloudFront):

cd frontend
yarn build
./deploy.sh
Open App Story Visual Diagram Back to Portfolio