A modern, real-time chat application built with Next.js, Socket.IO, and TypeScript. Features a beautiful dark theme UI and supports group chats with real-time typing indicators.
-
🔒 Secure Authentication
- JWT-based authentication
- Protected routes and API endpoints
-
💬 Real-time Chat
- Instant message delivery
- Group chat support
- Message history
- Typing indicators
- Read receipts
-
👥 Group Management
- Create new groups
- Add/remove members
- Transfer group ownership
- Leave groups
- Member list with roles
-
🎨 Modern UI/UX
- Responsive design
- Dark theme
- Beautiful animations
- Loading states
- Toast notifications
-
Frontend
- Next.js 14
- TypeScript
- Socket.IO Client
- Tailwind CSS
- Radix UI Components
- Zustand (State Management)
-
Backend Requirements
- Node.js server with Socket.IO
- RESTful API endpoints
- JWT Authentication
- MongoDB (recommended)
- Node.js 18+ and npm
- Backend API server running (default:
http://localhost:3001
)
-
Clone the repository:
git clone https://github.com/yourusername/chatter-frontend.git cd chatter-frontend
-
Install dependencies:
npm install
-
Create a
.env.local
file:NEXT_PUBLIC_API_URL=http://localhost:3001/api NEXT_PUBLIC_SOCKET_URL=ws://localhost:3001
-
Start the development server:
npm run dev
-
Build for production:
npm run build npm run start
NEXT_PUBLIC_API_URL
: Backend API URLNEXT_PUBLIC_SOCKET_URL
: WebSocket server URL
The application expects the following API endpoints:
POST /api/auth/login
POST /api/auth/register
GET /api/groups/all-member-groups
GET /api/groups/not-member-groups
POST /api/groups/create
POST /api/groups/change-owner
POST /api/groups/leave/:groupId
GET /api/messages/group/:groupId
POST /api/messages/text
joinGroup
: When user enters a chatleaveGroup
: When user leaves a chatgroupMessage
: When user sends a messagestartTyping
: When user starts typingstopTyping
: When user stops typing
groupMessage
: Receive new messagesuserTyping
: Someone started typinguserStoppedTyping
: Someone stopped typing
├── app/
│ ├── components/ # Shared components
│ ├── chat/ # Chat related pages
│ ├── home/ # Home page
│ └── store/ # Global state management
├── lib/
│ ├── models/ # TypeScript interfaces
│ └── services/ # API and Socket services
├── public/ # Static assets
└── styles/ # Global styles
-
Build the static export:
npm run build
-
Deploy the
out
directory to your hosting service
Make sure to configure these environment variables in your hosting platform:
NEXT_PUBLIC_API_URL
NEXT_PUBLIC_SOCKET_URL
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ by [Your Name]