TruthLens infrastructure is built on Google Cloud Platform using modern cloud-native services for scalability, cost-efficiency, and reliability.
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ PWA Frontend │ │ API Gateway │ │ Cloud Run │
│ (Firebase) │◄──►│ (Google) │◄──►│ (Backend) │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│
┌─────────────────┐ │
│ Vertex AI │◄─────────────┤
│ Gemini │ │
└─────────────────┘ │
│
┌─────────────────┐ │
│ Fact Check │◄─────────────┤
│ API │ │
└─────────────────┘ │
│
┌─────────────────┐ ┌─────────────────┐ │
│ BigQuery │ │ Cloud Storage │◄─────────────┘
│ (Logs) │ │ (Evidence) │
└─────────────────┘ └─────────────────┘
- Cloud Run: Serverless container platform for API
- API Gateway: Managed API gateway for routing and security
- Vertex AI: Gemini 1.5-flash for fact verification
- Google Fact Check API: External fact-checking database
- Cloud Storage: Evidence storage with lifecycle policies
- BigQuery: Structured logging and analytics
- Secret Manager: API keys and sensitive configuration
- IAM: Service account permissions
- Cloud Logging: Application logs
- Cloud Monitoring: Metrics and alerting
- Uptime Checks: Service availability monitoring
All infrastructure is defined in Terraform for reproducibility:
cd infra/terraform
terraform init
terraform plan
terraform applyAutomated CI/CD pipeline for deployments:
gcloud builds submit --config infra/cloudbuild.yamlGOOGLE_CLOUD_PROJECT: GCP Project IDGOOGLE_CLOUD_LOCATION: GCP RegionSTORAGE_BUCKET: Cloud Storage bucket nameBIGQUERY_DATASET: BigQuery dataset IDBIGQUERY_TABLE: BigQuery table ID
truthlens-api-key: API authentication keyfact-check-api-key: Google Fact Check API key
- GCP Project with billing enabled
- gcloud CLI installed and authenticated
- Required APIs enabled
./scripts/deploy.sh# 1. Enable APIs
gcloud services enable run.googleapis.com cloudbuild.googleapis.com
# 2. Deploy infrastructure
cd infra/terraform
terraform apply
# 3. Deploy API
cd ../../api
gcloud builds submit --tag gcr.io/PROJECT_ID/truthlens-api
gcloud run deploy truthlens-api --image gcr.io/PROJECT_ID/truthlens-api
# 4. Deploy PWA
cd ../app
npm run build
firebase deploy- Request Rate: Requests per second
- P95 Latency: 95th percentile response time
- Error Rate: Error percentage
- Cost Metrics: Cost per 1K queries
- Verdict Distribution: Distribution of verification results
- High Latency: P95 > 3 seconds
- High Error Rate: Error rate > 2%
- Service Down: Uptime check failures
- Request Logs: All API requests logged to BigQuery
- Error Logs: Application errors in Cloud Logging
- Audit Logs: Security and access logs
- Min Instances: 0 (scale to zero)
- Max Instances: 10
- Concurrency: 100 requests per instance
- Images: Deleted after 14 days
- Logs: Deleted after 30 days
- Responses: Deleted after 30 days
- Fast Mode: AI-only verification (~$0.001/request)
- Deep Mode: AI + Fact Check (~$0.005/request)
- Image Processing: Additional $0.002/image
- API Keys: Bearer token authentication
- Service Accounts: IAM-based permissions
- CORS: Configured for specific origins
- Encryption: All data encrypted at rest and in transit
- PII: User data anonymized with hashing
- Retention: Automatic data deletion policies
- HTTPS: All traffic encrypted
- API Gateway: Managed security layer
- VPC: Private network configuration (optional)
- BigQuery: Automatic backups
- Cloud Storage: Versioning enabled
- Secrets: Replicated across regions
- Multi-region: Deploy to multiple regions
- Cross-region: Data replication
- RTO: 5 minutes (Cloud Run cold start)
- RPO: 1 hour (BigQuery replication)
- Auto-scaling: Based on request volume
- Load Balancing: API Gateway handles distribution
- Regional Deployment: Deploy to multiple regions
- CPU: Up to 2 vCPUs per instance
- Memory: Up to 2GB per instance
- Concurrency: Up to 100 requests per instance
- API: Rolling updates via Cloud Run
- Infrastructure: Terraform apply
- Monitoring: Automatic updates
- Health Checks: Automated uptime monitoring
- Performance: Latency and throughput metrics
- Cost: Daily cost reports
- API Timeout: Increase Cloud Run timeout
- High Latency: Check Vertex AI quotas
- Authentication: Verify API keys in Secret Manager
- Storage: Check bucket permissions
# Check Cloud Run logs
gcloud logs read --service=truthlens-api
# Check API Gateway status
gcloud api-gateway gateways describe truthlens-gateway
# Check BigQuery data
bq query "SELECT * FROM truthlens_logs.verification_requests LIMIT 10"- Documentation: https://docs.truthlens.app/infrastructure
- Issues: https://github.com/truthlens/infrastructure/issues
- Email: infrastructure@truthlens.app