Any good guide/tutorial on creating DMs / Direct Messaging features?

Options

I have user accounts but I want to add a messaging feature.

  • What might the backend and data structure look like?
  • Is there any way to end to end encrypt it?
  • Anything i should think about when creating this that I might be missing here?


Basic DM functionality:

  • A DM/Messgaes system where each user can have multiple conversations
  • Message time stamps
  • Read/Unread message status
  • Search DMs


Advanced DM functionality:

  • Permission to DM requests
  • Share a post directly in DM, and show post preview
  • Share images

Any tips, tutorials or advice is welcome.