Skip to content

About

Full Stack Chat App

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

22 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’¬ Real-Time Chat Application

A modern full-stack real-time chat application built with the MERN stack and Socket.IO.

The application provides secure authentication, real-time messaging, persistent chat history, file and image sharing, message reactions, reply functionality, online user tracking, and a responsive modern interface.

Built to demonstrate practical full-stack development, real-time communication, REST API integration, authentication, database management, and production deployment.


🌐 Live Demo

Frontend: https://gleaming-fairy-e0fcdc.netlify.app/


✨ Features

Authentication

  • πŸ” JWT-based user authentication
  • πŸ”’ Password hashing with bcrypt
  • πŸ‘€ User-based chat experience

Real-Time Communication

  • πŸ’¬ Instant real-time messaging with Socket.IO
  • 🟒 Online user tracking
  • ⌨️ Live typing indicators
  • πŸ‘₯ Chat rooms
  • πŸ”„ Real-time message updates

Messaging

  • ↩️ Reply to messages
  • ❀️ Message reactions
  • πŸ—‘οΈ Delete messages
  • πŸ“Ž File sharing
  • πŸ–ΌοΈ Image sharing
  • πŸ’Ύ Persistent chat history

User Experience

  • πŸŒ™ Dark and light themes
  • πŸ“± Responsive design
  • ✨ Smooth animations
  • 🎨 Modern interface with Tailwind CSS
  • ⚑ Real-time UI updates

πŸ› οΈ Tech Stack

Frontend

  • React.js β€” User interface
  • Vite β€” Development and build tooling
  • Tailwind CSS β€” Styling and responsive design
  • Framer Motion β€” UI animations
  • Socket.IO Client β€” Real-time communication

Backend

  • Node.js β€” Server-side runtime
  • Express.js β€” REST API and backend framework
  • Socket.IO β€” Real-time bidirectional communication
  • MongoDB Atlas β€” Database
  • Mongoose β€” MongoDB object modeling
  • JWT β€” Authentication
  • bcryptjs β€” Password hashing

Deployment

  • Netlify β€” Frontend deployment
  • Render β€” Backend deployment
  • MongoDB Atlas β€” Database hosting

πŸ—οΈ Application Architecture

                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚      React       β”‚
                    β”‚    Frontend      β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β”‚
                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                 β”‚                       β”‚
            REST API                 Socket.IO
                 β”‚                       β”‚
                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚     Express      β”‚
                    β”‚     + Node.js    β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚     MongoDB      β”‚
                    β”‚      Atlas       β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

The frontend communicates with the backend through REST APIs for application operations, while Socket.IO handles real-time events such as messages, typing indicators, and online user updates.


πŸ”„ Real-Time Messaging Flow

User sends message
        ↓
React emits Socket.IO event
        ↓
Socket.IO server receives event
        ↓
Message is processed
        ↓
Message is stored in MongoDB
        ↓
Server emits message to connected users
        ↓
React UI updates instantly

This architecture allows users to communicate without manually refreshing the page.


πŸ“‚ Project Structure

Chat-App/
β”‚
β”œβ”€β”€ Frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ assets/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ public/
β”‚   └── package.json
β”‚
β”œβ”€β”€ Backend/
β”‚   β”œβ”€β”€ models/
β”‚   β”œβ”€β”€ routes/
β”‚   β”œβ”€β”€ middleware/
β”‚   β”œβ”€β”€ uploads/
β”‚   β”œβ”€β”€ index.js
β”‚   └── package.json
β”‚
└── README.md

βš™οΈ Getting Started

Clone the Repository

gh repo clone Abdullah-Asim-dev/websocket-app

Or:

git clone https://github.com/Abdullah-Asim-dev/websocket-app.git

Frontend Setup

cd Frontend
npm install
npm run dev

Backend Setup

Open a new terminal:

cd Backend
npm install
npm start

πŸ”‘ Environment Variables

Backend

Create a .env file inside the Backend directory:

PORT=7777

MONGO_URI=your_mongodb_connection_string

FRONTEND_URL=http://localhost:5173

Frontend

Create a .env file inside the Frontend directory:

VITE_BACKEND_URL=http://localhost:7777

For production, configure the frontend and backend environment variables with your deployed application URLs.

Security: Never commit .env files, database credentials, JWT secrets, or API keys to a public repository.


πŸ” Authentication Flow

User Registration / Login
          ↓
      Express API
          ↓
     Credentials Check
          ↓
      JWT Generated
          ↓
     Authenticated User
          ↓
 Protected Chat Features

JWT is used to authenticate users and protect application functionality, while bcrypt is used to securely hash passwords.


πŸ“‘ Socket.IO

Socket.IO powers the application's real-time communication layer.

The project uses real-time events for features such as:

  • New messages
  • Typing indicators
  • Online/offline user status
  • Message updates
  • Real-time UI synchronization

This provides a more responsive experience compared with traditional request-and-refresh communication.


πŸš€ Deployment

Frontend

The React application is deployed on Netlify.

Live Demo: https://gleaming-fairy-e0fcdc.netlify.app/

Backend

The Node.js and Express backend is deployed on Render.

Database

The application uses MongoDB Atlas for persistent data storage.


πŸ“Œ Project Highlights

  • Full-stack MERN application
  • Real-time communication using Socket.IO
  • JWT authentication and protected functionality
  • MongoDB database integration
  • Persistent chat history
  • File and image sharing
  • Real-time online user tracking
  • Typing indicators
  • Responsive modern UI
  • Production deployment with separate frontend and backend services

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

Abdullah Asim

MERN Stack Developer | React Developer


πŸ“„ License

This project was built for learning, development, and portfolio purposes.

About

Full Stack Chat App

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages