← Questions
Design a fitness tracking app
0
I was asked this
No reports yet. Sign in to say where you were asked it.
A system design interview question asked in Meta's CodeSignal assessment, last asked Mar 2026. It tests mobile, time series and geospatial.
Design the backend of a fitness tracking app. Users record workouts such as runs and rides on their phone, upload them, browse their workout history, see aggregate statistics, and view each workout's route on a map. Phones are often offline during a workout, and every workout carries a GPS track of many points.
Requirements
- Functional: record a workout (type, start and end time, distance, duration, heart rate and other metrics, GPS track) and upload it, possibly long after it ended.
- Functional: list a user's workouts newest first; open one workout with its route on a map; show weekly, monthly and all-time totals.
- Functional: privacy settings per workout (private, followers, public), including hiding the start and end of a route near home.
- Non-functional: tens of millions of users and a few workouts per user per week; uploads are idempotent; history and detail pages load fast; no workout is ever lost once the phone reports it uploaded.
Clarifying questions
- How many users and workouts a day, and how many GPS points per workout (one per second for an hour is about 3,600)?
- Is there a social feed, segments or leaderboards, or only personal history?
- Does the phone send raw points or a processed summary?
- How long must raw tracks be kept?
- Do we need live tracking during a workout, or only upload after?
What a strong answer covers
- APIs: start an upload (client-generated workout id for idempotency), upload the track in chunks or as one compressed file, list workouts with cursor pagination, get a workout, get stats.
- Offline sync: the phone stores the workout locally and retries; the server de-duplicates by workout id and accepts late uploads.
- Data model: a workouts table with the summary metrics, partitioned or sharded by user id; GPS tracks stored as compressed blobs in object storage, with a simplified polyline for the map view.
- Processing: an asynchronous pipeline after upload that cleans the track, computes distance, pace and splits, builds the simplified route, and updates the user's aggregates.
- Aggregates: precomputed per user per week and month, updated incrementally, rather than summed on every request.
- Indexing: (user_id, start_time) for history; a geospatial index only if features such as nearby routes need it.
- Privacy and security: per-workout visibility checked on every read, privacy zones applied when the route is rendered, encryption of location data.
- Scaling: stateless API servers, object storage for the large data, a queue in front of processing, caching of recent history.
Follow-ups
- Add live tracking, so friends can follow a run as it happens. What changes?
- A user edits a workout or deletes it. How do aggregates stay correct?
- How would you add segments, with a leaderboard of the fastest times on a stretch of road?
- How do you handle a bad GPS track with jumps of several miles?
Where it's asked
- Meta · CodeSignal assessment · Last asked Mar 202690 min · Four levels on one class: basic operations, a ranking query, timestamps and expiry, then merge or snapshot and restore · No AI
What it tests
mobile · time series · geospatial
No official answer yet. Draw yours on the right; publish it and it shows under Community.
Nothing published yet. Publish your canvas and it shows here for others to open and remix.
Draw your answer hereBoxes, arrows and notes, saved for you to come back to.Sign in to start drawing
