Skip to content

neerajnakka/Mern_ChatApp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Realtime Chat Application

A realtime chat application built using the MERN (MongoDB, Express, React, Node.js) stack. Enables instant messaging between users with Socket.IO.

Features

  • MongoDB Express.js React NodeJS Tailwind CSS Zustand

  • 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.

Try It Out

You can try out the Realtime Chat Application here.

Clone and Run

To clone and run the project locally, you can follow these steps:

  1. Clone the repository:

    git clone https://github.com/neerajnakka/Mern_ChatApp
  2. Install dependencies:

    npm install
  3. Start the server:

    npm run server
  4. Build the frontend:

    npm run build
  5. Start the application:

    npm start

Open your browser at: http://localhost:5000


🐳 Running via Docker Image (No Source Code Needed)

You can run the application without cloning the repository by using the prebuilt Docker image:

  1. Pull the image from Docker Hub:

    docker pull anirek/mern_chatapp:latest
  2. Run the container:

    docker run -p 5000:5000 anirek/mern_chatapp:latest
  3. 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.

🐳 Using Docker Compose (Recommended for Production)

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:

  1. Ensure Docker Desktop or Docker Engine is running.

  2. Place the docker-compose.yml file in your working directory (already included in the repository).

  3. Run the following command to start all services:

    docker-compose up -d
  4. Docker will:

    • Pull the chat application image if not already present.
    • Start MongoDB container.
    • Start the chat application container and link it to MongoDB.
  5. Access the application at: http://localhost:5000

Notes:

  • No .env file is needed; Compose handles environment variables internally.

  • You can stop services at any time using:

    docker-compose down


Releases

No releases published

Packages

 
 
 

Contributors