Social Networking API with MongoDB

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.

Features

  • 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.

Getting Started

  1. Clone this repository to your local machine.
  2. Install dependencies using npm install.
  3. Ensure MongoDB is running locally or provide a connection URI to a remote MongoDB instance.
  4. Set up environment variables as specified in .env.example.
  5. Run the application using npm start.
  6. Run integration tests using npm test to verify the functionality of the API endpoints.
  7. Refer to the API documentation for detailed usage instructions and examples.

API Documentation

The API documentation provides comprehensive information about all endpoints, including their descriptions, request/response formats, and example use cases.

Technologies Used

  • Node.js
  • Express.js
  • MongoDB
  • JWT for authentication

Contribution Guidelines

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.

License

This project is licensed under the MIT License - see the LICENSE file for details.