Skip to content

About

A real-time chat app built with React, Vite, Node.js, Express, and Socket.IO

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

31 Commits

Folders and files

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

Repository files navigation

🟒 REAL-TIME CHAT APPLICATION

GitHub repo size GitHub stars Deployed on Render Status Built with License

πŸ“š TABLE OF CONTENTS

🌐 Live Demo πŸ‘‰ Check it out on Render


COMPANY: CODETECH IT SOLUTIONS

NAME: ARYA KUMAR

INTERN ID: CT04DZ311

DOMAIN: FRONTEND WEB DEVELOPMENT

DURATION: 4 WEEKS

MENTOR: NEELA SANTOSH


πŸ“¦ PROJECT OVERVIEW

As part of my internship at CodeTech IT Solutions, I built a production-ready real-time chat application using React (Vite), Node.js, Express, and Socket.IO.

Key features:

  • Real-time messaging across multiple dynamic chat rooms
  • Online user counts per room + clean room switching
  • Responsive, modern UI styled with plain CSS

On the frontend, I used React hooks to manage socket events and update the UI instantly.
On the backend, an Express + Socket.IO server handled room events like join, leave, and broadcast.

This project gave me hands-on experience with full-stack real-time communication, covering WebSockets vs REST, event-driven design, and state management. It’s deployable (Render + Vercel) and ready for enhancements like typing indicators and authentication.

🧠 KEY LEARNINGS

  • Real-time bidirectional communication with Socket.IO
  • Managing chat rooms and per-room user counts
  • Uploading and serving files securely via Multer (UUID filenames)
  • Environment-driven CORS configuration for safe deployment
  • React hooks and lifecycle for real-time UI updates (useState, useEffect, useRef)
  • Deployment strategies and trade-offs (committing client/dist vs. building on deploy)
  • Preserving contributor authorship when merging PRs

🧱 PROJECT STRUCTURE

REAL-TIME-CHAT-APPLICATION/
β”œβ”€β”€ client/          # React frontend (Vite)
β”‚   └── README.md
β”œβ”€β”€ server/          # Node.js backend
β”‚
└── README.md        # ← You're here (Root README)

βš™οΈ TECH STACK


Layer Technology
Frontend React, Vite
Socket.IO
Client,axios
Backend Node.js,
Express.js
Socket.IO
Multer
Protocol WebSockets
Tools UUID, CORS
dotenv
Ready for Deployment? βœ… Yes (Vercel + Render or VPS supported)

πŸš€ FEATURES

  • ⚑ Real-time messaging (Socket.IO)
  • πŸ§‘β€πŸ€β€πŸ§‘ Dynamic chat rooms (predefined + custom)
  • 🌐 Live online user counts per room
  • ✍️ Typing indicators
  • πŸ‘€ Username persistence via localStorage
  • πŸ“Ž File & Image Uploads (Multer + Axios)
  • πŸ–ΌοΈ Image preview inline within chat bubbles
  • πŸ’» Responsive, mobile-friendly UI

πŸš€ This project is a functional MVP (Minimum Viable Product) of a real-time chat application.
It demonstrates end-to-end WebSocket communication using React, Node.js, Express, and Socket.IO β€” without needing authentication or a database.

Users can:

  • Join any room
  • Send and receive real-time messages
  • See how many users are online
  • Instantly connect across the globe
  • Send images and files in chat

This MVP proves the core functionality works and lays the foundation for future upgrades like login, database storage, private messaging, and more.


πŸ› οΈ HOW TO RUN LOCALLY

1. Clone the Repository

git clone https://github.com/itsaryasharma/real-time-chat-application
cd real-time-chat-application

2. Install Backend Dependencies

cd server
npm install

3. Install Frontend Dependencies

cd ../client
npm install

4. (Optional) Setup Environment Variable

Create a .env file inside the server folder:

PORT=3001

5. Run the Application

Start the Server

cd server
npm run dev

The server will start on: http://localhost:3001

Start the Client

In a new terminal:

cd client
npm run dev

The client will start on: http://localhost:5173


🌐 ACCESS


πŸ§ͺ WEB SOCKET EVENTS

Event Name Description
join_room User joins a room
send_message User sends a message
receive_message Others receive the message

🐞 TROUBLESHOOTING

  1. Port Conflicts
    Change ports in .env or Vite config if 3001 or 5173 are in use.

  2. CORS Errors
    Server allows requests from http://localhost:5173 β€” update if changed.

  3. Socket Errors
    Make sure both client and server are running and refresh the browser.


🚧 FUTURE IMPROVEMENTS

  • πŸ”’ User authentication system
  • 🧾 Message persistence via database
  • πŸ§‘ User profiles and avatars

🀝 CONTRIBUTING

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push and submit a pull request

πŸ€— ACKNOWLEDGEMENTS

Special thanks to Aditya Anurag for implementing the file & image upload feature
(Multer integration, image preview in chat, and file handling).
His contribution is included in this project and preserved in the commit history.


πŸ“œ LICENSE

MIT License


OUTPUTS

Image Image Image Image Image Image

Thank you for reviewing my project!

About

A real-time chat app built with React, Vite, Node.js, Express, and Socket.IO

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages