How s4kr3d-w0r1d/whatsapp-clone works
Main Components
• Frontend Client: Represented by the React-based application located under “whatsapp-clone/newfrontend”. This layer includes all UI components for authentication, chat windows, group management, media sharing, profile management, etc.
• Backend Server: A Spring Boot application (under “whatsapp-clone/src/main/java”) handling business logic. It includes controllers for authentication, chat (private and group), file upload, user blocking, and real-time WebSocket messaging.
• WebSocket Layer: The backend’s configuration for WebSocket communications (see files such as WebSocketConfig.java, CustomHandshakeInterceptor.java, WsChatController.java) that enable real-time one-to-one and group messaging using STOMP over WebSocket.
• Database: Although not explicitly represented in the file tree, the README mentions PostgreSQL as the database. This will store user data, chat messages, groups, and metadata.
• Media/File Storage: A component for managing media uploads. The FileUploadController and FileStorageService handle file uploads (media is stored on disk as indicated in the README, e.g., on “C:/uploads/chat”).
Out Relationships & Interactions
• From Frontend → Backend REST API endpoints (e.g., AuthController, FileUploadController).
• From Frontend ↔ Backend via WebSocket (using STOMP in the client and configurations like WebSocketConfig.java on the server).
• Backend and Database: Show a connection from the backend to PostgreSQL (via Spring Data JPA and Hibernate) for persistent operations.
• Security: Illustrate the JWT-based authentication flow, with the Authentication Filter (JwtAuthenticationFilter), CustomUserDetailsService, and SecurityConfig ensuring secure API and WebSocket connections.
Architectural Patterns & Design Principles
• Layered Architecture: The backend is organized into controllers, services, repositories, and models, aligning with a traditional MVC but expanded to include WebSocket handling.
• Separation of Concerns: The clear split between frontend and backend, and within the backend (controllers for request handling, services for business logic, repositories for data access) should be visibly emphasized.
• Real-Time Messaging: The integration of WebSocket communication alongside RESTful endpoints distinguishes this full-stack design. Show how WebSocket endpoints are integrated (via annotations and configuration files found under the “config” package).
Technologies & Frameworks
• Frontend: Vite, React.js, HTML/CSS/JavaScript, and libraries like SockJS and STOMP.js.
• Backend: Java, Spring Boot, Spring Data JPA, Spring Security, Spring WebSocket with STOMP, JWT.
• Build Tools: Maven (for backend) and Vite (for frontend).
• Database: PostgreSQL
Elements
• Use clear labels for every component. For example:
• “React Client (Vite)” for the frontend.
• “Spring Boot REST API” and “WebSocket API (STOMP)” for backend services.
• “JWT Authentication & Security” as an aspect of the backend.
• “PostgreSQL Database” and “Media/File Storage”.
• From the user’s browser (frontend) to the REST endpoints.
• Under the backend modules, further decompose into groups showing Controllers, Services, and Repositories. Optionally, indicate cross-cutting concerns like Security configurations.