Chat App is a full-stack MERN application where both the React frontend and the Socket.io-powered Express backend run from a single repository. The steps below walk you from a fresh clone to two browser tabs exchanging real-time messages with no external services beyond a MongoDB instance.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/khushboodaryani/Chat-App/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before you begin, make sure you have the following installed and available:
- Node.js 18 or later — nodejs.org
- A MongoDB instance — either a local
mongodprocess or a free MongoDB Atlas cluster - Git — git-scm.com
Setup Steps
Install backend dependencies
From the repository root, install the Node.js dependencies for the Express server.
Install frontend dependencies
Move into the Return to the repository root when done:
frontend directory and install the React/Vite dependencies separately.Create the environment file
Create a
.env file at the repository root (the same level as the /backend and /frontend folders). Populate it with the four required variables:- Replace
MONGO_DB_URIwith your Atlas connection string if you are not running MongoDB locally. - Replace
JWT_SECRETwith a random string of at least 32 characters. You can generate one withopenssl rand -hex 32.
Start the backend server
From the repository root, start the Express server with the You should see:The server listens on
server npm script.http://localhost:4000 by default. API routes are available under /api/auth, /api/messages, and /api/users.Start the frontend dev server
Open a second terminal, navigate to the Vite will print a local URL — by default:The frontend dev server proxies API and Socket.io requests to the Express backend automatically.
frontend directory, and start Vite.Open the app and start chatting
Navigate to http://localhost:5173 in your browser. Click Sign Up to create a new account, log in, select a user from the sidebar, and send your first real-time message.