MyMess is a social network application where users can make friends and communicate with each other.
A short demo can be found here.
The application is built on 3 servers:
- front-end service (using Angular) (running on port 4200)
- back-end service (using Kotlin Spring Boot (running on port 2020)
- notification socket service (using Node.js and socket.io (running on port 2021)
The back-end server is built on multi-layer-architecture:
- Presentation Layer (responsible for the controllers/user interface)
- Bussiness Layer (responsible for the logic and functionality)
- Persistence/Database Layer (responsible for CRUD operations)
Password are encrypted using SHA-256.
The service is using 4 collections (can be scaled and integrated with a MongoDb database):
- actives - contains uid - last time (unix) seen online (0 if the user is online)
- allUsers - contains socket id, friendId, and username
- socketsUidPair - contains socket id - uid
- unseenFrom - contains uid - list of unseen messages from user
Note
: actives is initialized with mock Data.
Events handled:
- establish-connection - the user connects and gets back a list with unseen messages
- notify-is-typing - the user's friend (if it is online) is notified that current user is typing
- notify-stop-typing - the user's friend (if it is online) is notified that current user has stopped typing
- friend-ids - the user request the list of friends ids and their last time seen online
- send-chat-message - the user send a message to a friend and the message is redirected to backend service. If the user is online the message is sent to him to be updated live
- send-message-notifications - the user send a message notification to a friend
- message-notification-clear - the user notifies socket server to clear its message notification
- logout - update socket server's collections
Events emited:
- message-notifications - on establish connection user receives notifications from received messages
- receive-is-typing - on notify-is-typing friend receives typing notification from his friend
- receive-stop-typing - on notify-stop-typing friend receives stop typing notification from his friend
- take-friends-status - on friend-ids user receives his friends' status
- receive-chat-message - on send-chat-message friend receives the incoming message
- notify-inbox - on send-chat-message friend receives the incoming message notification for the inbox
- message-notifications - on send-message-notifications friend receives the incoming message notification for a specific user in the inbox
-
Configure PostgreSQL
- Make a database
- Change the backend configuration with the created database's configuration
- Change python script for creating the database's tables with the created database's configuration
-
Run python script for creating the tables and for inserting the initial data (users passwords can be found in users.json)
-
Run the backend service
-
Run the notification service
npm install
node App.js
-
Run the frontend service
npm install
ng serve
Note
: Reconnecting to socket on refreshing the frontend page from the browser when logged in was not implemented.