This project implements a RESTful API for a basic social networking application using Node.js and MongoDB. It supports user profiles, posts, and the ability to follow other users.
- User Profiles: Create, update, view, and delete user profiles with details like username, bio, and profile picture URL. Use UUID for user IDs.
- Authentication: Implement JWT-based authentication for signing up, logging in, and performing actions on user profiles.
- Posts: Allow users to create, view, update, and delete their posts. Each post includes text content, a timestamp, and the ID of the user who created it.
- Following Mechanism: Enable users to follow and unfollow other users. Provide endpoints to retrieve the list of users a user is following and who is following them.
- Efficient Data Retrieval: Use MongoDB's aggregation framework to implement efficient queries for the social feed, displaying posts from users that a given user follows, sorted by most recent.
- Data Modeling: Design MongoDB schemas for users, posts, and follows. Consider references or embedded documents for optimal performance.
- Security and Validation: Implement input validation to prevent injection attacks and rate limiting to protect against brute force attacks.
- Testing: Write integration tests to ensure API endpoints work as expected and handle errors gracefully.
- Documentation: Provide comprehensive API documentation detailing endpoint descriptions, request/response formats, and example use cases.
- Clone this repository to your local machine.
- Install dependencies using
npm install
. - Ensure MongoDB is running locally or provide a connection URI to a remote MongoDB instance.
- Set up environment variables as specified in
.env.example
. - Run the application using
npm start
. - Run integration tests using
npm test
to verify the functionality of the API endpoints. - Refer to the API documentation for detailed usage instructions and examples.
The API documentation provides comprehensive information about all endpoints, including their descriptions, request/response formats, and example use cases.
- Node.js
- Express.js
- MongoDB
- JWT for authentication
Contributions are welcome! Please follow these guidelines when contributing:
- Fork the repository and create a new branch for your feature/bug fix.
- Ensure your code follows the established coding style and conventions.
- Write clear, concise commit messages and comments.
- Test your changes thoroughly before submitting a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.