π± Chat System Frontend
Github: github.com/le-minh-duc-dev/chat-system-frontend.git
This is the frontend of a scalable chat system built with React and TypeScript, designed for performance and maintainability. It supports real-time communication, JWT-based authentication, and presence tracking. The system is integrated with backend services via REST and WebSocket using STOMP protocol.
βοΈ Tech Stack
- React
- TypeScript for static typing
- Redux Toolkit for app-wide state management
- TanStack Query (React Query) for async data fetching and caching
- TanStack Virtual for performant list virtualization
- HeroUI for accessible UI components
- STOMP over WebSocket for real-time chat via
@stomp/stompjs
- Axios with JWT token refresh interceptor
π Highlights
- β‘ Virtualized Lists: Efficient rendering of large chat history using
TanStack Virtual
. - π Secure Authentication: JWT access/refresh token handling with auto-refresh and retry queue.
- π§ Optimistic UI: Instant UI updates with intelligent caching via TanStack Query.
- π Real-time Communication: Bi-directional WebSocket messaging via STOMP protocol.
- π Presence Tracking: Tracks user online status via heartbeat logic.
- π§° Modular DTO Models: Strongly typed classes/interfaces for API responses.
π Axios Interceptor
Handles:
- Automatic token refresh on
401
- Retry queue for requests during refresh
- Logout redirection when refresh fails
π Client-Side Routing
This frontend application is built as a Single Page Application (SPA) using Tanstack Router to manage in-app navigation without full page reloads. It supports public and protected routes with authentication status.
π¦ Routing Features
- Protected Routing: Check authentication status to secure authenticated routes
- Route Redirection: Automatically redirects unauthenticated users to
/login
π Route Structure
Path | Component | Access | Description |
---|---|---|---|
/ | App | π Protected | Default landing page after login |
/chat | Chat | π Protected | Main chat interface |
/chat/{id} | Chat | π Protected | Chat room interface |
/profile | Profile | π Protected | User profile dashboard |
/login | Login | π Public | Login screen for unauthenticated users |
/register | Register | π Public | User account registration |
π· User Interface Screenshots
Below are screenshots showcasing the main user interface of the chat system.
π Authentication
- Login Page

- Register Page

π Navigation
- Drawer Page
π¬ Chat Functionality
-
Chat Room
-
Create Room
-
Join Room
π€ User Profile Management
-
User Profile
-
Update Profile