Skip to content

TwistedAlex/django-twitterme

Repository files navigation

django-twitterme

Tech Stack:

Python, Django REST Framework, MySQL, HBase, Redis, Memcached, RabbitMQ, Amazon S3/EC2, Thrift,

Summary:

This project is to design, develop, and implement Restful APIs to operate Twitter-like backend service as close to real-world development as possible based on Django REST Framework. For performance optimization, structured and unstructured databases are both implemented in this project according to the nature of the tables.

• Built push model to fanout news feeds

• Leveraged Redis and Memcached to reduce DB queries for tables which has lot reads and lot writes

• Used Key-value store HBase to split DB queries for tables which has less reads and lot writes

• Utilized denormalization to store the number of comments & likes to reduce DB queries

• Adapted Message Queue to deliver asynchronized tasks to reduce response time

• The whole project resulted in 10000 lines of code changes, cost over 3 months

Features:

  • User Authentification: Allow users to log in or sign up with emails
  • Allow users to follow, unfollow other users
  • Allow users to view, comment, and like others' posts, also users can cancel their comments and likes on the posts
  • Allow users to create, delete, update posts and view the count of likes and comments of their posts
  • Send out newfeeds to followers
  • Display tweets in newfeeds in endless pagination format

APIs

User and Profile

GET /api/users/ Only admin users have the access permission.

POST /api/accounts/signup/ It also creates user profile.
POST /api/accounts/login/
POST /api/accounts/logout/
GET /api/accounts/login_status/

PUT /api/profiles/:profile_id Updates nickname and/or avatar.

Tweet

GET /api/tweets/?user_id=xxx

POST /api/tweets/

GET /api/tweets/:id

Friendship

POST /api/friendships/:user_id/follow/
POST /api/friendships/:user_id/unfollow/
GET /api/friendships/:user_id/followings/
GET /api/friendships/:user_id/followers/

Newsfeed

GET /api/newsfeeds/
Endless Paginationimage

Comment

POST /api/comments/
PUT /api/comments/:id
DELETE /api/comments/:id
GET /api/comments/?tweet_id=xxx

Like

POST /api/likes/
POST /api/likes/cancel/

Notification

GET /api/notifications/
GET /api/notifications/unread-count/
POST /api/notifications/mark-all-as-read/
PUT /api/notifications/:notification_id

django_hbase Module

Django Rest Framework alike ORM to access hbase.

Implemented functions: Deine models and fields similar to DRF. Save, create, filter operations similar to Django ORM.

GateKeeper Module(Rate limiter):

Function: GrayRelease, Whitelisting, Reverse Commit

System Architecture

image

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors