[WIP] MVP Architecture
[!note] Document Purpose: Comprehensive technical architecture documentation for the AarogyaDost MVP platform
Audience: Developers, architects, technical stakeholders Related: [[README|MVP Overview]] | [[aws-infrastructure-report|AWS Infrastructure]] | [[DEPLOYMENT_STATUS|Deployment Status]]
🎯 Architecture Principles
Design Philosophy
Separation of Concerns: Frontend, backend, and infrastructure are independently deployable
API-First: RESTful API design with comprehensive documentation
Cloud-Native: Leverages AWS managed services for scalability and reliability
Mobile-Ready: Responsive web design + native mobile app support
Developer Experience: Fast local development, automated deployments
Cost-Effective: Optimized for AWS Free Tier and startup budgets
Key Architectural Decisions
Frontend Framework
React + TypeScript
Modern, type-safe, large ecosystem
Build Tool
Vite
Fast dev server, optimized builds
Backend Framework
FastAPI (Python)
Fast, async, auto-generated API docs
Deployment
AWS Amplify + Elastic Beanstalk
Managed services, auto-scaling, low ops
Data Storage
In-memory (MVP)
Fast prototyping, future: PostgreSQL/DynamoDB
Authentication
Planned (OAuth 2.0 + JWT)
Industry standard, secure
Mobile
React Native + Expo
Code reuse, rapid development
🏗️ System Architecture Diagram
High-Level Architecture
🔄 Data Flow Architecture
User Request Flow
Health Dashboard Flow (Example)
🗄️ Data Models
Health Data Models
Biomarker Category
Health Metric
AI Chat Message
Healthcare Provider
Medical File
🔌 API Architecture
RESTful API Design
Base URLs:
Production:
https://api.arogyadost.inDevelopment:
https://api-dev.arogyadost.in
API Endpoints Structure:
API Request/Response Format
Standard Response Envelope:
Error Response:
API Documentation
Swagger UI:
/docs- Interactive API explorerReDoc:
/redoc- Clean API referenceOpenAPI Spec: Auto-generated from FastAPI type hints
🔐 Security Architecture
Authentication & Authorization (Planned)
Current Security Measures
Transport
HTTPS/TLS 1.3
✅ Implemented
API
CORS Configuration
✅ Implemented
Infrastructure
VPC, Security Groups
✅ Implemented
Secrets
Environment Variables
✅ Implemented
Authentication
OAuth 2.0 + JWT
🔄 Planned
Data Encryption
At-rest encryption
🔄 Planned
Rate Limiting
API throttling
🔄 Planned
Audit Logs
User activity logging
🔄 Planned
CORS Configuration
Allowed Origins:
Allowed Methods: GET, POST, PUT, DELETE, OPTIONS Allowed Headers: Content-Type, Authorization, Accept
📊 State Management Architecture
Frontend State Management
React Query (TanStack Query)
Cache Strategy:
Stale Time: 5 minutes (health data)
Cache Time: 10 minutes (inactive data)
Retry: 3 attempts with exponential backoff
Refetch: On window focus, network reconnect
Backend State Management
In-Memory Store (MVP)
Biomarker data: Preloaded static data
Chat history: In-memory dict (ephemeral)
Medical files: Mock data
Future: Migrate to PostgreSQL/DynamoDB
🚀 Deployment Architecture
Frontend Deployment (AWS Amplify)
Build Settings:
Backend Deployment (Elastic Beanstalk)
Deployment Configuration:
Platform: Python 3.11 on Amazon Linux 2023
Instance: t3.micro (1 vCPU, 1 GB RAM)
Auto-scaling: Single instance (MVP), scalable to multiple
Health check:
/api/health/statusendpointRolling deployment: Zero-downtime updates
📈 Scalability Considerations
Current Architecture (MVP)
Frontend
Amplify CDN
~1M requests/month
None (CDN scales)
Backend
2x t3.micro
~100 concurrent users
Single instance
Database
In-memory
~1K records
Memory size
Storage
S3
Unlimited
None
Future Scaling Strategy
Phase 1 (0-1K Users)
Current architecture sufficient
Monitor performance metrics
Add database (PostgreSQL RDS)
Phase 2 (1K-10K Users)
Auto-scaling group (2-4 t3.small instances)
Application Load Balancer
Redis cache layer
Database read replicas
Phase 3 (10K-100K Users)
Microservices architecture
Separate services for health, chat, files
ElastiCache for session management
CloudFront CDN for static assets
DynamoDB for high-throughput data
Phase 4 (100K+ Users)
Multi-region deployment
Event-driven architecture (SQS, SNS)
ML model serving (SageMaker)
Real-time analytics (Kinesis)
🔍 Monitoring & Observability
Current Monitoring
Application Logs
CloudWatch Logs
✅
Infrastructure Metrics
CloudWatch Metrics
✅
API Health
Custom scripts
✅
Uptime
Manual checks
✅
Costs
AWS Cost Explorer
✅
Planned Monitoring
🔗 Integration Points
Planned Integrations
ABDM (Ayushman Bharat Digital Mission)
Health ID creation and verification
PHR (Personal Health Record) linking
Hospital/clinic data exchange
Lab report ingestion
Wearable Devices
Apple Health / Google Fit integration
Real-time vitals syncing
Activity data import
Telemedicine Platforms
Video consultation integration
Prescription management
Follow-up scheduling
Payment Gateways
Razorpay / Stripe integration
Subscription management
Healthcare provider payments
📝 Technical Debt & Future Work
Known Limitations (MVP)
In-memory data storage - Not persistent across restarts
No authentication - All data publicly accessible
Mock data - Not real user data
Single instance - No high availability
No analytics - No usage tracking
Limited error handling - Basic error responses
Planned Improvements
Short-term (Next 3 Months)
Mid-term (3-6 Months)
Long-term (6-12 Months)
🔗 Related Documentation
[[README|MVP Overview]] - High-level overview and getting started
[[DEPLOYMENT_STATUS|Deployment Status]] - Current deployment health
[[aws-infrastructure-report|AWS Infrastructure]] - Detailed AWS resources and costs
[[arogyadost-backend/API_ARCHITECTURE|Backend Architecture]] - Backend-specific architecture
[[arogyadost-web/WEBSITE_ARCHITECTURE_SUMMARY|Web Architecture]] - Frontend architecture details
Created: 2025-12-29 Last Updated: 2025-12-29 Version: 1.0 Maintained By: Technical Team
[[README|← Back to MVP Overview]]
Last updated