This is a Facebook clone project built with Node.js, Express, MongoDB, and Socket.IO. It includes features such as user authentication, posting, messaging, and real-time notifications.
- User Authentication (Registration, Login, Logout)
- Google OAuth Authentication
- Create, Read, Update, and Delete Posts
- Like, Comment, and Share Posts
- Create and View Stories
- Real-time Messaging with Socket.IO
- Follow and Unfollow Users
- View User Profiles and Bios
- Upload and Manage Profile and Cover Photos
-
Clone the repository:
git clone <repository_url> cd repository_url/backend
-
Install dependencies:
npm install
-
Create a
.envfile in the backend directory and add your environment variables based on the .env.example file. -
Start the MongoDB service using Docker:
docker-compose up
-
Start the server:
npm start
POST /auth/register- Register a new userPOST /auth/login- Login a userGET /auth/logout- Logout a userGET /auth/google- Google OAuth loginGET /auth/google/callback- Google OAuth callback
POST /users/follow- Follow a userPOST /users/unfollow- Unfollow a userGET /users/friend-request- Get all friend requestsGET /users/user-to-request- Get all users for friend requestsGET /users/mutual-friends- Get all mutual friendsGET /users- Get all usersGET /users/profile/:userId- Get user profileGET /users/check-auth- Check user authenticationPUT /users/bio/:userId- Create or update user bioPUT /users/profile/:userId- Update user profilePUT /users/profile/cover-photo/:userId- Update cover photo
POST /posts- Create a new postGET /posts- Get all postsGET /posts/user/:userId- Get posts by user IDPOST /posts/likes/:postId- Like a postPOST /posts/comments/:postId- Comment on a postPOST /posts/share/:postId- Share a postPOST /story- Create a new storyGET /story- Get all stories
GET /users/get-messages/:id- Get messages between users
sendMessage- Send a messagereceiveMessage- Receive a messagegetOnlineUsers- Get online users
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
This project is licensed under the MIT License.