This chapter transforms our multimodal chat application into Project Pastra - a mobile-friendly web application deployed on Cloud Run. Inspired by Google DeepMind's Project Astra (a research prototype exploring future capabilities of universal AI assistants), our application demonstrates how to create a production-ready, mobile-first AI assistant experience.
- Responsive Layout: Optimized for both mobile and desktop viewing
- Touch-Friendly Controls: Redesigned buttons and interactions for mobile use
- Floating Action Button (FAB): Easy-to-reach microphone control
- Status Indicators: Clear visual feedback for system state
- Modern Material Design: Enhanced visual aesthetics and usability
- Containerization: Docker configuration for cloud deployment
- HTTPS Support: Secure communication for media access
- Environment Variables: Secure API key management
- Cloud Build Integration: Automated deployment pipeline
- Scalability: Automatic scaling based on demand
- Connection Status Handler: Real-time feedback on system state
- Loading States: Visual indicators for processing
- Error Handling: User-friendly error messages
- Progressive Enhancement: Graceful fallbacks for unsupported features
# Key components of our Dockerfile
FROM node:18-slim
WORKDIR /app
COPY . .
ENV PORT=8080
CMD ["node", "server.js"]
The new status-handler.js
provides real-time feedback for:
- Connection state
- Media permissions
- Processing status
- Error conditions
Project Pastra retains and enhances all features from chapters 6 and 7:
- Real-time audio/video chat
- Function calling capabilities
- System instructions
- Weather, search, and code execution tools
- Screen sharing and webcam support
index.html
: Mobile-optimized UI implementationstyle.css
: Enhanced mobile-first stylingstatus-handler.js
: Connection and state managementDockerfile
: Container configurationshared/
: Common components and utilities- Media handling
- Audio processing
- WebSocket management
-
Local Development:
docker build -t project-pastra . docker run -p 8080:8080 project-pastra
-
Cloud Run Deployment:
gcloud builds submit --tag gcr.io/PROJECT_ID/project-pastra-dev-api gcloud run deploy project-pastra-dev-api \ --image gcr.io/$PROJECT_ID/project-pastra-dev-api \ --platform managed \ --region us-central1 \ --allow-unauthenticated
-
Mobile Access:
- Open the deployed URL on your mobile device
- Grant necessary permissions (microphone, camera)
- Tap the FAB to start interacting
-
Desktop Access:
- Works seamlessly on desktop browsers
- Enhanced UI adapts to larger screens
- Full keyboard/mouse support maintained
Project Pastra demonstrates how to transform a development prototype into a production-ready application by focusing on:
- Mobile-first user experience
- Production-grade deployment
- Scalable architecture
- Professional UI/UX design
- Robust error handling
The name "Pastra" (a playful nod to both Project Astra and pasta) reflects our approach: taking inspiration from advanced research prototypes while making the technology accessible and enjoyable for everyday use.