Twitter / X
Complete database schema for a Twitter/X-like microblogging platform covering user accounts, tweet content, media attachments, hashtags, follow relationships, likes, retweets, notifications, direct messaging, and trending topics.
socialmicrobloggingreal-timefeednotifications
MySQL10 cols
Num
PK
AI
FK
Null
Physical Name
Type
Default
Comment
Unique user identifier
Unique username handle, e.g. @johndoe
User's email address for login
Bcrypt hashed password
Display name shown on profile
Short user biography shown on profile
URL to profile avatar image
Blue checkmark verification status
Account creation timestamp
Last profile update timestamp
IXUQCK|💬
MySQL12 cols
Num
PK
AI
FK
Null
Physical Name
Type
Default
Comment
Unique tweet identifier
Author of the tweet
Tweet text content, max 280 chars
Parent tweet id if this is a reply
Original tweet id if this is a quote tweet
Number of retweets
Number of likes
Number of replies
Total impressions/views
Whether tweet contains sensitive content
Tweet publication timestamp
Soft-delete timestamp, null if active
IXUQCK|💬
MySQL8 cols
Num
PK
AI
FK
Null
Physical Name
Type
Default
Comment
Unique media attachment identifier
Tweet this media belongs to
Type: image, video, or gif
CDN URL of the media file
Thumbnail URL for video previews
Media width in pixels
Media height in pixels
Upload timestamp
IXUQCK|💬
MySQL5 cols
Num
PK
AI
FK
Null
Physical Name
Type
Default
Comment
Unique hashtag identifier
Hashtag text without the # symbol
Number of tweets using this hashtag
First usage timestamp
Last updated timestamp
IXUQCK|💬
MySQL4 cols
Num
PK
AI
FK
Null
Physical Name
Type
Default
Comment
Unique junction record identifier
Tweet that uses this hashtag
Hashtag used in the tweet
Time when hashtag was added to tweet
IXUQCK|💬
MySQL5 cols
Num
PK
AI
FK
Null
Physical Name
Type
Default
Comment
Unique like record identifier
User who liked the tweet
Tweet that was liked
Timestamp when like was added
Last updated timestamp
IXUQCK|💬
MySQL5 cols
Num
PK
AI
FK
Null
Physical Name
Type
Default
Comment
Unique follow relationship identifier
User who is following
User being followed
True if follow request not yet accepted
Timestamp when follow was created
IXUQCK|💬
MySQL5 cols
Num
PK
AI
FK
Null
Physical Name
Type
Default
Comment
Unique retweet record identifier
User who retweeted
Original tweet being retweeted
Optional comment added to retweet
Timestamp of retweet
IXUQCK|💬
MySQL9 cols
Num
PK
AI
FK
Null
Physical Name
Type
Default
Comment
Unique notification identifier
User receiving the notification
User who triggered the notification
Notification type: like, retweet, follow, mention, reply
Related tweet if applicable
Notification message text
Whether user has read this notification
When notification was generated
Last updated timestamp
IXUQCK|💬
MySQL8 cols
Num
PK
AI
FK
Null
Physical Name
Type
Default
Comment
Unique DM conversation identifier
Conversation creation timestamp
Last message timestamp
Whether this is a group DM
Group name for group DMs
User who created the conversation
Timestamp of the most recent message
Whether conversation is archived
IXUQCK|💬
MySQL8 cols
Num
PK
AI
FK
Null
Physical Name
Type
Default
Comment
Unique message identifier
Conversation this message belongs to
User who sent the message
Message text content
Optional media attachment URL
Whether recipient has read message
Message send timestamp
Soft-delete timestamp
IXUQCK|💬
MySQL5 cols
Num
PK
AI
FK
Null
Physical Name
Type
Default
Comment
Unique participant record identifier
DM conversation
Participant user
When user joined the conversation
Timestamp of user's last read message
IXUQCK|💬
MySQL5 cols
Num
PK
AI
FK
Null
Physical Name
Type
Default
Comment
Unique block record identifier
User who initiated the block
User who was blocked
Optional reason for blocking
Timestamp when block was created
IXUQCK|💬
MySQL5 cols
Num
PK
AI
FK
Null
Physical Name
Type
Default
Comment
Unique bookmark identifier
User who bookmarked the tweet
Bookmarked tweet
When bookmark was added
Last updated timestamp
IXUQCK|💬
MySQL9 cols
Num
PK
AI
FK
Null
Physical Name
Type
Default
Comment
Unique list identifier
User who created the list
List display name
Optional list description
Whether list is private or public
Number of accounts in the list
Number of users subscribing to this list
List creation timestamp
Last modification timestamp
IXUQCK|💬
MySQL5 cols
Num
PK
AI
FK
Null
Physical Name
Type
Default
Comment
Unique list membership record
List being added to
User added to the list
User who added the member
Timestamp of membership creation
IXUQCK|💬
MySQL8 cols
Num
PK
AI
FK
Null
Physical Name
Type
Default
Comment
Unique trending topic identifier
Associated hashtag if applicable
Trending topic text
Geographic region where trending
Number of tweets in trending period
Current ranking position
When topic started trending
When topic stopped trending
IXUQCK|💬
Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.
Created with ERD Studio
Tables in this template
usersUsers
10 colstweetsTweets
12 colstweet_mediaTweet Media
8 colshashtagsHashtags
5 colstweet_hashtagsTweet Hashtags
4 colslikesLikes
5 colsfollowsFollows
5 colsretweetsRetweets
5 colsnotificationsNotifications
9 colsdirect_messagesDirect Messages
8 colsdm_messagesDM Messages
8 colsdm_participantsDM Participants
5 colsblocksBlocks
5 colsbookmarksBookmarks
5 colslistsLists
9 colslist_membersList Members
5 colstrending_topicsTrending Topics
8 colsRelated Templates
View all templates →Photo and video sharing platform with stories, reels, explore, and direct messaging
PostgreSQL17 tables
photosocialstories+2
Social
YouTube
CloneVideo streaming platform with channels, videos, playlists, comments, and monetization
PostgreSQL15 tables
videostreamingcontent+2
Social
Reddit Clone
CloneCommunity voting platform with subreddits, posts, comments, and awards
PostgreSQL16 tables
socialcommunityvoting+2
Social
Professional networking platform with profiles, connections, job boards, and content
PostgreSQL15 tables
professionalnetworkingjobs+2
Social