User Conversation and Messaging Interface
- Built using React.js for messaging UI.
- Features user login, profile viewing, user list display, and real-time messaging through WebSockets.
- Utilizes Express.js for HTTP request handling and endpoint management.
- MongoDB stores user information and messages; JWT ensures secure user authentication.
- Registration with unique username/password, securely hashed using bcrypt.
- JWT-based login generates tokens for subsequent authenticated requests.
- Fetches messages between users and facilitates real-time communication via WebSockets.
- Profile retrieval based on JWT; displays a list of registered users for messaging.
- WebSocketServer (ws library) manages connections for real-time communication.
- Notifies clients about online users' presence and updates dynamically.
- Node.js with npm installed
- MongoDB installed and running
-
Clone the repository using
git clone https://github.com/Vedang12d/chat-app.git
-
Navigate to the server directory and Install dependencies using
npm install
. -
Create a .env file in the server directory. Add these environment variables:
MONGO_URL=YOUR_MONGO_DB_CONNECTION_STRING
JWT_SECRET=YOUR_JWT_SECRET_KEY
CLIENT_URL='http://localhost:3000' (or your frontend URL)
-
Run the server using the appropriate command.
-
Navigate to the client directory and install client dependencies using
npm install
. -
Start the React app using the appropriate command.
-
Access the application in your browser at
http://localhost:3000
.