<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Web Afsana Keya</title>
    <description>The latest articles on DEV Community by Web Afsana Keya (@web_afsanakeya_532c5740b).</description>
    <link>https://dev.to/web_afsanakeya_532c5740b</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2707789%2Fa718e502-d92d-430e-a490-119a4e6f1e4f.png</url>
      <title>DEV Community: Web Afsana Keya</title>
      <link>https://dev.to/web_afsanakeya_532c5740b</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/web_afsanakeya_532c5740b"/>
    <language>en</language>
    <item>
      <title>Building a Real-Time Chat App with MERN &amp; Socket.IO: A Beginner's Journey</title>
      <dc:creator>Web Afsana Keya</dc:creator>
      <pubDate>Mon, 08 Sep 2025 18:23:22 +0000</pubDate>
      <link>https://dev.to/web_afsanakeya_532c5740b/building-a-real-time-chat-app-with-mern-socketio-a-beginners-journey-1kpa</link>
      <guid>https://dev.to/web_afsanakeya_532c5740b/building-a-real-time-chat-app-with-mern-socketio-a-beginners-journey-1kpa</guid>
      <description>&lt;p&gt;As a beginner MERN stack developer, I want to challenge myself with a project that goes beyond simple CRUD apps. That's how I came up with the idea of building a real-time chat application where users can sign up, log in, and chat instantly with each other.&lt;br&gt;
This project helped me develop skills in authentication, WebSockets, state management, and deployment that are essential for real-world full-stack development.&lt;br&gt;
🛠 Tech Stack:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Frontend: React(Vite),Axios, Context API&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Backend: Node.js, Express&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Database: MongoDB Atlas&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Real-time: Socket.IO&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Authentication: JWT&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Deployment: Frontend (Vercel), Backend (Render)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;✨ Features&lt;/p&gt;

&lt;p&gt;🔑 User Authentication (Login / Signup with JWT)&lt;/p&gt;

&lt;p&gt;💬 Real-time chat with Socket.IO&lt;/p&gt;

&lt;p&gt;👥 Online users tracking&lt;/p&gt;

&lt;p&gt;🖼️ Profile update (Cloudinary integration)&lt;/p&gt;

&lt;p&gt;📱 Fully responsive design&lt;/p&gt;

&lt;p&gt;⚡ Challenges I Faced &amp;amp; Solutions&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Socket.IO Connection Issue:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Problem: Connection broke after login/logout&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Solution: Passed userId via socket.handshake.query and mapped it to sockect.id&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Deployment Issue on Vercel:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Problem: Vercel crashed because serverless functions don't support WebSockets.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Solution: Moved backend to Render, which supports persistent WebSocket connections.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;State Management:&lt;/li&gt;
&lt;li&gt;Problem: Maintaining auth state and socket connection together was tricky.&lt;/li&gt;
&lt;li&gt;Solution: Used React Context API to manage user state, token, and socket connection globally.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;📸 Screenshots: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frc8q1supstg496o0ytsu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frc8q1supstg496o0ytsu.png" alt="Login " width="400" height="300"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2dayfkw6awy98c3m3gy9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2dayfkw6awy98c3m3gy9.png" alt="Signup" width="400" height="300"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpgu6ino5ncb0myp9gi38.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpgu6ino5ncb0myp9gi38.png" alt="Real-Time Chat" width="400" height="300"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🌐 Live Demo &amp;amp; GitHub Links&lt;/p&gt;

&lt;p&gt;🔗 Live App: [chat-app-frontend-delta-seven.vercel.app]&lt;/p&gt;

&lt;p&gt;💻 Frontend Repo: [&lt;a href="https://github.com/webafsanakeya/chat-app-frontend" rel="noopener noreferrer"&gt;https://github.com/webafsanakeya/chat-app-frontend&lt;/a&gt;]&lt;/p&gt;

&lt;p&gt;💻 Backend Repo: [&lt;a href="https://github.com/webafsanakeya/chat-app-backend" rel="noopener noreferrer"&gt;https://github.com/webafsanakeya/chat-app-backend&lt;/a&gt;]&lt;/p&gt;

&lt;p&gt;🎯 Key Learnings&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;JWT authentication and protecting routes&lt;/li&gt;
&lt;li&gt;Real-time communication using Socket.IO&lt;/li&gt;
&lt;li&gt;Handling state management between frontend &amp;amp; backend&lt;/li&gt;
&lt;li&gt;Deployment differences (Vercel vs Render)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Conclusion&lt;/p&gt;

&lt;p&gt;This project was an amazing learning experience as a beginner MERN developer. It gave me confidence in full-stack development and helped me understand the power of real-time communication.&lt;/p&gt;

&lt;p&gt;💡 If you’re also working on chat apps or MERN stack projects, let’s connect and share knowledge! 🚀&lt;/p&gt;

</description>
      <category>react</category>
      <category>node</category>
      <category>webdev</category>
      <category>mongodb</category>
    </item>
  </channel>
</rss>
