A real-time chat application built with React and Node.js featuring instant messaging, file sharing, and user authentication.
Experience the app in action at: https://quiktalk-chat-app.onrender.com
- Live Demo
- Overview
- Features
- Tech Stack
- Project Structure
- Prerequisites
- Installation
- Configuration
- Running the Application
- API Documentation
- Socket Events
- Database Schema
- Contributing
- License
QuikTalk is a modern, responsive chat application that enables users to communicate in real-time. Built with a React frontend and Express.js backend, it utilizes Socket.io for instant messaging and MongoDB for data persistence.
- Real-time Messaging: Instant message delivery using WebSocket connections
- User Authentication: Secure JWT-based authentication system
- Profile Management: User profile creation and customization
- File Sharing: Upload and share files in conversations
- Contact Management: Search and add contacts for direct messaging
- Responsive Design: Mobile-friendly interface built with Tailwind CSS
- Modern UI: Clean interface using Radix UI components
- Dark/Light Theme: Theme switching support
- Emoji Support: Emoji picker for enhanced messaging
- Avatar System: Custom avatars with color themes
- React 18 - JavaScript library for building user interfaces
- Vite - Fast build tool and development server
- React Router - Client-side routing
- Tailwind CSS - Utility-first CSS framework
- Radix UI - Headless UI component library
- Zustand - State management
- Socket.io Client - Real-time communication
- Axios - HTTP client
- Lucide React - Icon library
- React Lottie - Animation library
- Node.js - JavaScript runtime
- Express.js - Web application framework
- Socket.io - Real-time bidirectional communication
- MongoDB - NoSQL database
- Mongoose - MongoDB object modeling
- JWT - JSON Web Tokens for authentication
- bcrypt - Password hashing
- Multer - File upload handling
- Zod - Schema validation
QuikTalk-Chat-App/
├── client/ # Frontend application
│ ├── public/ # Static assets
│ ├── src/
│ │ ├── assets/ # Images and animations
│ │ ├── components/ # Reusable UI components
│ │ │ ├── ui/ # Base UI components
│ │ │ └── contact-list.jsx # Contact management
│ │ ├── context/ # React context providers
│ │ │ └── SocketContext.jsx # Socket.io context
│ │ ├── lib/ # Utility libraries
│ │ │ ├── api-client.js # API client configuration
│ │ │ └── utils.js # Helper functions
│ │ ├── pages/ # Application pages
│ │ │ ├── auth/ # Authentication pages
│ │ │ ├── chat/ # Chat interface
│ │ │ └── profile/ # User profile
│ │ ├── store/ # State management
│ │ │ ├── index.js # Store configuration
│ │ │ └── slices/ # State slices
│ │ └── utils/
│ │ └── constants.js # API endpoints and constants
│ ├── package.json
│ └── vite.config.js
├── server/ # Backend application
│ ├── controllers/ # Route controllers
│ │ ├── AuthController.js # Authentication logic
│ │ ├── ContactController.js # Contact management
│ │ └── MessagesController.js # Message handling
│ ├── middlewares/ # Express middlewares
│ │ └── AuthMiddleware.js # JWT authentication
│ ├── models/ # Database models
│ │ ├── UserModel.js # User schema
│ │ └── MessagesModel.js # Message schema
│ ├── routes/ # API routes
│ │ ├── AuthRoutes.js # Authentication routes
│ │ ├── ContactRoutes.js # Contact routes
│ │ └── MessagesRoutes.js # Message routes
│ ├── uploads/ # File upload storage
│ │ ├── files/ # Shared files
│ │ └── profiles/ # Profile images
│ ├── index.js # Server entry point
│ ├── socket.js # Socket.io configuration
│ └── package.json
└── README.md
Before running this application, make sure you have the following installed:
- Node.js (v16 or higher)
- npm or yarn
- MongoDB (local installation or MongoDB Atlas)
-
Clone the repository
git clone https://github.com/Explore13/QuikTalk-Chat-App.git cd QuikTalk-Chat-App -
Install server dependencies
cd server npm install -
Install client dependencies
cd ../client npm install
Create a .env file in the server directory with the following variables:
# Server Configuration
PORT=3001
NODE_ENV=development
# Database
DATABASE_URL=mongodb://localhost:27017/quiktalk
# Or for MongoDB Atlas:
# DATABASE_URL=mongodb+srv://username:password@cluster.mongodb.net/quiktalk
# JWT Configuration
JWT_KEY=your-super-secret-jwt-key
# CORS
ORIGIN=http://localhost:5173
# File Upload (optional)
MAX_FILE_SIZE=5242880 # 5MB in bytesCreate a .env file in the client directory:
# API Configuration
VITE_SERVER_URL=http://localhost:3001-
Start the server
cd server npm run devThe server will start on
http://localhost:3001 -
Start the client (in a new terminal)
cd client npm run devThe client will start on
http://localhost:5173
-
Build the client
cd client npm run build -
Start the server
cd server npm start
| Method | Endpoint | Description | Body |
|---|---|---|---|
| POST | /api/auth/signup |
Register new user | { email, password } |
| POST | /api/auth/login |
User login | { email, password } |
| GET | /api/auth/user-info |
Get user profile | - |
| POST | /api/auth/update-profile |
Update user profile | { firstName, lastName, color } |
| POST | /api/auth/add-profile-image |
Upload profile image | FormData |
| DELETE | /api/auth/remove-profile-image |
Remove profile image | - |
| POST | /api/auth/logout |
User logout | - |
| Method | Endpoint | Description | Query |
|---|---|---|---|
| POST | /api/contacts/search |
Search users | { searchTerm } |
| GET | /api/contacts/get-contacts-for-dm |
Get user's contacts | - |
| Method | Endpoint | Description | Body |
|---|---|---|---|
| POST | /api/messages/get-messages |
Get conversation messages | { id } |
| POST | /api/messages/upload-file |
Upload file | FormData |
sendMessage- Send a new messagedisconnect- User disconnection
receiveMessage- Receive new messageconnection- Successful connection
{
sender: ObjectId, // Sender's user ID
recipient: ObjectId, // Recipient's user ID
messageType: "text|file", // Message type
content: String, // Text content (for text messages)
fileUrl: String, // File URL (for file messages)
timestamp: Date // Message timestamp
}{
email: String (required, unique),
password: String (required, hashed),
firstName: String,
lastName: String,
image: String, // Profile image URL
color: Number, // Avatar color theme
profileSetup: Boolean, // Profile completion status
timestamps: true
}{
sender: ObjectId (ref: Users),
recipient: ObjectId (ref: Users),
messageType: "text" | "file",
content: String, // Required for text messages
fileUrl: String, // Required for file messages
timestamp: Date
}- JWT Authentication: Secure token-based authentication
- Password Hashing: bcrypt for secure password storage
- CORS Protection: Configured for specific origins
- Input Validation: Zod schema validation
- File Upload Security: File type and size restrictions
- Authentication Middleware: Protected route access
The application uses a combination of custom and Radix UI components:
- Avatar: User profile pictures with fallbacks
- Button: Customizable button components
- Dialog: Modal dialogs for user interactions
- Input: Form input fields
- ScrollArea: Scrollable content areas
- Tabs: Tabbed interfaces
- Tooltip: Helpful tooltips
The application is fully responsive and works on:
- Desktop computers
- Tablets
- Mobile phones
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some 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.
-
Connection Issues
- Ensure MongoDB is running
- Check environment variables
- Verify CORS settings
-
File Upload Issues
- Check file size limits
- Verify upload directory permissions
- Ensure multer configuration is correct
-
Socket Connection Issues
- Verify server is running
- Check CORS configuration
- Ensure client is connecting to correct URL
For support, please open an issue on the GitHub repository or contact the development team.
Built with ❤️ by the Surya Ghosh