Data model¶
erDiagram
USERS ||--o{ POSTS : authors
USERS ||--o{ FOLLOWS : follows
USERS ||--o{ FOLLOWS : is_followed
USERS ||--o{ LIKES : gives
POSTS ||--o{ LIKES : receives
POSTS ||--o{ HASHTAG_POSTS : tagged
HASHTAGS ||--o{ HASHTAG_POSTS : labels
USERS ||--o| REFRESH_TOKENS : owns
POSTS o|--o{ POSTS : replies_or_reposts
Main records¶
Usersstores identity, profile, password hash, counters, and verification.Postsstores up to 240 characters, media URLs, counters, author, reply and original-post references, hashtags, and mentions.Followrecords a unique follower/following pair.Likesenforces one like per user and post.HashtagPostsindexes its hashtag and post relationships but does not enforce unique pairs.RefreshTokenstores one rotating refresh token per user.
Entities stay internal. Controllers expose the records in model, preventing
persistence details and password hashes from leaking into API responses.