A realtime chat application built using the MERN (MongoDB, Express, React, Node.js) stack. Enables instant messaging between users with Socket.IO.
-
MERN Stack: Utilized MongoDB, Express, React, and Node.js for full-stack development.
-
Secure Backend: Built a robust backend with Node.js and Express, providing RESTful APIs for user authentication and message handling.
-
Efficient State Management: Implemented custom React hooks and Zustand for streamlined state management in the frontend.
-
Real-Time Communication: Leveraged Socket.IO for real-time communication between users, enabling instant messaging functionality.
-
Protected Routes: Incorporated protected routing to ensure secure access to application features.
-
Modern UI Design: Styled the application with Tailwind CSS for a modern and responsive user interface.
You can try out the Realtime Chat Application here.
To clone and run the project locally, you can follow these steps:
-
Clone the repository:
git clone https://github.com/neerajnakka/Mern_ChatApp
-
Install dependencies:
npm install
-
Start the server:
npm run server
-
Build the frontend:
npm run build
-
Start the application:
npm start
Open your browser at: http://localhost:5000
You can run the application without cloning the repository by using the prebuilt Docker image:
-
Pull the image from Docker Hub:
docker pull anirek/mern_chatapp:latest
-
Run the container:
docker run -p 5000:5000 anirek/mern_chatapp:latest
-
Open your browser at: http://localhost:5000
Explanation:
- The Docker image contains both the frontend and backend, so no source code is needed.
- The server is already configured to connect to MongoDB inside the container.
The repository includes a Docker Compose file, which simplifies running the chat application with MongoDB and other services. Using Docker Compose ensures:
- MongoDB is automatically linked to the chat app.
- Environment variables (like database connection) are preconfigured.
- Services start together in the correct order.
Steps to use Docker Compose:
-
Ensure Docker Desktop or Docker Engine is running.
-
Place the
docker-compose.ymlfile in your working directory (already included in the repository). -
Run the following command to start all services:
docker-compose up -d
-
Docker will:
- Pull the chat application image if not already present.
- Start MongoDB container.
- Start the chat application container and link it to MongoDB.
-
Access the application at: http://localhost:5000
Notes:
-
No
.envfile is needed; Compose handles environment variables internally. -
You can stop services at any time using:
docker-compose down