Design Nearby Friends With Opt-In Location Sharing and Privacy Controls
Last updated: November 29, 2026
Quick Overview
Design a Nearby Friends feature where users who opt in share their approximate location with chosen friends, see which friends are close by, and get notified when a friend comes within a few miles, all with strict privacy and battery limits.
Meta
November 29, 20260
0
0 solved
Design a Nearby Friends feature where users who opt in share their approximate location with chosen friends, see which friends are close by, and get notified when a friend comes within a few miles, all with strict privacy and battery limits.
Facebook has shipped friend location features, and they combine a moving-object geo index with the social graph and serious privacy requirements. The interviewer checks that you index frequently updating locations efficiently, compute proximity only among friends who opted in, and design precision, retention and audience controls from the start.
What the Interviewer Expects
- Define privacy controls: opt-in, audience lists, precision, pause, retention
- Handle frequent location updates cheaply on device and server
- Compute friend proximity using the friend graph rather than a global nearby search
- Design proximity notifications with hysteresis to avoid spamming
- Delete or coarsen location history quickly
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- Why not use a global geospatial index of all users?
- How would you avoid notifying someone every time a friend crosses the threshold back and forth?
- What does the server store, and for how long?
- How would you scale for a user with 3,000 friends who all opted in?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Functional: users opt in and choose an audience (all friends, a list, or none). The app reports location periodically. Each user sees opted-in friends within a radius with approximate distance ("a...
High-Level Design
The mobile client uses significant-location-change APIs and reports (lat, lng, accuracy, ts) to a location service, which stores only the latest location per user in an in-memory store with a TT...