A modern, feature-rich real-time chat application with beautiful UI/UX, built with Next.js 15, React 19, and WebSocket technology.
Features β’ Tech Stack β’ Getting Started β’ Structure β’ API
This frontend connects to a high-performance Go backend:
- β Stunning hero section with animated gradients
- β Interactive feature showcase
- β Pricing plans with smooth animations
- β Responsive design for all devices
- β Newsletter subscription
- β Modern footer with social links
- β Instant message delivery via WebSocket
- β Private 1-on-1 conversations
- β Group chat rooms with multiple participants
- β Message read receipts (delivered/read status)
- β Typing indicators
- β Online/offline/away status
- β Message reactions and emojis
- β File sharing support
- β Image preview
- β User registration with validation
- β Secure login with JWT authentication
- β User profile with avatar
- β User discovery and search
- β Friend requests
- β User status management
- β Create and manage chat rooms
- β Group creation with member selection
- β Channel sidebar with conversations
- β Message history and pagination
- β Unread message counter
- β Notification center
- β Emote panel
- β User discovery panel
- β Beautiful gradient animations
- β Smooth transitions with Framer Motion
- β Dark mode optimized
- β Responsive mobile design
- β Skeleton loaders for better UX
- β Toast notifications
- β Modal dialogs
- β Custom scrollbars
- Next.js 15 - React framework with App Router
- React 19 - Latest React with concurrent features
- TypeScript 5 - Type-safe development
- Tailwind CSS 3.4 - Utility-first CSS framework
- Radix UI - Accessible component primitives
- shadcn/ui - Re-usable components built with Radix
- Framer Motion - Production-ready animations
- Lucide React - Beautiful & consistent icons
- React Hook Form - Performant forms
- Zod - TypeScript-first schema validation
- Axios - HTTP client for API requests
- date-fns - Modern date utility library
- WebSocket - Bi-directional real-time communication
- Custom WebSocket hooks for chat functionality
- Event-driven architecture
- Sonner - Toast notifications
- React Intersection Observer - Lazy loading
- cmdk - Command palette
- Recharts - Charting library
- Embla Carousel - Carousel component
Make sure you have the following installed:
- Clone the repository
git clone https://github.com/dinhdev-nu/chat_app_ui.git
cd chat_app_ui- Install dependencies
pnpm install- Set up environment variables
Create a .env.local file in the root directory:
# API Configuration
NEXT_PUBLIC_API_URL=http://localhost:8080/api/v1
NEXT_PUBLIC_WS_URL=ws://localhost:8080/ws
# Local Storage Keys
NEXT_PUBLIC_SESSION_KEY=chat_session
NEXT_PUBLIC_USER_KEY=chat_user
# App Configuration
NEXT_PUBLIC_APP_NAME=CommuniHub
NEXT_PUBLIC_APP_URL=http://localhost:3000- Run the development server
pnpm devOpen http://localhost:3000 in your browser.
# Create production build
pnpm build
# Start production server
pnpm startchat_app_ui/
β
βββ π app/ # Next.js App Router
β βββ π (auth)/ # Authentication routes
β β βββ layout.tsx # Auth layout
β β βββ π login/ # Login page
β β βββ π signup/ # Signup page
β β
β βββ π chat/ # Chat application
β β βββ page.tsx # Main chat interface
β β βββ π conversation/ # Conversation routes
β β βββ π discord/ # Discord-style chat
β β
β βββ layout.tsx # Root layout
β βββ page.tsx # Landing page
β βββ globals.css # Global styles
β βββ client-wrapper.tsx # Client-side wrappers
β
βββ π components/ # React components
β βββ π chat/ # Chat-specific components
β β βββ chat-header.tsx # Chat header
β β βββ chat-messages.tsx # Message list
β β βββ chat-sidebar.tsx # Sidebar with conversations
β β βββ conversation-item.tsx # Conversation list item
β β βββ emote-panel.tsx # Emoji/emote selector
β β βββ group-chat-messages.tsx # Group chat messages
β β βββ group-creation-modal.tsx # Create group modal
β β βββ immersive-chat-interface.tsx # Main chat UI
β β βββ notification-center.tsx # Notifications
β β βββ skeleton-loaders.tsx # Loading states
β β βββ user-discovery.tsx # Find users
β β
β βββ π ui/ # shadcn/ui components
β β βββ button.tsx # Button component
β β βββ card.tsx # Card component
β β βββ dialog.tsx # Dialog/Modal
β β βββ input.tsx # Input field
β β βββ avatar.tsx # Avatar component
β β βββ badge.tsx # Badge component
β β βββ toast.tsx # Toast notifications
β β βββ ... # 40+ UI components
β β
β βββ navbar.tsx # Navigation bar
β βββ hero.tsx # Hero section
β βββ footer.tsx # Footer
β βββ chat-interface.tsx # Landing chat demo
β βββ community-features.tsx # Features section
β βββ join-community.tsx # CTA section
β βββ login-form.tsx # Login form
β βββ registration-form.tsx # Signup form
β βββ ... # Other components
β
βββ π config/ # Configuration files
β βββ axios.config.ts # Axios instance with auth
β
βββ π hooks/ # Custom React hooks
β βββ use-toast.ts # Toast hook
β βββ use-mobile.tsx # Mobile detection
β βββ use-media-query.ts # Media query hook
β
βββ π lib/ # Shared utilities
β βββ π api/ # API functions
β β βββ chat.ts # Chat API calls
β β
β βββ π hooks/ # Advanced hooks
β β βββ use-init-chat.ts # Initialize chat
β β βββ use-get-group.ts # Fetch groups
β β
β βββ utils.ts # Utility functions
β βββ mock-data.ts # Mock data for demo
β βββ mock-notifications-data.ts # Mock notifications
β
βββ π types/ # TypeScript type definitions
β βββ auth.ts # Auth types
β βββ chat.ts # Chat & message types
β βββ user.ts # User types
β
βββ π public/ # Static assets
β βββ ... # Images, icons, etc.
β
βββ π styles/ # Additional styles
β βββ globals.css # Extra global styles
β
βββ .env.local # Environment variables (local)
βββ .gitignore # Git ignore rules
βββ components.json # shadcn/ui config
βββ next.config.mjs # Next.js configuration
βββ package.json # Dependencies & scripts
βββ pnpm-lock.yaml # Lockfile
βββ postcss.config.mjs # PostCSS config
βββ tailwind.config.ts # Tailwind configuration
βββ tsconfig.json # TypeScript config
βββ README.md # This file
The heart of the application with all chat features:
// components/chat/immersive-chat-interface.tsx
- WebSocket connection management
- Real-time message handling
- User status tracking
- Typing indicators
- Message read receipts
- Group & private conversationsSecure login and registration:
// components/login-form.tsx & registration-form.tsx
- Form validation with Zod
- JWT token management
- Protected routes
- Auto-redirect after loginBeautiful, animated landing page:
// components/hero.tsx, community-features.tsx, join-community.tsx
- Framer Motion animations
- Gradient effects
- Responsive design
- Interactive elementsPOST /api/v1/auth/register // User registration
POST /api/v1/auth/login // User login
GET /api/v1/auth/me // Get current userPOST /api/v1/chat/create-room // Create chat room
GET /api/v1/chat/get-messages // Fetch messages
POST /api/v1/chat/set-status // Update read status
GET /api/v1/chat/search-user // Search users
GET /api/v1/chat/get-groups // Fetch user groups// Client -> Server
message // Send message
typing // Typing indicator
read // Mark as read
subscribe // Subscribe to user updates
status // Update user status
// Server -> Client
message // Receive message
typing // User typing
read // Message read
status // User status update
ack // Message acknowledgment
room_created // New room notification| Variable | Description | Example |
|---|---|---|
NEXT_PUBLIC_API_URL |
Backend API base URL | http://localhost:8080/api/v1 |
NEXT_PUBLIC_WS_URL |
WebSocket server URL | ws://localhost:8080/ws |
NEXT_PUBLIC_SESSION_KEY |
LocalStorage key for session | chat_session |
NEXT_PUBLIC_USER_KEY |
LocalStorage key for user data | chat_user |
NEXT_PUBLIC_APP_NAME |
Application name | CommuniHub |
NEXT_PUBLIC_APP_URL |
Frontend URL | http://localhost:3000 |
The application is fully responsive across all devices:
- π± Mobile (< 768px) - Optimized touch interface
- π± Tablet (768px - 1024px) - Adaptive layout
- π» Desktop (> 1024px) - Full feature set
Edit tailwind.config.ts to customize the color scheme:
colors: {
primary: '#6366f1', // Indigo
secondary: '#a855f7', // Purple
accent: '#ec4899', // Pink
}Modify app/layout.tsx to change fonts:
import { Inter } from 'next/font/google'Adjust animation timings in app/globals.css:
.animate-gradient {
animation: gradient-shift 15s ease infinite;
}# Development
pnpm dev # Start dev server
pnpm dev --turbo # Start with Turbopack
# Building
pnpm build # Create production build
pnpm start # Start production server
# Code Quality
pnpm lint # Run ESLintContributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
dinhdev-nu
- GitHub: @dinhdev-nu
- Email: truongbadinh13579@gmail.com
- Next.js - The React Framework
- shadcn/ui - Beautiful UI components
- Radix UI - Accessible primitives
- Tailwind CSS - Utility-first CSS
- Framer Motion - Animation library
- Lucide - Icon library
If you have any questions or need help, feel free to:
- π§ Email: truongbadinh13579@gmail.com
- π Open an issue
- π¬ Start a discussion