Engineering Friend Bubbles: A Step-by-Step Guide to Building Social Discovery at Scale
Introduction
Friend Bubbles might look like a simple feature—just a set of circular avatars showing which Reels your friends have watched and reacted to. But beneath that straightforward UI lies a complex engineering challenge: how do you surface meaningful social signals to billions of users without overwhelming them or breaking the system? In this guide, we'll walk through the key steps Facebook’s Reels team took to bring Friend Bubbles to life, drawing on insights from the engineers who built it. Whether you're building a social discovery feature or scaling any recommendation system, these steps will help you navigate the hidden complexities.

What You Need
- Data pipeline for capturing user interactions (likes, comments, shares) on content
- Social graph infrastructure (friendship connections, follow relationships)
- Machine learning framework (e.g., PyTorch, TensorFlow) for training recommendation models
- A/B testing platform to compare feature variants across iOS and Android
- Scalable storage (e.g., distributed key-value stores) to cache real-time friend activity
- Cross-platform development tools (iOS and Android SDKs, feature flags)
- Team of engineers comfortable with backend, ML, and frontend work
Step-by-Step Guide
Step 1: Define the Core User Need
Start by clarifying what problem you're solving. For Friend Bubbles, the goal was to help users discover Reels through the lens of their friends—not just algorithmically. Instead of a purely personalized feed, the feature highlights content that friends have already engaged with, adding a social trust factor. Define metrics: increased engagement (likes, shares), time spent, and social interactions. Keep the user story simple: "I want to see what my friends are watching."
Step 2: Design the Machine Learning Model
The heart of Friend Bubbles is an ML model that predicts which Reels a user is likely to enjoy based on friends' behaviors. Initially, the team experimented with collaborative filtering—recommending Reels that friends of similar users liked. But they quickly found that recency and diversity mattered more than pure similarity. The model evolved to weight the latest friend interactions higher, and to avoid showing the same Reel from multiple friends. Train on historical data: user A watched Reel X, friend B also watched and liked it. Use a graph neural network to capture multi-hop friendships.
Step 3: Handle Platform Differences (iOS vs. Android)
Users behave differently on iOS and Android. The engineers discovered that iOS users tend to engage more with long-form content, while Android users swipe faster through short Reels. That meant the same friend interaction signal had different implications. Implement platform-specific model parameters: for iOS, emphasize watch duration; for Android, prioritize quick likes and comments. Also note that notification systems and feed rendering differ—test on both platforms early.
Step 4: The Surprising Discovery That Made It Click
During development, the team hit a plateau—Friend Bubbles weren't driving much lift. They then made a counterintuitive change: reduce the number of bubbles shown from six to three. This forced the algorithm to be more selective and only surface the most relevant friend interactions. The result? Engagement shot up. The lesson: less can be more. Constraint-driven design forces focus. In your feature, try limiting the number of recommendations or friends shown to avoid choice overload.

Step 5: Scale Infrastructure to Billions
With billions of Reels watched daily, computing friend activity for every user in real-time is impossible. Facebook built a caching layer that precomputes the top friend bubbles for each user during idle cycles (e.g., overnight, low traffic). Use an offline batch pipeline to generate candidate lists, then serve from a low-latency cache. For real-time updates (a friend likes a Reel now), use a streaming system (e.g., Apache Kafka) to push incremental changes. Monitor cache hit ratios and fallback gracefully to generic recommendations if caching fails.
Tips for Success
- Start with a minimal viable version: Even three bubbles can prove the concept. Add more only after validating.
- Test on both platforms from day one: iOS and Android users have distinct behaviors—don't assume one model fits all.
- Watch for feedback loops: If Friend Bubbles only show popular Reels, friends' feeds become homogeneous. Inject randomness to preserve discovery.
- Use feature flags: Roll out to small user groups before global launch. You'll catch edge cases (e.g., users with few friends) early.
- Optimize for latency: Social features must feel instant. Cache aggressively, precompute, and limit API calls per request.
- Measure what matters: Beyond clicks, track time spent and social actions (comments, shares) to ensure the feature fosters community, not just consumption.
Building a social discovery feature that scales to billions is never as simple as it looks. Friend Bubbles succeeded because the team iterated on their ML model, embraced platform differences, and made a surprising discovery about the power of constraints. Apply these steps to your own feature, and you'll turn a seemingly simple idea into an impactful, scalable product.
Related Articles
- How to Detect and Protect Against Supply-Chain Attacks: A Case Study of the Daemon Tools Backdoor
- Reviving the Depths: How Unknown Worlds Brought a Lost Feature Back for Subnautica 2
- Safari Technology Preview 240: Key Updates & Fixes Explained
- Mobile Qubits: Bridging the Gap Between Manufactured and Atomic Quantum Systems
- Princeton Ends 133-Year Honor Exam Tradition with New Proctoring Mandate
- Guide to Critical Unpatched Flaw Leaves Hugging Face LeRobot Open to Unauthen...
- Swift 6.3 Arrives with Enhanced Cross-Platform Build Tools and Community Updates
- Everything You Need to Know About Vitest 4.1: New Features and Performance Gains