The Twitter-Like API is deployed on Google Cloud Platform (GCP) and can be accessed at:
đź”— Swagger UI for Twitter-Like API
This deployment is containerized using Docker and hosted on a GCP.
This brief section directs users to the deployed application and succinctly informs them about the deployment method.
This project is a Flask-based API that mimics basic functionalities of Twitter. It allows users to register, login, post tweets, follow/unfollow users, and view user profiles. Additionally, it introduces Role-Based Access Control (RBAC) with a special role for Twitter Moderators, who can flag tweets as spam and suspend user accounts.
- User Authentication: Registration and login functionalities.
- Tweet Management: Users can post and view tweets.
- User Relationships: Users can follow and unfollow each other.
- User Profiles: Retrieve user profiles with tweets and follow statistics.
- Feed Generation: Users can view a feed of tweets from users they follow.
- Moderation: Twitter Moderators can flag tweets as spam and suspend user accounts.
- Flask, SQLAlchemy, Marshmallow, JWT, PostgreSQL
-
Clone the repository:
git clone https://github.com/RevoU-FSSE-2/Week-21-m-istighfar
-
Navigate to the project directory:
cd revou-flask-api-main
-
Install dependencies using pipenv:
pipenv install pipenv shell
-
Set up environment variables:
- Copy
.env.example
to a new file named.env
in thesrc
directory. - Modify the
.env
file with your specific configurations.
- Copy
-
Run the application:
flask run
The following table outlines the available API endpoints along with their respective request methods and descriptions:
Endpoint | Method | Description |
---|---|---|
/auth/registration |
POST | User registration, including optional role assignment. |
/auth/login |
POST | User login, with handling for suspended accounts. |
/user/profile |
GET | Fetches the profile of the logged-in user. |
/tweet |
POST | Allows users to post a tweet. |
/following |
POST | Enables users to follow/unfollow other users. |
/user/feed |
GET | Generates a feed based on the users followed by the requester. |
/moderation/tweet |
POST | Allows Twitter Moderators to flag tweets as spam. |
/moderation/user |
POST | Enables Twitter Moderators to suspend user accounts. |