Scale estimations
Data Entities:
Workout
Id
UserId
ActivityTypeId
Duration
Calories
Distance
Intensity - HIGH, LOW, MEDIUM
StartDate
EndDate
Goal
Id
UserId
GoalType
TargetValue
CurrentValue
StartDate
EndDate
UserStats
Id
UserId
TotalWorkouts
TotalDistance
TotalCalories
POST /workout - creating/recording workouts
request - {
userId,
activityType,
duration,
distance,
calories,
startDate,
endDate
}
response - {workoutId}
POST /goal - used for creating goals
request -
{
goalType,
targetValue,
startDate,
endDate
}
response - {goalId}
GET /workouts?startDate=&endDate=&page=
GET /goals
response
LIST
GET /goals/{goal_id}/progress - returns progress of a goal
response - {
goalId,
targetValue,
currentValue,
progressPercent
}
GET /users/{userId}/stats
response : UserStats
Acts as the entry point for all client requests.
Responsibilities:
Distributes traffic across multiple instances of the Read and Write services to improve scalability and availability.
Handled at API Gateway using token bucket per API key/IP to prevent abuse and control write traffic.
Workout Service:
Responsibilities:
Goal Service:
Responsibilities:
Stats service:
Responsibilties:
Redis:
MessageQueue:
Responsibilties:
We will now deep dive into the following topics
1) Offline Sync + Idempotency Key:
2) Kafka Event delivery Consistency
3) How will system handle high availability and fast response times