Social media RestFul API like (Twitter or FaceBook) that build with C# + .NET Core
- C#
- .NET Core
- SQL Server
Note! Entity and attributes can change overtimes.
Represents a user on the platform.
id(Primary Key)username(Unique)email(Unique)password(Hashed)profile_picture(URL)bio(Text)followers(Array of User IDs)following(Array of User IDs)created_at(Timestamp)
- One-to-Many: A user can have many posts.
- Many-to-Many: Users can follow each other.
Represents a post created by a user.
id(Primary Key)author_id(Foreign Key to User)content(Text)image(URL, optional)likes(Array of User IDs)created_at(Timestamp)
- One-to-Many: A post can have many comments.
- Many-to-Many: A post can be liked by many users.
Represents a comment on a post.
id(Primary Key)post_id(Foreign Key to Post)author_id(Foreign Key to User)content(Text)created_at(Timestamp)
- Many-to-One: A comment belongs to a post.
Represents a notification for user actions like likes, comments, and follows.
id(Primary Key)recipient_id(Foreign Key to User)sender_id(Foreign Key to User)type(String: 'like', 'comment', 'follow')post_id(Foreign Key to Post, optional)comment_id(Foreign Key to Comment, optional)created_at(Timestamp)read(Boolean)
- Many-to-One: A notification belongs to a recipient user.
- Optional relationships to Post and Comment depending on the notification type.
Represents a like on a post (can be embedded in the Post entity or separate).
id(Primary Key)post_id(Foreign Key to Post)user_id(Foreign Key to User)created_at(Timestamp)
- Many-to-One: A like belongs to a post.
- Many-to-One: A like belongs to a user.
- User <-> Post: One-to-Many (One user can create many posts)
- User <-> User: Many-to-Many (Users can follow each other)
- Post <-> Comment: One-to-Many (One post can have many comments)
- Post <-> User: Many-to-Many (Users can like many posts, and posts can have many likes)
- Notification <-> User: Many-to-One (Notifications are for users)
- Notification <-> Post/Comment: Optional (Depending on notification type)