Microservices Chat App Documentation

Models Documentation

User Schema

FieldTypeRequiredUniqueDefaultDescription
usernameStringYesNo-The user's username.
emailStringYesYes-The user's email.
passwordStringYesNo-The user's password.
avatarStringNoNo""URL to the user avatar.
timestampsDateYes--CreatedAt and UpdatedAt

Chat Schema

FieldTypeRequiredDefaultDescription
usersArray of ObjectIds (User)Yes-References to the users in the chat.
latest_messageObjectId (Message)No-Reference to the latest message in the chat.
timestampsDateYes-CreatedAt and UpdatedAt

Message Schema

FieldTypeRequiredDefaultDescription
_idStringYes-Unique identifier for the message.
senderObjectId (User)Yes-Reference to the user sending the message.
chatIdObjectId (Chat)Yes-Reference to the chat the message belongs to.
receiverObjectId (Chat)Yes-Reference to the user or group receiving the message.
isfileBooleanNofalseIndicates if the message contains a file.
contentStringYes-The content of the message.
createdAtStringYes-Timestamp of when the message was created.
timestampsDateYes-CreatedAt and UpdatedAt

Subscription Schema

FieldTypeRequiredDefaultDescription
endpointStringYes-Endpoint for the subscription.
p256dhStringYes-Public encryption key.
authStringYes-Authentication secret.
userIdStringNo-Reference to the user associated with the subscription.
deviceNameStringNo-Name of the device for the subscription.
createdAtDateNoCurrent DateTimestamp of when the subscription was created.