A real-time chat application built with the MERN stack and Socket.io, providing a seamless messaging experience with real-time updates. This app leverages React for the frontend, Node.js with Express for the backend, MongoDB for data storage, and Redux Toolkit for efficient state management.
- Real-time Messaging: Enjoy instant messaging using WebSockets powered by Socket.io.
- User Authentication: Secure login and signup options.
- One-to-One Conversations: Private chats with real-time updates.
- User Profiles: Customize and edit your profile details.
- Responsive UI: Built with a mobile-first approach for an optimal user experience across devices.
- Frontend: React, Redux Toolkit
- Backend: Node.js, Express, Socket.io
- Database: MongoDB
- State Management: Redux Toolkit
- Real-time Communication: Socket.io
- Styling: Tailwind CSS
To run this application on your local machine, follow these steps.
Ensure you have the following installed:
-
Clone the repository:
git clone https://github.com/yourusername/full-stack-chat-app.git cd full-stack-chat-app
-
Install dependencies:
Navigate to both the
client
andserver
directories and install the dependencies for each:# For backend cd server npm install
# For frontend cd ../client npm install
-
Environment Variables:
In the
server
directory, create a.env
file for the following environment variables:MONGODB_URL=your_mongodb_connection_string JWT_SECRET_KEY=your_jwt_secret FRONTEND_URL = http://localhost:3000
-
Run the application:
In separate terminal windows, run the backend and frontend servers:
# Backend (in the server directory) npm run dev
# Frontend (in the client directory) npm start
-
Access the App:
Open your browser and go to
http://localhost:3000
.
- Register/Login: Sign up as a new user or log in to start chatting.
- Add Friends: Search for users and start a conversation.
- Real-Time Chat: Start messaging and see real-time updates.
Here's a high-level overview of the project folders and files:
full-stack-chat-app/
│
├── client/ # Frontend code (React)
│ ├── public/
│ └── src/
│ ├── components/ # Reusable React components
│ ├── redux/ # Redux slices
│ ├── layout/ # Layout page
│ ├── helpers/ # Helpers folder
│ ├── pages/ # App pages
│ └── App.js # Main App component
│
├── server/ # Backend code (Node.js, Express)
│ ├── config/ # Database config and environment setup
│ ├── controllers/ # Route handlers
│ ├── models/ # Mongoose models
│ ├── routes/ # Express routes
│ ├── socket/ # Socket.IO setup
│ └── server.js # Main entry point
│
├── Full Stack Chat App.png # Project image for README
└── README.md # Project README
We welcome contributions! Please follow these steps:
- Fork the project.
- Create your feature branch:
git checkout -b feature/your-feature-name
. - Commit your changes:
git commit -m 'Add your feature'
. - Push to the branch:
git push origin feature/your-feature-name
. - Open a pull request.
Distributed under the MIT License. See LICENSE
for more information.