This is a full-stack chat application built with React, Node.js, Express, MongoDB, and Socket.io.
The application allows users to sign up, log in, and chat with other users in real-time.
- User authentication (sign up, log in, log out)
- Real-time messaging with Socket.io
- Profile management
- Online/offline status
- Responsive design
/chat-app
├── backend
│ ├── config
│ │ └── db.js
│ ├── controllers
│ │ └── userController.js
│ ├── middleware
│ │ └── authMiddleware.js
│ ├── models
│ │ └── User.js
│ ├── routes
│ │ └── userRoutes.js
│ ├── utils
│ │ └── cloudinary.js
│ ├── server.js
│ └── package.json
├── frontend
│ ├── public
│ │ └── index.html
│ ├── src
│ │ ├── components
│ │ │ └── Chat.js
│ │ ├── context
│ │ │ └── AuthContext.js
│ │ ├── pages
│ │ │ └── Login.js
│ │ ├── App.js
│ │ ├── index.js
│ │ └── styles.css
│ ├── .env
│ └── package.json
├── README.md
└── package.json
- Node.js
- MongoDB
- Cloudinary account (for image uploads)
-
Clone the repository:
git clone https://github.com/your-username/chat-app.git cd chat-app -
Install dependencies for both backend and frontend:
npm install --prefix backend npm install --prefix frontend
-
Create a
.envfile in the backend directory and add the following environment variables:MONGODB_URI=your_mongodb_uri JWT_SECRET_KEY=your_jwt_secret_key CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name CLOUDINARY_API_KEY=your_cloudinary_api_key CLOUDINARY_API_SECRET=your_cloudinary_api_secret NODE_ENV=development
-
Build the frontend:
npm run build --prefix frontend
-
Start the backend server:
npm start --prefix backend
The application will be available at http://localhost:3000.
To run the application in development mode:
-
Start the backend server with nodemon:
npm run dev --prefix backend
-
Start the frontend development server:
npm run dev --prefix frontend
The frontend will be available at http://localhost:5173.
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License.