Estimate the scale of the system. Consider daily active users, read/write ratio, storage requirements, bandwidth, and any relevant QPS calculations...
REST APIs
POST /tweet
-- messages
-- user_id
-- topic
-- timestamp
POST /follow/{user_id}
POST /like/{tweet_id}
GET /tweet/{user_id} # get tweet from a user
GET /toptweets/{k} # get top k tweets
The request starts from the client and goes to API gateway, then it goes to tweet service (for APIs like post a tweet, add likes to a tweet, get all tweets from a user) or user service (for APIs about the user, like follow a user)
MongoDB or other documented based database
Tweet table:
tweet id (primary key)
user id
topic
message
timestamp
likes amount
user likes the tweet []
User table
user id (primary key)
followers []