Welcome to the FRONTEND repository for my Twitter project!
You can find the BACKEND repository here.
And the server metrics dashboard here
This project encompasses two primary services:
-
Messaging Service: This service manages real-time communication between users, facilitating instant messaging with a scalable, efficient architecture.
-
Twitter Operations Service: This service handles various operations related to the core functionality of Twitter, such as user management, tweet creation, liking, and following.
Messaging service is a real-time, scalable chat application built on top of WebSocket connection. It ensures seamless and efficient communication between clients, regardless of the server they are connected to. Here’s a structured overview of how it works:
- Clients can connect to any of the horizontally scaled WebSocket application servers, ensuring load balancing and high availability.
- WebSocket servers communicate with each other via Redis, facilitating message exchange across different servers.
- When a client sends a message, it is first emitted to the Redis server by the WebSocket application server.
- Redis then forwards the message to the appropriate WebSocket server where the recipient client is connected.
- The target client receives the message through the connected WebSocket server.
- Upon receiving a message, the WebSocket application server pushes the message to a Kafka queue.
- A Kafka consumer retrieves the message from the queue and inserts it into a PostgreSQL database for persistence and later retrieval.
- Thus saving database from crashing at peak traffic.
- User to Tweet: A one-to-many relationship where a user can have many tweets.
- User to Likes: A many-to-many relationship via the
Likes
model, where a user can like many tweets and a tweet can be liked by many users. - User to Follows: A self-referencing many-to-many relationship via the
Follows
model, where a user can follow many users and be followed by many users. - User to Conversation: A one-to-many relationship where a user can participate in many conversations.
- User to Message: A one-to-many relationship where a user can send many messages.
- Conversation to User: A many-to-many relationship where a conversation can have many participants.
- Conversation to Message: A one-to-many relationship where a conversation can have many messages.
- Message to Conversation: A message belongs to a single conversation.
- Message to User: A message is sent by a single user.
The Twitter Operations Service handles the core functionalities of the Twitter project, managing various operations related to user interactions and content creation. Here are the key components and features of this service:
-
User Management:
- Handles user registration, authentication, and profile management.
- Manages user information such as names, email addresses, and profile images.
- Manages following and follower relationships through the
Follows
model.
-
Tweet Management:
- Allows users to create, edit, and delete tweets.
- Supports tweets with text and optional images.
- Tracks tweet creation and update timestamps.
- Manages tweet interactions, including likes, through the
Likes
model.
-
Like Management:
- Allows users to like and unlike tweets.
- Keeps track of the relationship between users and liked tweets.
-
Follower and Following Management:
- Manages the self-referencing many-to-many relationships between users.
- Allows users to follow and unfollow other users.
- Tracks followers and following lists for each user.
-
Conversation Management:
- Handles the creation and management of conversations between users.
- Manages participants in conversations through the
participants
relationship.
-
Message Management:
- Allows users to send and receive messages in real-time.
- Manages message content, timestamps, and the relationship between messages and conversations.