You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create the durable, server-authorized relationship model that every Friend System surface can depend on.
Product contract
Authenticated users can:
send a friend request;
cancel their own outgoing request;
accept or decline an incoming request;
list accepted friends and incoming/outgoing requests;
unfriend someone;
block or unblock another user.
State transitions must be idempotent. A crossed request may become an accepted friendship instead of creating two requests. Self-requests, duplicate relationships, blocked pairs, and unauthorized transitions are rejected consistently.
Blocking is directional and overrides friendship state:
blocking removes any accepted friendship between the pair;
pending friend requests and room invitations between the pair become non-actionable;
the blocked user cannot send new requests or invitations;
APIs do not reveal whether a block exists.
Data and API design
Store one canonical relationship per unordered user pair using a normalized pair key and a unique index.
Keep directional blocks separate from the symmetric friendship so future policy stays understandable.
MongoDB remains the source of truth; add backward-compatible Prisma models and non-blocking PostgreSQL mirrors from the first enabled write.
Notifications reference relationship/request resources but are not the relationship source of truth.
Use authenticated REST operations for durable state changes; Socket.IO may announce changes to the affected users but must not own them.
Goal
Create the durable, server-authorized relationship model that every Friend System surface can depend on.
Product contract
Authenticated users can:
State transitions must be idempotent. A crossed request may become an accepted friendship instead of creating two requests. Self-requests, duplicate relationships, blocked pairs, and unauthorized transitions are rejected consistently.
Blocking is directional and overrides friendship state:
Data and API design
Acceptance criteria
Dependencies
Launch gate
Non-goals