A user should be able to:
System should:
Let's assume:
Based on the assumptions above, we'll need:
A user would like to:
1) be able to request a weather forecast for a specific location on a specific date
GET v1/weather/
200 OK
{
location,
date,
temperature,
precipitations,
...
}
2) subscribe to weather forecasts for a specific location (and weather alerts)
POST v1/users/
{
location_id,
time
}
create a subscription and return a status code and a subscription id
200 OK
{
user_id,
location_id,
subscription_id,
time
}
3) remove a user's subscription
DELETE v1/users/
{
user_id,
subscription_id,
time
}
4) list all their subscriptions
GET v1/users/
{
[
{
subscription_id,
location_id
},
...
]
count,
offset,
total
}
We won't focusing on a storage for user accounts and only describe the one for subscriptions:
Both of those concerns can be satisfied with a use of a relational DB with read replicas for read-scalability.
So, we'll store the following entities:
User
{
user_id: String,
}
Subscription
{
user_id: String,
location_id: String
}
And the forecasts themselves can either be stored in the same relational DB or in an key-value store, depending on requirements on updating those data.
Forecast Data
{
location_id,
}
We going to have four main components in the system:
Explain how the request flows from end to end in your high level design. Also you could draw a sequence diagram using the diagramming tool to enhance your explanation...
Dig deeper into 2-3 components and explain in detail how they work. For example, how well does each component scale? Any relevant algorithm or data structure you like to use for a component? Also you could draw a diagram using the diagramming tool to enhance your design...
Explain any trade offs you have made and why you made certain tech choices...
Try to discuss as many failure scenarios/bottlenecks as possible.
What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?