Ecosystem Integration Guide
Comprehensive guide for integrating and managing the Toto ecosystem components.
π Ecosystem Architectureβ
Component Overviewβ
The Toto ecosystem consists of multiple interconnected projects, each serving specific purposes while maintaining a unified architecture:
Core Components:
- toto-app: Main pet rescue application
- toto-bo: Backoffice management system
- toto-ai-hub: AI-powered assistance system
- toto-wallet: Blockchain payment processing
Integration Strategyβ
1. Unified Authentication
- Single sign-on across all components
- Shared user profiles and permissions
- Centralized role management
- Cross-project token validation
2. Data Synchronization
- Real-time data updates across components
- Event-driven architecture for changes
- Consistent data models and validation
- Firestore listeners for live data
3. API Integration
- RESTful APIs for data exchange
- Centralized API management
- Rate limiting and security
- Monitoring and analytics
π Firebase Project Separationβ
Current Architectureβ
Project Structure:
toto-f9d2f/ # Main application
βββ Authentication
βββ Firestore Database
βββ Storage
βββ Functions
toto-bo/ # Backoffice system
βββ Authentication
βββ Firestore Database
βββ Storage
βββ Functions
toto-ai-hub/ # AI system (App Hosting)
βββ Backend Service
βββ Monitoring
Benefits of Separationβ
Security:
- Isolated access controls per project
- Granular permission management
- Reduced attack surface
Scalability:
- Independent scaling per component
- Resource allocation optimization
- Performance isolation
Maintenance:
- Easier project management
- Independent deployments
- Simplified troubleshooting
Cost Control:
- Separate billing and quotas
- Resource usage tracking
- Budget allocation per component
π Integration Patternsβ
1. Cross-Project Communicationβ
Event-Driven Architecture:
- Event bus for cross-project communication
- Real-time event publishing and subscription
- Decoupled component interactions
Real-Time Updates:
- Firestore listeners for live data synchronization
- Cross-project data sync
- Automatic UI updates
2. Shared Data Modelsβ
Common Interfaces:
- Standardized data structures across projects
- Consistent validation rules
- Type-safe data exchange
Data Validation:
- Schema validation using Zod
- Input sanitization
- Type checking
3. API Integrationβ
Centralized API Client:
- Unified API client for all projects
- Authentication token management
- Error handling and retry logic
API Endpoints:
- Main App:
https://app.betoto.pet/api - Backoffice:
https://bo.betoto.pet/api - AI Hub:
https://toto-ai-hub-backend--toto-ai-hub.us-central1.hosted.app
π Data Synchronizationβ
1. Real-Time Updatesβ
Firestore Listeners:
- Real-time collection listeners
- Document-level synchronization
- Automatic cleanup on unmount
Cross-Project Data Sync:
- Main app to backoffice case synchronization
- Backoffice updates to main app
- Event-driven updates
2. Event Sourcingβ
Event Store:
- Immutable event log
- Event versioning
- Aggregate reconstruction
π Security & Access Controlβ
1. Cross-Project Authenticationβ
Token Sharing:
- JWT token validation across projects
- Token expiration management
- Secure token refresh
Permission Validation:
- Role-based access control
- Cross-project permission checks
- Granular permission management
2. Data Protectionβ
Security Measures:
- Field-level encryption for sensitive data
- Secure data transmission
- Access logging and audit trails
π Monitoring & Analyticsβ
Cross-Project Metricsβ
Performance Monitoring:
- Request count tracking
- Response time metrics
- Error rate monitoring
- Active user tracking
Error Tracking:
- Centralized error logging
- Error severity classification
- Project-specific error filtering
π Support & Troubleshootingβ
Common Integration Issuesβ
1. Authentication Problems:
- Verify cross-project token sharing
- Check service account permissions
- Validate token expiration
2. Data Synchronization Issues:
- Check Firestore security rules
- Verify cross-project access permissions
- Validate data model consistency
3. Performance Issues:
- Monitor API response times
- Check database query performance
- Review Firestore indexes
Health Checksβ
Project Health Monitoring:
- Health check endpoints per project
- Overall ecosystem health status
- Automated health monitoring
π Related Resourcesβ
- Ecosystem Overview - High-level ecosystem overview
- Architecture Documentation - System architecture
- API Reference - Complete API documentation
- Deployment Guide - Deployment instructions
Last Updated: January 2025
Status: Production Ready