mirror of
https://github.com/imjasonh/meet-ticker
synced 2026-07-07 00:32:48 +00:00
- Built full-stack Meeting Cost Ticker for Google Meet add-ons - Real-time person-minutes/hours tracking with smart unit switching - Google Meet SDK integration with proper session management - OAuth 2.0 authentication flow for Meet API access - Single server architecture (Cloud Function serves frontend + backend) - Responsive UI with 1-second updates for meeting duration - Automatic new meeting detection and reset - Secure configuration with environment variables - Auto-generated workspace deployment manifest 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
7.9 KiB
7.9 KiB
Meeting Cost Ticker - Development & Deployment Guide
Overview
This document outlines the complete development and deployment process for the Meeting Cost Ticker Google Meet add-on.
Architecture
Single Server Design: Both frontend and backend are served from a single Google Cloud Function for simplified deployment and management.
- Frontend: HTML/CSS/JavaScript served as static files
- Backend: Node.js Cloud Function handling OAuth and API requests
- Hosting: Google Cloud Functions Gen2
- Authentication: Google OAuth 2.0 with Meet API access
Prerequisites
- Google Cloud Project with billing enabled
- gcloud CLI installed and authenticated
- Firebase CLI installed (for potential future use)
- Node.js 18+ for local development
Initial Setup
1. Google Cloud Configuration
# Authenticate with Google Cloud
gcloud auth login --update-adc
# Set your project
gcloud config set project PROJECT_ID
# Enable required APIs
gcloud services enable meet.googleapis.com
gcloud services enable appsmarket-component.googleapis.com
gcloud services enable cloudfunctions.googleapis.com
gcloud services enable cloudbuild.googleapis.com
gcloud services enable firebase.googleapis.com
2. OAuth 2.0 Setup
Manual steps in Google Cloud Console:
-
Go to APIs & Services → OAuth consent screen
- Select "External" user type
- App name: "Meeting Cost Ticker"
- User support email: your email
- Add scope:
https://www.googleapis.com/auth/meet.meetings.read - Add your email as Test User
-
Go to APIs & Services → Credentials
- Create OAuth 2.0 Client IDs for "Web application"
- Add authorized redirect URI:
https://REGION-PROJECT_ID.cloudfunctions.net/meet-ticker/oauthcallback
-
Store credentials in
infofile:client id = YOUR_CLIENT_ID client secret = YOUR_CLIENT_SECRET
Project Structure
meet-ticker/
├── index.js # Main Cloud Function (backend + static serving)
├── participants.js # Participant count logic (currently demo)
├── package.json # Node.js dependencies
├── index.html # Frontend UI
├── main.js # Frontend application logic
├── config.js # Frontend configuration
├── styles.css # UI styling
├── meet-ticker.png # App icon
├── deploy.sh # Deployment script
├── workspace-deployment-manifest.json # Google Workspace add-on manifest
├── firebase.json # Firebase configuration (unused)
├── .gitignore # Git ignore rules
├── info # OAuth credentials (not committed)
└── README.md # Project documentation
Key Implementation Details
Frontend Features
-
Smart Unit Switching:
< 1 minute: person-seconds1-59 minutes: person-minutes (whole numbers)≥ 60 minutes: person-hours (whole numbers)
-
Dynamic Update Intervals:
< 3 person-minutes: Updates every second≥ 3 person-minutes: Updates every minute
-
Meet SDK Integration:
- Uses Google Meet add-ons SDK:
https://www.gstatic.com/meetjs/addons/1.1.0/meet.addons.js - Proper initialization sequence:
createAddonSession()→createSidePanelClient() - Automatically starts with 1 participant (current user)
- Uses Google Meet add-ons SDK:
Backend Features
- Single Server Architecture: Serves both frontend static files and API endpoints
- OAuth Flow: Complete authentication flow with token management
- Participant Polling: Hardcoded refresh intervals
- Static File Serving: No-cache headers for development
- Error Handling: Comprehensive error handling and logging
API Endpoints
All served from: https://REGION-PROJECT_ID.cloudfunctions.net/meet-ticker
/- Frontend application/auth- OAuth authentication initiation/oauthcallback- OAuth callback handler/token- Access token retrieval/participants- Participant count API (currently demo mode)/meet-ticker.png- App icon- Static files:
main.js,config.js,styles.css
Deployment Process
1. Install Dependencies
npm install
2. Deploy to Google Cloud Functions
./deploy.sh
This script:
- Deploys a single Cloud Function with both frontend and backend
- Sets environment variables for OAuth credentials
- Configures 512MB memory and 60s timeout
- Uses Node.js 20 runtime
3. Google Workspace Marketplace Configuration
- Go to Google Cloud Console → APIs & Services → Google Workspace Marketplace SDK
- Upload the
workspace-deployment-manifest.jsonfile
Development Workflow
Making Changes
- Edit files in the root directory
- Test locally if needed (optional)
- Deploy with:
./deploy.sh - Test in Google Meet add-on
Debugging
- Cloud Function logs:
gcloud functions logs read meet-ticker --region us-central1 --limit 20 - Browser DevTools: Check console in Meet add-on iframe
- Debug indicator: Green/red status indicator in top-right corner
Cache Management
- No-cache headers set for HTML, CSS, and JS files during development
- Version parameters in script tags (
?v=2) for cache busting - Short cache (5 minutes) for images and other assets
Troubleshooting
Common Issues
-
404 errors for static files
- Check file paths in
index.jsstatic serving logic - Ensure files exist in root directory
- Check file paths in
-
Meet SDK not loading
- Verify SDK URL:
https://www.gstatic.com/meetjs/addons/1.1.0/meet.addons.js - Check browser console for loading errors
- Verify SDK URL:
-
OAuth redirect errors
- Ensure redirect URI matches in Google Cloud Console credentials
- Check
REDIRECT_URIenvironment variable in deployment
-
Add-on manifest errors
- Verify manifest structure follows Google Workspace requirements
- Ensure all URLs are HTTPS and accessible
Key Debugging Commands
# Check deployment status
gcloud functions describe meet-ticker --region us-central1
# View logs
gcloud functions logs read meet-ticker --region us-central1 --limit 30
# Test endpoints
curl -I https://REGION-PROJECT_ID.cloudfunctions.net/meet-ticker
curl -I https://REGION-PROJECT_ID.cloudfunctions.net/meet-ticker/main.js
# Check deployed files
gcloud functions describe meet-ticker --region us-central1 --format="value(sourceArchiveUrl)"
Configuration Values
Environment Variables (set in deploy.sh)
CLIENT_ID: OAuth 2.0 client IDCLIENT_SECRET: OAuth 2.0 client secretREDIRECT_URI: OAuth callback URL
Constants (in main.js)
POLLING_INTERVAL_SECONDS: 20 (participant polling frequency)- Update intervals: 1 second (< 3 person-minutes), 60 seconds (≥ 3 person-minutes)
Security Considerations
- OAuth credentials stored as environment variables
- Access tokens stored in memory with 1-hour TTL
- CORS enabled for Meet add-on context
- No caching of sensitive data
- HTTPS required for all endpoints
Future Enhancements
- Real Participant API: Replace demo participant counting with actual Google Meet API integration
- Persistent Storage: Use Firestore for longer-term token storage
- Enhanced Error Handling: Better user feedback for API failures
- Performance Optimization: Optimize for larger meetings
- Analytics: Track usage and performance metrics
Production Deployment
When ready for production:
- Update OAuth consent screen to "Published" status
- Submit for Google verification (required for sensitive scopes)
- Enable production caching headers
- Set up monitoring and alerting
- Configure backup/disaster recovery
Support
- Cloud Function URL: https://REGION-PROJECT_ID.cloudfunctions.net/meet-ticker
- Google Cloud Console: https://console.cloud.google.com/functions/details/us-central1/meet-ticker
- Repository: This git repository contains all source code and configuration