How google-gemini/angular-webxr-art-sample works
Primary Components
• Frontend (Angular Application)
• This is primarily contained in the “src” folder.
• Sub-components include:
• UI components such as “image-gen”, “gallery”, “museum”, “tweet”, “loading”, and a “three” module which handles 3D scene rendering and WebXR interactions.
• Services for AI, speech, artworks, and 3D functionalities.
• Configuration files such as environments and the Angular CLI configuration (angular.json).
• Backend Services
• Python server (located in the “server” directory):
• Contains main.py, requirements.txt, and setup scripts.
• Serves as a proxy to call the Gemini API when running locally or in a cloud environment.
• Cloud Functions Option (Functions/getImages.py):
• Code that can be deployed as a Google Cloud Function to interface with the Gemini API.
• External Services & APIs
• Vertex AI Image Generation:
• Used to generate AI images.
• Gemini Multimodal API:
• Used to generate captions.
• Deployment & Hosting Layer
• Firebase configuration files (.firebaserc, firebase.json, and relevant GitHub workflows) indicate that hosting and continuous deployment are integrated for production environments.
• Testing
• End-to-end tests in the “e2e” directory and Angular unit tests indicated by *.spec.ts files.
Architectural Patterns & Design Principles
• Separation of Concerns:
• Clearly separate UI components from business logic (services) and further from external API integration, aligning with Angular’s modular structure.
• API Gateway / Proxy:
• The Python backend or Cloud Function acts as a mediator for external API calls, ensuring that API keys and credentials remain secure.
• Cloud-First Deployment:
• Use Firebase as the deployment platform for the frontend, with Google Cloud (CLI and Cloud Functions) handling backend operations.
• Testing and CI/CD:
• Mention the existence of automated tests (e2e and Angular unit tests) and workflows defined in GitHub (Firebase deployment configurations).