/Twitter-Clone-BackEnd

The Twitter Clone project aims to replicate the core features and functionalities of the popular social media platform, Twitter. This web application provides users with a platform to share short messages, engage with other users through likes, retweets, and comments, and stay updated on the latest trends and activities.

Primary LanguageJavaScript

Artboard-1-transparent-1

⚡️Twitter Clone⚡️

Amazing Twitter clone - It's a microblogging site that enables users to share brief messages and engage in real-time conversations.

GitHub contributors GitHub issues GitHub forks GitHub stars

📝 Table of Contents


🚀 Overview

This website was implemented for the Software Engineering Course @ Cairo University Faculty of Engineering.

It is developed using Node.js for the backend, PostgreSQL for the database, React for the frontend, and AWS for deployment.

The Twitter Clone project aims to replicate the core features and functionalities of the popular social media platform, Twitter. This web application provides users with a platform to share short messages, engage with other users through likes, retweets, and comments, and stay updated on the latest trends and activities.


⛏️ Tech Stack

JavaScript

Nodejs Express.js

TypeORM PostgreSQL

Docker Jenkins

Socket.IO Event-Driven Programming

Jest SuperTest

JWT Google reCAPTCHA OAuth AWS


🔥 Get Started

  1. Clone the project
  https://github.com/Twitter-Clone-Project/Back-End.git
  1. Install dependencies. hint: cd to the project folder that has the package.json file in it.
  npm install
  1. Set environment variables
 Copy file .env.template then Create file .env and set your environment variables in it.
  1. Start the server in development env
  npm run start:dev
  1. Start the server in production env
  npm run start:prod

📄 API Documentation

File API-Documentation.yaml in the repo, this is a yaml coded-documentation. Untill we upload the documentation on swaagerHub($$), you can see the GUI by opening swagger editor online, then paste the code in it.

You can also see postman documentation with test exambles here

Here is the Socket.io events documentaion


📸 Features

🔒 User Authentication

  1. Sign Up:

    • Allows users to create a new account in the application.
  2. Sign In:

    • Enables users to sign in to their accounts.
  3. Sign In/Up with Google:

    • Provides the option to sign in or sign up using Google credentials.
  4. Get Me:

    • Retrieves information about the authenticated user.
  5. Sign Out:

    • Logs the user out from the application.
  6. Resend Confirmation Email:

    • Resends the confirmation email to the user for account verification.
  7. Verify Email:

    • Confirms the email of the user after receiving the verification email.
  8. Update Password:

    • Allows users to update their password.
  9. Forget Password:

    • Initiates the process of resetting the password by sending an email.
  10. Reset Password:

    • Completes the password reset process.
  11. Check Username Availability:

    • Determines if a given username is already registered.
  12. Check Email Availability:

    • Checks if a given email is already registered.

🙍‍♂️ User Profile

  1. Update Username:

    • Allows users to change their username.
  2. Update Email:

    • Permits users to update their email address.
  3. Update Banner:

    • Adds a banner to the user's profile.
  4. Delete Banner:

    • Removes the banner picture from the user's profile.
  5. Update Profile Picture:

    • Updates the user's profile picture.
  6. Delete Profile Picture:

    • Deletes the user's profile picture.
  7. Update Profile:

    • Updates various aspects of the user's profile.
  8. Get User Profile:

    • Retrieves the profile information of a specific user.

👨‍💻 User Interactions

  1. Get Followers:

    • Retrieves a list of followers for a specific user.
  2. Get Followings:

    • Retrieves a list of users followed by a specific user.
  3. Follow User:

    • Allows a user to follow another user.
  4. Unfollow User:

    • Allows a user to unfollow another user.
  5. Mute User:

    • Mutes a specific user.
  6. Unmute User:

    • Unmutes a previously muted user.
  7. Get Muted Users:

    • Retrieves a list of users muted by the authenticated user.
  8. Block User:

    • Blocks a specific user.
  9. Unblock User:

    • Unblocks a previously blocked user.
  10. Get Blocked Users:

    • Retrieves a list of users blocked by the authenticated user.

📤 Tweets

  1. Add Tweet:

    • Allows users to post a new tweet.
  2. Delete Tweet:

    • Deletes a tweet based on its tweetId.
  3. Get Tweet Info:

    • Retrieves information about a specific tweet.
  4. Get Replies to Tweet:

    • Retrieves replies to a specific tweet.
  5. Add Reply to Tweet:

    • Allows users to add a reply to a tweet.
  6. Delete Reply from Tweet:

    • Deletes a reply from a tweet.
  7. Add Retweet:

    • Allows users to retweet a tweet.
  8. Delete Retweet:

    • Deletes a retweet.
  9. Like Tweet:

    • Allows users to like a tweet.
  10. Unlike Tweet:

    • Removes a like from a tweet.
  11. Get Retweeters:

    • Retrieves a list of users who retweeted a specific tweet.
  12. Get Likers:

    • Retrieves a list of users who liked a specific tweet.
  13. Add Media to Tweet:

    • Allows users to add media (e.g., images) to a tweet.
  14. Get Media from Tweet:

    • Retrieves media (e.g., images) associated with a tweet.

⏲️ Timeline

  1. Get Home Timeline:

    • Retrieves a list of tweets on the home page of the user.
  2. Get User Tweets:

    • Retrieves tweets posted by a specific user.
  3. Get Mentioned Tweets:

    • Retrieves tweets where the user is mentioned.
  4. Get Liked Tweets:

    • Retrieves tweets liked by a specific user.

📈 Trends

  1. Get Available Trends:

    • Retrieves a list of available trends.
  2. Get Trend Tweets:

    • Retrieves tweets associated with a specific trend.

🔎 Search

  1. Search Users:

    • Searches for users based on their username or screen name.
  2. Search Tweets:

    • Searches for tweets based on a provided string.

🗨️ Chats

  1. Real-Time Chat:

    • Allows users to send and receive messages in real-time, ensuring instant communication.
  2. Synchronized Chat Across Devices:

    • Ensures that the chat history and messages are synchronized seamlessly when a user accesses the application from multiple devices.
  3. Start Conversation:

    • Users can initiate new conversations with other users.
  4. Leave Conversation:

    • Provides the functionality for users to leave a conversation.
  5. Unseen Conversations Count:

    • Retrieves the number of unseen conversations to notify users of new messages.
  6. View Messages in a Conversation:

    • Users can view the messages within a specific conversation.
  7. Send Messages:

    • Allows users to send messages to others within a conversation.
  8. Seen and Sent Feature:

    • Indicates whether a message has been seen by the recipient and provides information about when a message was sent.
  9. Delete Messages:

    • Users can delete their messages within a conversation.

🔔 Notifications

  1. Real-Time Notifications:

    • Users receive notifications in real-time for events such as new followers.
  2. Unseen Notifications Count:

    • Provides the count of unseen notifications to inform users about new activities.
  3. View Notifications:

    • Users can view a list of their notifications, including details about the activities that triggered them.
  4. Seen Feature:

    • Tracks whether a user has seen a particular notification.

📁 File Structure

📂 File Tree

project-root
│
├── tests
│   ├── routes
│   │   ├── authRouter.test.js
│   │   ├── conversationsRouter.test.js
│   │   ├── interactions.test.js
│   │   ├── notificationsRouter.test.js
│   │   ├── profile.test.js
│   │   ├── searchRouter.test.js
│   │   ├── timelineRouter.test.js
│   │   └── tweetsRouter.test.js
│   ├── services
│   │   └── WebSocket.oldtest.js
├── controllers
│   ├── authController.js
│   ├── conversationsController.js
│   ├── errorController.js
│   ├── interactionsController.js
│   ├── notificationsController.js
│   ├── profileController.js
│   ├── searchController.js
│   ├── timelineController.js
│   ├── trendsController.js
│   └── tweetsController.js
├── middlewares
│   ├── validations
│   │   ├── conversation.js
│   │   ├── profile.js
│   │   ├── tweet.js
│   │   └── user.js
│   ├── catchAsync.js
│   └── validateRequest.js
├── models
│   ├── entities
│   │   ├── Conversation.js
│   │   ├── Media.js
│   │   ├── Message.js
│   │   ├── Notification.js
│   │   ├── Reply.js
│   │   ├── Trend.js
│   │   ├── Tweet.js
│   │   └── User.js
│   ├── relations
│   │   ├── Block.js
│   │   ├── Follow.js
│   │   ├── Like.js
│   │   ├── LikeReply.js
│   │   ├── Mention.js
│   │   ├── Mute.js
│   │   ├── Repost.js
│   │   └── Support.js
├── routes
│   │   ├── authRouter.js
│   │   ├── conversationsRouter.js
│   │   ├── interactionsRouter.js
│   │   ├── notificationsRouter.js
│   │   ├── profileRoutes.js
│   │   ├── searchRouter.js
│   │   ├── timelineRouter.js
│   │   ├── trendsRouter.js
│   │   └── tweetsRouter.js
├── schemas
│   ├── entities
│   │   ├── conversationSchema.js
│   │   ├── mediaSchema.js
│   │   ├── messageSchema.js
│   │   ├── notificationSchema.js
│   │   ├── replySchema.js
│   │   ├── trendSchema.js
│   │   ├── tweetSchema.js
│   │   └── userSchema.js
│   ├── relations
│   │   ├── blockSchema.js
│   │   ├── followSchema.js
│   │   ├── likeReplySchema.js
│   │   ├── likeSchema.js
│   │   ├── mentionSchema.js
│   │   ├── muteSchema.js
│   │   ├── repostSchema.js
│   │   └── supportSchema.js
├── seeds
│   ├── blocks.json
│   ├── conversations.json
│   ├── follows.json
│   ├── likes.json
│   ├── media.json
│   ├── messages.json
│   ├── mutes.json
│   ├── notifications.json
│   ├── replies.json
│   ├── reposts.json
│   ├── seeds.js
│   ├── supports.json
│   ├── trends.json
│   ├── tweets.json
│   └── users.json
├── services
│   ├── AppError.js
│   ├── AuthService.js
│   ├── Email.js
│   ├── Password.js
│   └── WebSocket.js
├── test
│     └── setup.js
├── views/emails
│   ├── _style.pug
│   ├── baseEmail.pug
│   ├── confirmEmail.pug
│   └── updateEmail.pug
├── .env.template
├── .eslintrc.json
├── .gitignore
├── .prettierrc
├── API-Documentation.yaml
├── Dockerfile
├── README.md
├── WebSocket APIs Documentation.md
├── app.js
├── dataSource.js
├── dataSource2test.js
├── package-lock.json
├── package.json
└── server.js

👨‍💻 Authors

  • Mahmoud Yahia LinkedIn
  • Mohamed Yaser LinkedIn
  • Daniel Nabil LinkedIn
  • Mostafa Tarek LinkedIn