A real-time chat application that allows users to communicate instantly with friends, family, or colleagues. Built with modern web technologies to provide a seamless messaging experience.
- Features
- Demo
- Prerequisites
- Installation
- Environment Setup
- Building the Application
- Running the Application
- Usage
- Screenshots
- Technologies Used
- Project Structure
- Contributing
- License
- π Real-time messaging - Instant message delivery using WebSocket technology
- π₯ Multiple chat rooms - Create and join different chat rooms
- π€ User authentication - Secure login and registration system
- π± Responsive design - Works seamlessly on desktop and mobile devices
- π Emoji support - Express yourself with emojis
- π Message notifications - Get notified when new messages arrive
- πΈ Media sharing - Share images and files (if implemented)
- π Dark/Light mode - Toggle between themes (if implemented)
- β Message status - See when messages are delivered and read
- π Online status - See who's currently online
π Live Demo: [Your deployed app URL here]
Before you begin, ensure you have the following installed on your system:
- Node.js (version 16.0 or higher)
- npm (comes with Node.js)
- Git
- A modern web browser (Chrome, Firefox, Safari, Edge)
-
Clone the repository
git clone https://github.com/Atharva0745/Chat-App.git
-
Navigate to the project directory
cd Chat-App -
Install dependencies
npm install
-
Create a
.envfile in the root directory of the project:touch .env
-
Add your environment variables to the
.envfile:# Server Configuration PORT=3000 NODE_ENV=development # Database Configuration (MongoDB/PostgreSQL) DATABASE_URL=mongodb://localhost:27017/chatapp # OR for PostgreSQL: DATABASE_URL=postgresql://username:password@localhost:5432/chatapp # JWT Configuration JWT_SECRET=your_super_secret_jwt_key_here
β οΈ Important:- Never commit your
.envfile to version control - Replace all placeholder values with your actual credentials
- Keep your JWT_SECRET long and secure
- Never commit your
To build the application for production, run:
npm run buildThis command will:
- β Compile and optimize your React/Frontend code
- β Minimize CSS and JavaScript files
- β Generate production-ready static files
- β Create optimized bundles for better performance
- β
Output files to
build/ordist/directory
# Start both frontend and backend
npm start
# OR start them separately
npm run dev # Start backend server
npm run client # Start frontend (if separate)After building the application:
npm run serve
# OR
node server.jsThe application will be available at:
- Frontend:
http://localhost:3000 - Backend API:
http://localhost:5000(if separate)
- Register/Login: Create a new account or login with existing credentials
- Join a Room: Enter a chat room name or join an existing one
- Start Chatting: Begin sending messages in real-time
- Invite Friends: Share room codes with friends to chat together
- Send Messages: Type in the message box and press Enter or click Send
- Create Rooms: Click "New Room" to create a private chat room
- User Management: See who's online and their status
- Message History: Scroll up to see previous messages
- Settings: Customize your profile and preferences
Add screenshots of your chat application here:
User authentication interface with secure login
Main chat interface showing real-time messaging
Responsive design optimized for mobile devices
Interface for joining or creating chat rooms
π Where to add images:
- Create a
screenshotsfolder in your repository root - Add PNG/JPG images (max 1200px width recommended)
- Use descriptive filenames like
chat-interface.png - Compress images to keep repository size manageable
π When to add screenshots:
- After implementing major UI features
- Before releasing new versions
- When the interface design changes
- To showcase mobile responsiveness
- After adding new chat features
- React.js - User interface library
- Socket.IO Client - Real-time bidirectional communication
- CSS3/SCSS - Styling and animations
- React Router - Navigation and routing
- Axios - HTTP client for API requests
- Node.js - Runtime environment
- Express.js - Web application framework
- Socket.IO - Real-time communication
- MongoDB/PostgreSQL - Database for storing messages and users
- Mongoose/Prisma - Database ORM/ODM
- JWT - Authentication and authorization
- bcryptjs - Password hashing
- cors - Cross-origin resource sharing
- dotenv - Environment variable management
- multer - File upload handling (if implemented)
- cloudinary - Image storage and optimization (if implemented)
Chat-App/
βββ client/ # Frontend React application
β βββ public/
β βββ src/
β β βββ components/ # Reusable UI components
β β βββ pages/ # Page components
β β βββ hooks/ # Custom React hooks
β β βββ utils/ # Helper functions
β β βββ context/ # React context providers
β β βββ App.js # Main App component
β βββ package.json
βββ server/ # Backend Node.js application
β βββ controllers/ # Route controllers
β βββ middleware/ # Custom middleware
β βββ models/ # Database models
β βββ routes/ # API routes
β βββ utils/ # Helper functions
β βββ server.js # Main server file
βββ screenshots/ # App screenshots for README
βββ .env.example # Environment variables template
βββ .gitignore # Git ignore file
βββ package.json # Main package.json
βββ README.md # This file
POST /api/auth/register- Register new userPOST /api/auth/login- User loginGET /api/auth/me- Get current userPOST /api/auth/logout- User logout
GET /api/rooms- Get all chat roomsPOST /api/rooms- Create new roomGET /api/rooms/:id/messages- Get room messagesPOST /api/rooms/:id/messages- Send message
GET /api/users- Get all usersPUT /api/users/profile- Update user profile
We welcome contributions! Here's how you can help:
- Fork the repository on GitHub
- Create your 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 with a clear description
- Follow existing code style and formatting
- Add comments for complex logic
- Update README if you add new features
- Test your changes thoroughly
- Make sure all tests pass
π¨ Build fails
# Clear npm cache and reinstall
npm cache clean --force
rm -rf node_modules package-lock.json
npm installπ¨ Environment variables not working
- Ensure
.envfile is in the root directory - Check that variable names match exactly
- Restart the server after changing
.env
π¨ Database connection issues
- Verify your database is running
- Check DATABASE_URL in
.envfile - Ensure database credentials are correct
π¨ Socket.IO connection problems
- Check CORS_ORIGIN in
.envmatches your frontend URL - Verify firewall isn't blocking the connection
- Check browser console for WebSocket errors
π¨ Port already in use
# Find and kill process using the port
lsof -ti:3000 | xargs kill -9 # Mac/Linux
netstat -ano | findstr :3000 # Windows- Install Heroku CLI
- Create a new Heroku app
- Set environment variables in Heroku dashboard
- Deploy using Git
- Connect your GitHub repository
- Set build command:
npm run build - Set environment variables
- Deploy automatically on push
This project is licensed under the MIT License - see the LICENSE file for details.
Developer: Atharva
GitHub: @Atharva0745
Repository: Chat-App
Made with β€οΈ by Atharva