AI Travel Recommendation App

Value statement: Serverless full-stack application delivering personalized travel recommendations using AWS Bedrock and Claude 3 Sonnet with secure authentication and modern React frontend.

Overview

Built serverless travel recommendation application leveraging AWS Bedrock’s Claude 3 Sonnet LLM for intelligent, context-aware destination suggestions. Users input preferences (budget, activities, climate, travel dates) and receive personalized itineraries with hotels, restaurants, and attractions.

Application demonstrates modern cloud-native architecture with React/TypeScript frontend, AWS Lambda backend, Amazon Cognito authentication, and automated CI/CD via AWS Amplify. Fully serverless design eliminates infrastructure management while providing sub-second response times for AI recommendations.

Goals

Architecture

┌─────────────────────────────────────────────────────────────┐
│ React Frontend │
│ TypeScript | React Router | Material-UI | Axios │
└──────────────────────────┬──────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ AWS Amplify (Hosting + CI/CD) │
│ Automatic deployments from GitHub | CloudFront CDN │
└──────────────────────────┬──────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ Amazon Cognito │
│ User pools | JWT authentication | MFA support │
└──────────────────────────┬──────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ API Gateway (REST API) │
│ JWT authorizer | Request validation | Rate limiting │
└──────────────────────────┬──────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ AWS Lambda Functions │
│ ┌────────────────────────────────────────────────────┐ │
│ │ getRecommendations (Python 3.11) │ │
│ │ Calls Bedrock API with user preferences │ │
│ └────────────────────────────────────────────────────┘ │
│ ┌────────────────────────────────────────────────────┐ │
│ │ saveTrip (Python 3.11) │ │
│ │ Stores user trip history in DynamoDB │ │
│ └────────────────────────────────────────────────────┘ │
└──────────────────────────┬──────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ AWS Bedrock │
│ Claude 3 Sonnet | Streaming responses | Context window │
└──────────────────────────┬──────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ DynamoDB Tables │
│ user_trips | preferences | conversation_history │
└─────────────────────────────────────────────────────────────┘

Technology Stack

LayerTechnologies
FrontendReact 18, TypeScript, Material-UI
State ManagementReact Context API, React Query
AuthenticationAmazon Cognito (user pools + JWT)
BackendAWS Lambda (Python 3.11), API Gateway
AI/MLAWS Bedrock (Claude 3 Sonnet)
DatabaseAmazon DynamoDB (NoSQL)
HostingAWS Amplify (CloudFront + S3)
CI/CDAWS Amplify, GitHub Actions
InfrastructureAWS SAM, CloudFormation

Implementation Details

AWS Bedrock + Claude 3 Sonnet Integration: Lambda function invokes Bedrock API with structured prompts:

response = bedrock_runtime.invoke_model(
modelId='anthropic.claude-3-sonnet-20240229-v1:0',
body=json.dumps({
"prompt": prompt_template,
"max_tokens": 2000,
"temperature": 0.7,
"top_p": 0.9
})
)

Prompt engineering includes:

React/TypeScript Frontend: Modern React application with:

Amazon Cognito Authentication: Secure user management with:

Lambda Backend Functions: Serverless Python functions handling:

Amplify CI/CD Pipeline: Automated deployment workflow:

  1. Push to main branch triggers build
  2. Amplify builds React app (npm run build)
  3. Runs tests and linting
  4. Deploys to CloudFront + S3
  5. Updates Lambda functions via SAM template
  6. Invalidates CloudFront cache

Features & Capabilities

AI-Powered Recommendations:

User Experience:

Technical Features:

Performance & Cost

MetricValue
Response Time2-4 seconds (Bedrock inference)
Cold Start<500ms (Lambda with SnapStart)
Concurrent Users1000+ (Lambda auto-scaling)
Monthly Cost$15-30 (100-200 recommendations/month)
Bedrock Cost$0.015 per 1000 input tokens
Lambda Cost$0.20 per 1M requests (free tier)

Reliability & Edge Cases

Lessons Learned

Prompt engineering is critical: Initial prompts produced verbose, unstructured responses. Iterative refinement with output format specifications and examples improved quality significantly.

Claude 3 Sonnet vs Haiku: Started with Haiku for cost savings but switched to Sonnet for better reasoning and context understanding. Cost increase (2x) justified by quality improvement.

Streaming responses improve UX: Implemented response streaming so users see partial results immediately rather than waiting 4 seconds for complete response. Perceived latency reduced by 70%.

DynamoDB single-table design: Over-normalized schema caused multiple queries per request. Consolidated to single table with GSIs which reduced latency from 300ms to 50ms.

Amplify simplifies DevOps: Compared to manual CloudFront/S3/Lambda setup, Amplify reduced deployment complexity by 80% while providing preview environments and atomic deployments.

Future Improvements