KatInterview

Backend Architecture for Activity Recording Platform

System DesignModel answer
MediumModel answerSystem Designhigh-throughputgeospatialtime-series

Last updated

Design a scalable system to capture high-frequency GPS data from mobile workout sessions, compute activity metrics, and serve historical workout information.

Backend Architecture for Activity Recording Platform

You need to architect a backend that powers a mobile application for recording physical activities like runs and bike rides. The platform must handle real-time location tracking, metric calculation, and historical data access.

Core Capabilities

Your system must support:

  • Recording activities with start/pause/stop controls
  • Capturing GPS data points (latitude, longitude, timestamp) sampled frequently (approximately once per second)
  • Allowing users to browse their past activities with aggregate statistics
  • Displaying detailed route visualizations for completed activities

Scale and Performance Goals

  • Support 1 million simultaneous active recording sessions
  • Minimize latency for real-time metric updates during active sessions
  • Ensure historical data remains accessible with high uptime
  • Protect user data with appropriate access controls and privacy measures

What to Deliver

Your design should cover:

  1. API contracts: Specify the key endpoints for session lifecycle management, data ingestion, and retrieval operations
  2. Data organization: Define schemas for user profiles, activity sessions, and location point streams
  3. Storage decisions: Justify your database choices considering write patterns, query needs, and data characteristics (consider relational, document, time-series, and object storage options)
  4. System architecture: Illustrate the data flow from mobile devices through ingestion pipelines, processing layers, and storage tiers, with attention to handling sustained high write rates

Hints

Hint 1

The write and read patterns are fundamentally different—don't force a single database to handle both

Hint 2

Client-side batching dramatically reduces server request volume

Hint 3

Consider where data lives during an active session versus after completion