This project is a full-stack application built with React, Node.js, Express, and MongoDB. The frontend is managed using Vite, and the backend handles authentication, user profile management, and other API routes.
Follow these instructions to get a copy of the project up and running on your local machine for development and testing purposes.
- Node.js (v14 or later)
- npm (v6 or later)
-
Clone the repository:
git clone https://github.com/adityasatuluri/flex-chat.git cd flex-chat -
Install server dependencies:
cd server npm install -
Install client dependencies:
cd ../client npm install
-
Start the server: Add
"dev": "nodemon index.js"in"scripts"of the_package.json_file and run the below commandcd server npm run devThe server will start on
http://localhost:6969. -
Start the client:
cd ../client npm run devThe client will start on
http://localhost:5173.
- server: Contains the Express server, authentication logic, and API routes.
- client: Contains the React application managed by Vite.
-
Frontend:
- React
- Vite
- Tailwind CSS
- React Icons
-
Backend:
- Node.js
- Express
- MongoDB
- JWT (JSON Web Tokens) for authentication
- bcrypt for password hashing
- Socket.io for faciliating realtime connections
- Multer for file uploads
- zustand for state management
Modify the .env file in the server directory by replacing the following environment variables:
MONGO_URI=your_mongodb_uriJWT_KEY=your_jwt_secret_key
-
Authentication Routes:
- POST
/api/auth/signup- User signup - POST
/api/auth/login- User login - GET
/api/auth/user-info- Get user information (requires token) - POST
/api/auth/update-profile- Update user profile (requires token) - POST
/api/auth/add-profile-image- Add profile image (requires token) - POST
/api/auth/remove-profile-image- Remove profile image (requires token) - POST
/api/auth/log-out- User logout
- POST
-
Contacts Routes:
- GET
/api/contacts/search- Search contacts - GET
/api/contacts/get-contacts-for-dm- Get direct message contacts
- GET
-
Messages Routes:
- GET
/api/messages/get-messages- Get all messages - POST
/api/messages/upload-file- Upload file
- GET
- Ensure MongoDB is running and accessible from your development environment.
- Update any relevant configurations in the client and server as needed.
- Aditya Satuluri 🚀
