Tech Stack: Spring Boot | SockJS | Redis | MongoDB | ReactJS | TypeScript
Head to the frontend repository.
![Screenshot 2024-05-21 at 12 04 09 PM](https://private-user-images.githubusercontent.com/75425384/332498162-a7b1f3a2-4324-484a-918e-704c74c07af7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTg4MDkwMzksIm5iZiI6MTcxODgwODczOSwicGF0aCI6Ii83NTQyNTM4NC8zMzI0OTgxNjItYTdiMWYzYTItNDMyNC00ODRhLTkxOGUtNzA0Yzc0YzA3YWY3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjE5VDE0NTIxOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTUzOTc5Y2Y2MjFkYjZjMzhjMGU3MWQ5N2I1NTM4MzkxZWQ4YzY3NDU0YTM3ZWFmY2YwNmQ5YjE1M2EwZjY1NzQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.CWENsgqO2BiW04q5QdsmMuEqHEiI7S-JM_Ei7XYIn4A)
![Screenshot 2024-05-21 at 12 35 11 PM](https://private-user-images.githubusercontent.com/75425384/332507166-a3997e0a-fd1c-426e-a8b4-780ab1179f2c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTg4MDkwMzksIm5iZiI6MTcxODgwODczOSwicGF0aCI6Ii83NTQyNTM4NC8zMzI1MDcxNjYtYTM5OTdlMGEtZmQxYy00MjZlLWE4YjQtNzgwYWIxMTc5ZjJjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjE5VDE0NTIxOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTM2YjIwZmQxMzQ4YTI3ZWI5YjIyYmVkZTQ5MTdlN2FmMjU5OTk3MjVlZGU5N2ZlMjIwN2ExNTJhMmIwZTRjMzUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.lW2tdF_MHybaTDhirmd4bDA7wNjt9XmVHoAZOEPvmQk)
![Screenshot 2024-05-21 at 12 34 38 PM](https://private-user-images.githubusercontent.com/75425384/332507027-371d1cba-5a9b-4449-84d4-ae32f3d3c7ed.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTg4MDkwMzksIm5iZiI6MTcxODgwODczOSwicGF0aCI6Ii83NTQyNTM4NC8zMzI1MDcwMjctMzcxZDFjYmEtNWE5Yi00NDQ5LTg0ZDQtYWUzMmYzZDNjN2VkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjE5VDE0NTIxOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTRmN2NkYmVjMmYzYzhiYjY4Njg4NmM3OGI3MjExNjE0ZjNlMTA3YjRhMjA4MDNhMWQwYWEyNmVlYTZiMDUwYzgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.PYQAfDVKcZQaZREptnsISsY1OeM5qdhnB97byuQ-LA0)
- Created Conflict-free Replicated Data Type (CRDT) for todo list items.
- Achieved real-time synchronization across clients using WebSockets.
- Implemented asynchronous writing to database to ensure incoming todo list updates are quickly propagated to other clients, enhancing real-time collaboration.
- Ensured offline capability by utilizing service workers and local storage to cache data and enable uninterrupted access to todo lists even without an internet connection.
The architecture of WeDoList is designed to facilitate real-time collaborative editing of a todo list, ensuring all clients stay synchronized with the latest updates. Here’s a detailed explanation of each component and their interactions:
-
MongoDB:
- Role: Acts as the primary database to store the most recent version of the todo list.
- Interaction: Provides the latest list to the Merge Lists Service and receives updates from it.
-
Merge Lists Service:
- Role: Central service responsible for merging updates and maintaining the integrity of the todo list.
- Interaction:
- Fetches the latest list from MongoDB.
- Processes updates and merges changes.
- Sends the updated list back to MongoDB.
- Provides the updated list to the API/WebSocket service.
-
API/WebSocket Service:
- Role: Manages client connections and ensures real-time synchronization.
- Interaction:
- Receives the list of clients from Redis.
- Distributes the updated todo list to all connected clients using WebSockets.
- Receives updates from clients and forwards them to the Merge Lists Service for processing.
-
Redis:
- Role: Stores the list of currently connected clients.
- Interaction: Provides the list of clients to the API/WebSocket service to manage client communications effectively.
-
Clients:
- Role: Users interacting with the todo list application.
- Interaction:
- Receive real-time updates of the todo list from the API/WebSocket service.
- Send updates when they make changes to their todo list.
-
Initialization:
- The latest todo list is fetched from MongoDB by the Merge Lists Service.
- This list is then provided to the API/WebSocket service, which handles client synchronization.
-
Client Interaction:
- Clients connect to the application through the API/WebSocket service.
- Redis maintains a list of these connected clients.
-
Real-time Updates:
- When a client updates their todo list, the update is sent to the API/WebSocket service.
- The API/WebSocket service forwards this update to the Merge Lists Service.
- The Merge Lists Service processes the update, merges any changes, and updates MongoDB.
- The updated list is then sent back to the API/WebSocket service, which broadcasts it to all connected clients, ensuring everyone has the latest version.
-
Offline Capability:
- Clients can continue to use the application offline thanks to service workers and local storage, which cache the data locally. Once reconnected, any changes made offline are synchronized with the server.
This architecture ensures a seamless, real-time collaborative experience for users while maintaining data integrity and consistency across all clients.