Skip to content

A full-stack real-time chat application showcasing instant messaging and real-time communication in a web app.

Notifications You must be signed in to change notification settings

ggauravky/chat-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

28 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’¬ Real-Time Chat Application

Status Version License

πŸš€ A modern, full-stack real-time messaging platform built with the MERN stack


MongoDB Express.js React Node.js Socket.io TailwindCSS Zustand


πŸ“‹ Table of Contents


✨ Features

πŸ” Authentication & Security

  • βœ… JWT-based user authentication
  • βœ… Bcrypt password encryption
  • βœ… HTTP-only secure cookies
  • βœ… Protected routes & middleware

πŸ’¬ Real-time Messaging

  • βœ… Instant message delivery with Socket.IO
  • βœ… Online/Offline user status
  • βœ… Message history & persistence
  • βœ… Multi-user chat support

🎨 User Interface

  • βœ… Modern & responsive design
  • βœ… Theme customization support
  • βœ… Profile management
  • βœ… Image upload via Cloudinary
  • βœ… Smooth animations & transitions

πŸ› οΈ Tech Stack

Frontend

React Vite TailwindCSS DaisyUI Zustand Axios Socket.io

Backend

Node.js Express.js MongoDB Mongoose Socket.io JWT Bcrypt Cloudinary

DevOps & Tools

Render MongoDB Atlas Git GitHub


πŸ“ Project Structure

chat-app/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ controllers/    # Request handlers
β”‚   β”‚   β”œβ”€β”€ models/         # Database schemas
β”‚   β”‚   β”œβ”€β”€ routes/         # API routes
β”‚   β”‚   β”œβ”€β”€ middleware/     # Auth middleware
β”‚   β”‚   β”œβ”€β”€ lib/            # Utilities (DB, Socket, Cloudinary)
β”‚   β”‚   └── index.js        # Server entry
β”‚   └── package.json
β”‚
└── frontend/
    β”œβ”€β”€ src/
    β”‚   β”œβ”€β”€ components/     # React components
    β”‚   β”œβ”€β”€ pages/          # Page components
    β”‚   β”œβ”€β”€ store/          # Zustand stores
    β”‚   β”œβ”€β”€ lib/            # Utilities
    β”‚   └── App.jsx         # Root component
    └── package.json

⚑ Quick Start

Prerequisites

  • Node.js v16+ installed
  • MongoDB (local or Atlas)
  • Cloudinary account

Setup Steps

  1. Clone the repository

    git clone https://github.com/ggauravky/chat-app.git
    cd chat-app
  2. Install dependencies

    # Install root dependencies
    npm install
    
    # Install backend dependencies
    cd backend
    npm install
    
    # Install frontend dependencies
    cd ../frontend
    npm install
  3. Configure environment variables

    Create .env in the backend folder:

    PORT=5001
    MONGODB_URI=your_mongodb_connection_string
    JWT_SECRET=your_jwt_secret_key
    NODE_ENV=development
    CLOUDINARY_CLOUD_NAME=your_cloudinary_name
    CLOUDINARY_API_KEY=your_cloudinary_api_key
    CLOUDINARY_API_SECRET=your_cloudinary_api_secret
  4. Run the application

    # Start backend (from backend folder)
    npm run dev
    
    # Start frontend (from frontend folder, new terminal)
    npm run dev
  5. Access the app

    • Frontend: http://localhost:5173
    • Backend API: http://localhost:5001

πŸ”‘ API Endpoints

Authentication

Method Endpoint Description Auth
POST /api/auth/signup Register new user ❌
POST /api/auth/login User login ❌
POST /api/auth/logout User logout βœ…
PUT /api/auth/update-profile Update profile βœ…
GET /api/auth/check Check auth status βœ…

Messages

Method Endpoint Description Auth
GET /api/messages/users Get all users βœ…
GET /api/messages/:id Get messages with user βœ…
POST /api/messages/send/:id Send message βœ…

πŸš€ Deployment

Live Application

The application is deployed and accessible at:

🌐 https://chat-app-6ly8.onrender.com

Deployment Platform

  • Platform: Render
  • Frontend & Backend: Deployed as a monorepo
  • Database: MongoDB Atlas
  • Image Storage: Cloudinary

Note: The app may take a few seconds to load initially due to Render's free tier cold start.


πŸ‘¨β€πŸ’» Developer

Gaurav Kumar

GitHub LinkedIn


πŸ“ License

This project is licensed under the ISC License.


⭐ Star this repo if you find it helpful!

Made with ❀️ using the MERN Stack

Made with MERN

About

A full-stack real-time chat application showcasing instant messaging and real-time communication in a web app.

Topics

Resources

Stars

Watchers

Forks

Languages