This is the frontend for a real-time chat application built with Next.js, React, and Socket.IO. It provides a modern, responsive interface for users to engage in private one-on-one conversations and participate in group chats.
- User Authentication: Secure registration and login for users.
- One-to-One Chat: Real-time private messaging between users.
- Group Chat: Create, join, and message in group conversations.
- Real-time Updates:
- Live message delivery.
- User online/offline status indicators.
- "User is typing..." indicators for both private and group chats.
- Message Status: See message read receipts (✓ for sent, ✓✓ for read).
- State Management: Global state for authentication is managed using Zustand.
- Responsive Design: A clean, mobile-friendly UI built with Tailwind CSS.
- Framework: Next.js 15
- UI Library: React 19
- Language: TypeScript
- Styling: Tailwind CSS
- Real-time Communication: Socket.IO Client
- State Management: Zustand
- HTTP Client: Axios
Follow these instructions to get a copy of the project up and running on your local machine for development and testing purposes.
- Node.js (v20 or later)
- npm, yarn, or pnpm
- A running instance of the chat app backend.
-
Clone the repository:
git clone https://github.com/VidhuPrakash/chat_app_frontend.git cd chat_app_frontend -
Install dependencies:
npm install # or yarn install # or pnpm install
-
Create an environment file: Create a
.env.localfile in the root of the project and add the URL of your backend server.# .env.local NEXT_PUBLIC_API_URL=http://localhost:5000
Replace
http://localhost:5000with the actual URL where your backend is running. -
Run the development server:
npm run dev
Open http://localhost:3000 with your browser to see the application.
The project follows a modular, feature-based architecture to keep the codebase organized and scalable.
src/
├── app/ # Next.js App Router: Contains all pages and layouts.
├── hooks/ # Custom React hooks (e.g., useDebounce).
├── lib/ # Core logic and utilities:
│ ├── api.ts # Pre-configured Axios instance for API requests.
│ ├── socket.ts # Socket.IO connection management.
│ ├── store.ts # Zustand store for global state management (auth).
│ └── types.ts # TypeScript type definitions.
├── module/ # Feature-based modules (chat, login, register).
│ ├── chat/
│ ├── login/
│ └── register/ # Each module contains components, services, and views.
└── theme/ # Global styles and Tailwind CSS configuration.
In the project directory, you can run:
npm run dev: Starts the development server onhttp://localhost:3000.npm run build: Builds the application for production.npm run start: Starts the production server after a build.npm run lint: Lints the code using ESLint to find and fix problems.