Best Practices
Follow these recommendations to ensure optimal performance and user experience:
Caching Strategy
Always cache GLB files locally (IndexedDB, localStorage, or CDN) to minimize API traffic
Generate thumbnails for gallery views instead of full GLB files
Use avatar IDs to regenerate previously created avatars
Performance Optimization
Use the
gender property to filter compatible assets and reduce payload sizeLazy load GLB files only when needed (e.g., when user clicks to view)
Implement progressive loading: show thumbnail first, then load full model
Error Handling
Handle
429 responses with exponential backoff strategyImplement retry logic for transient errors (network issues, timeouts)
Show user-friendly error messages and provide fallback options
Security
Never expose Firebase API keys or tokens in client-side code
Validate avatar configurations on the client before sending to API
Implement proper authentication checks before allowing avatar generation
User Experience
Show loading indicators during avatar generation (typically 2-5 seconds)
Provide preview thumbnails before generating full 3D models
Allow users to save favorite avatar configurations
Implement undo/redo functionality in avatar customization UI