{"id":22509231,"url":"https://github.com/saddamarbaa/node-express-mongodb-developer-match-rest-api","last_synced_at":"2026-04-07T22:31:17.318Z","repository":{"id":264630063,"uuid":"893372145","full_name":"saddamarbaa/node-express-mongodb-developer-match-rest-api","owner":"saddamarbaa","description":" An open-source RESTful API developed using NodeJS, Express,and TypeScript, MongoDB, helping developers connect and collaborate by offering user authentication, developer profile management, and match-based interactions.","archived":false,"fork":false,"pushed_at":"2025-12-30T18:21:48.000Z","size":246,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-03T15:16:27.336Z","etag":null,"topics":["expressjs","jwt-authorization","mogodb","mogoose","nodejs","restful-api"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/saddamarbaa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-11-24T09:11:29.000Z","updated_at":"2025-12-30T18:21:52.000Z","dependencies_parsed_at":"2025-12-31T05:06:57.639Z","dependency_job_id":null,"html_url":"https://github.com/saddamarbaa/node-express-mongodb-developer-match-rest-api","commit_stats":null,"previous_names":["saddamarbaa/node-express-mongodb-developer-match-rest-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/saddamarbaa/node-express-mongodb-developer-match-rest-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saddamarbaa%2Fnode-express-mongodb-developer-match-rest-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saddamarbaa%2Fnode-express-mongodb-developer-match-rest-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saddamarbaa%2Fnode-express-mongodb-developer-match-rest-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saddamarbaa%2Fnode-express-mongodb-developer-match-rest-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/saddamarbaa","download_url":"https://codeload.github.com/saddamarbaa/node-express-mongodb-developer-match-rest-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saddamarbaa%2Fnode-express-mongodb-developer-match-rest-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31532166,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T16:28:08.000Z","status":"ssl_error","status_checked_at":"2026-04-07T16:28:06.951Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["expressjs","jwt-authorization","mogodb","mogoose","nodejs","restful-api"],"created_at":"2024-12-07T01:28:14.461Z","updated_at":"2026-04-07T22:31:17.308Z","avatar_url":"https://github.com/saddamarbaa.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Developer Match API\n\nDeveloper Match is an open-source RESTful API designed for developers looking to connect, collaborate, and find coding partners. Think of it like Tinder for developers—allowing users to swipe, connect, and collaborate based on their skills, interests, and projects.\n\nBuilt with **Node.js**, **Express**, and **MongoDB**, this API supports user authentication, profile creation, and match-making functionalities, enabling developers to find the perfect coding partner for projects, freelancing, or networking.\n\n## Features\n- **User Registration**: Create an account using email and password.\n- **Profile Management**: Add skills, technologies, and interests to your profile.\n- **Connection Requests**: Send and receive connection requests to find coding partners.\n- **Match-making**: Match developers based on shared interests, skills, and technologies.\n- **Authentication**: Secure authentication using JWT tokens.\n\n\n\n- **Authentication**: User registration, login, and JWT-based authentication.\n- **Developer Profiles**: Users can create and update their profiles with details like bio, skills, and availability.\n- **Connection Requests**: Send, receive, and manage connection requests between developers.\n- **Feeds**: Discover developers who are not yet connected or pending requests.\n\n\n## General Workflow\n1. User signs up\n2. User logs in\n3. User updates profile\n4. User sends a connection request\n5. Match-making happens based on user skills and interests.\n\n\n# Table of Contents\n\n- [Author](#author)\n- [Tech Stack](#tech-stack)\n- [API Features](#api-features)\n- [Endpoints](#endpoints)\n- [API Reference](#api-reference)\n- [Environment Variables](#environment-variables)\n- [Getting Started](#getting-started)\n- [Deployment](#deployment)\n- [Contributing](#contributing)\n- [Project Status](#project-status)\n- [Related Projects](#related-projects)\n- [Error Handling](#error-handling) \n- [Feedback](#feedback)\n- [Support](#support)\n- [License](#license)\n\n---\n\n# **Author**\n\nThis project is developed by:\n\n- [Saddam Arbaa](https://github.com/saddamarbaa)\n\nFor more information, visit [GitHub Profile](https://github.com/saddamarbaa).\n\n# **Tech Stack**\n\n### **Backend Framework \u0026 Libraries**\n\n- **Node.js**: JavaScript runtime for building server-side applications.\n- **Express**: Web framework for Node.js to handle routing and middleware.\n- **MongoDB**: NoSQL database for storing and managing developer data.\n- **Mongoose**: ODM (Object Data Modeling) library for MongoDB and Node.js.\n- **JWT (jsonwebtoken)**: JSON Web Token for handling authentication and authorization.\n\n### **Security \u0026 Middleware**\n\n- **bcrypt**: Library for hashing passwords to store them securely.\n- **cookie-parser**: Middleware for handling cookies in requests.\n- **cors**: Middleware for enabling Cross-Origin Resource Sharing (CORS) in Express.\n- **helmet**: Helps secure Express apps by setting various HTTP headers.\n- **dotenv**: Loads environment variables from `.env` files into `process.env`.\n\n### **Validation \u0026 Error Handling**\n\n- **Joi**: Data validation library for JavaScript, used for request validation.\n- **http-errors**: Simplifies creating HTTP errors for better error handling.\n\n### **File Uploading**\n\n- **multer**: Middleware for handling `multipart/form-data`, used for file uploads (e.g., profile images).\n\n### **Logging \u0026 Monitoring**\n\n- **morgan**: HTTP request logger middleware for Node.js.\n\n\n### **Dev Tools \u0026 Testing**\n\n- **ESLint**: Linter for identifying and fixing problems in JavaScript code.\n- **Prettier**: Code formatter to maintain consistent code style.\n- **Jest**: JavaScript testing framework, used for unit and integration tests.\n\n---\n\n# **API Features**\n\n### **Authentication \u0026 Authorization**\n- **User Signup**: Developers can create an account using email/password.\n- **User Login**: Secure login using JWT tokens.\n\n### **Developer Profile Management**\n- **Create/Update/Delete Profile**: Developers can manage their profiles, including skills, interests, and projects.\n- **Upload Profile Picture**: Users can upload and edit their profile pictures.\n\n### **Connection Requests**\n- **Send Connection Requests**: Developers can send connection requests to other users based on shared interests or skillsets.\n- **Accept/Reject Requests**: Users can accept or reject connection requests from other users based on compatibility.\n- **Notifications**: Users will receive notifications when a connection request is received or accepted.\n\n### **Match-making**\n- **Smart Match-making**: Smart match-making algorithm to suggest potential collaborators based on shared interests, skills, and previous project work.\n- **View Matches**: Users can view matches and connect with potential collaborators or clients.\n\n### **Admin Management** (To Be Implemented)\n- **User Account Management**: Admin can manage user accounts, including deleting inactive or malicious profiles.\n- **View User Statistics**: Admin can view user statistics, including active users, connection statistics, and more.\n\n### **Search \u0026 Filters** (To Be Implemented)\n- **Search for Collaborators**: Users can search for potential collaborators based on location, skills, interests, or project types.\n- **Filters**: Filters to refine searches, ensuring developers find the most suitable partners for their needs.\n\n### **Notifications** (To Be Implemented)\n- **Real-time Notifications**: Real-time notifications for events like profile updates, connection requests, and match-making results.\n- **Manage Preferences**: Option to manage notification preferences (e.g., daily or weekly summaries).\n\n---\n\n\n# **Endpoints**\n\n- [API Authentication](#api-authentication)\n  - [User Signup](#user-signup)\n  - [User Login](#user-login)\n  - [User Logout](#user-logout)\n  - [Get Profile](#get-profile)\n  - [Update User Profile](#update-user-profile)\n\n- [Users](#users-api-reference)\n  - [Get Pending Connection Requests](#get-pending-connection-requests)\n  - [Get Matches \u0026 Connections](#get-matches-connections)\n  - [Get User Feed](#get-user-feed)\n\n- [Connection Request](#connection-request-routes)\n  - [Send Connection Request](#send-connection-request)\n  - [Review Connection Request](#review-connection-request)\n\n---\n\n\n# **Getting Started**\n\nFollow these steps to get the project up and running:\n\n### **Prerequisites**\n\nMake sure you have the following installed:\n\n- [Node.js](https://nodejs.org/) (v16.x or later)\n- [MongoDB](https://www.mongodb.com/) (running locally or with a cloud provider like MongoDB Atlas)\n- [Nodemon](https://nodemon.io/) (for development)\n\n### **Run Locally**\n\n1. **Clone the project**:\n\n```bash\n  git clone https://github.com/saddamarbaa/express-mongodb-developer-match-rest-api\n```\n\n2. **Go to the project directory**:\n\n```bash\n  cd express-mongodb-developer-match-rest-api\n```\n\n3. **Install dependencies**:\n\n```bash\n  npm install\n```\n\n4. **Set Up Environment Variables**:\n\n```bash\n  Copy `.env.example` to `.env` and update the necessary values:\n```\n\n5. **Run the Application Locally**:\n   Start the server in development mode:\n\n```bash\n  npm run server\n```\n\n6. **Access the API**:\n\n- Once the server is running, you can make API requests to `http://localhost:8000/api/v1`\n- Use tools like Postman or cURL to test the endpoints.\n\n7. **Authentication**:\n\n- To authenticate, generate a token via the `/auth/login/` endpoint.\n- Include the token in the `Authorization` header as `Bearer \u003cyour-token\u003e`.\n\n8. **Test the API**:\n   Refer to the **API Reference** section for detailed information on the available endpoints and request/response formats.\n\n### **Seed the Database (Optional)**:\n\nTo seed the MongoDB database with initial data, run the following command:\n\n```bash\n  npm run db:seed\n```\n\n\n\n# Environment Variables\n\nTo run this project, you will need to add the necessary environment variables to your .env file by checking .env.example for reference.\n\n\n\n# **API Authentication**\n\nSome endpoints may require authentication, you need to authenticate and obtain an access token.\n\nUpon successful login, the server will return  **token**, which is also stored as cookies.\n\n## **Making Authenticated Requests**\n\nFor future requests, you need to include the **token** in the `Authorization` header. If the header is not provided, the token will be automatically retrieved from the cookies.\n\n### **Example Authorization Header**:\n\n```http\nAuthorization: Bearer YOUR_ACCESS_TOKEN\n```\n\n\n\n\n# API Reference\n\n## **Authentication API Reference**\n\n### **User Signup**\n\n```http\nPOST /api/v1/auth/signup\n```\n\n| Parameter         | Type     | Description                              | Required |\n|-------------------|----------|------------------------------------------|----------|\n| `authentication`  | `string` | Your token                               | no       |\n| `firstName`       | `string` | User's first name (3-15 characters)      | yes      |\n| `lastName`        | `string` | User's last name (3-15 characters)       | yes      |\n| `email`           | `string` | Valid email address                      | yes      |\n| `password`        | `string` | Minimum 6 characters                     | yes      |\n| `confirmPassword` | `string` | Must match the password                  | yes      |\n| `bio`             | `string` | User's bio (max 500 characters)          | no       |\n| `skills`          | `array`  | Array of skills (optional)               | no       |\n| `profileUrl`      | `string` | Valid URL for profile picture            | no       |\n| `acceptTerms`     | `boolean`| Accept the terms and conditions          | no       |      |\n| `dateOfBirth`     | `date`   | User's date of birth                     | no       |\n\n#### **Description:**\n\n- **Endpoint:** `POST /api/v1/auth/signup`\n- **Functionality:** Registers a new user with the provided information and sends a verification email.\n\n**Request Body:**\n```json\n{\n  \"firstName\": \"John\",\n  \"lastName\": \"Doe\",\n  \"email\": \"johndoe@example.com\",\n  \"password\": \"yourpassword\",\n  \"confirmPassword\": \"yourpassword\",\n  \"bio\": \"This is my bio\",\n  \"skills\": [\"JavaScript\", \"Node.js\"],\n  \"profileUrl\": \"http://example.com/profile.jpg\",\n  \"acceptTerms\": true,\n  \"gender\": \"male\",\n  \"dateOfBirth\": \"1990-01-01\"\n}\n```\n\n**Response:**\n- **Success (201):**\n```json\n{\n  \"success\": true,\n  \"message\": \"Auth Signup is success. An Email with Verification link has been sent to your account.\",\n  \"status\": 201,\n  \"data\": null\n}\n```\n\n- **Error (409):**\n```json\n{\n  \"success\": false,\n  \"message\": \"E-Mail address already exists, please pick a different one.\",\n  \"status\": 409,\n  \"data\": null\n}\n```\n\n- **Error (422): Validation Error:**\n```json\n{\n  \"success\": false,\n  \"error\": \"Validation error\",\n  \"message\": \"One or more fields are invalid.\",\n  \"status\": 422,\n  \"data\": null\n}\n```\n\nThis error typically happens when:\n- Required fields are missing.\n- Field types do not match the expected format (e.g., email, string, etc.).\n- A value exceeds or falls short of the defined length or pattern.\n  \nIn your code, this could be triggered by failing the validation schema checks, such as the mismatch between `password` and `confirmPassword`, or an invalid `email` format.\n\n\n### **User Login**\n\n```http\nPOST /api/v1/auth/login\n```\n\n| Parameter        | Type     | Description   | Required |\n| :--------------- | :------- | :------------ | :------- |\n| `authentication` | `string` | Your token    | no       |\n| `email`          | `string` | Your email    | yes      |\n| `password`       | `string` | Your password | yes      |\n\n#### **Description:**\n\n- **Endpoint:** `POST /api/v1/auth/login`\n- **Functionality:** Logs in the user by verifying their email and password and returns a token for further use..\n\n**Request Body:**\n```json\n{\n  \"email\": \"johndoe@example.com\",\n  \"password\": \"yourpassword\"\n}\n```\n\n**Response:**\n- **Success (200):**\n```json\n{\n  \"success\": true,\n  \"message\": \"User login successful.\",\n  \"status\": 200,\n  \"data\": {\n    \"authToken\": \"yourjsonwebtoken\"\n  }\n}\n```\n\n##### **Set Cookies**\n\nUpon successful login, the following cookie will be set:\n\n -  Name: `authtoken`.\n-   Value: `yourjsonwebtoken`.\n\n\n\n- **Error (401):**\n```json\n{\n  \"success\": false,\n  \"message\": \"Invalid credentials, please try again.\",\n  \"status\": 401,\n  \"data\": null\n}\n```\n\n- **Error (422): Validation Error:**\n```json\n{\n  \"success\": false,\n  \"error\": \"Validation error\",\n  \"message\": \"One or more fields are invalid.\",\n  \"status\": 422,\n  \"data\": null\n}\n```\n\n\n### **User Logout**\n\n```http\nPOST /api/v1/auth/logout\n```\n\n| Parameter         | Type     | Description         | Required |\n|-------------------|----------|---------------------|----------|\n| `authentication`  | `string` | Your token          | yes      |\n\n#### **Description:**\n\n- **Endpoint:** `POST /api/v1/auth/logout`\n- **Functionality:** Logs out the user by invalidating their token.\n\n**Request Body:**\n```json\n{\n  \"authentication\": \"yourjsonwebtoken\"\n}\n```\n\n**Response:**\n- **Success (200):**\n```json\n{\n  \"success\": true,\n  \"message\": \"User logged out successfully.\",\n  \"status\": 200,\n  \"data\": null\n}\n```\n\n- **Error (401):**\n```json\n{\n  \"success\": false,\n  \"message\": \"No token provided or token is invalid.\",\n  \"status\": 401,\n  \"data\": null\n}\n```\n\n\n### **Get Profile**\n\n```http\nGET /api/v1/auth/me\n```\n\n| Parameter         | Type     | Description         | Required |\n|-------------------|----------|---------------------|----------|\n| `authentication`  | `string` | Your token          | yes      |\n\n#### **Description:**\n\n- **Endpoint:** `GET /api/v1/auth/profile`\n- **Functionality:** Retrieves the authenticated user's profile details.\n\n**Request Header:**\n```json\n{\n  \"authentication\": \"yourjsonwebtoken\"\n}\n```\n\n**Response:**\n- **Success (200):**\n```json\n{\n  \"success\": true,\n  \"message\": \"User profile retrieved successfully.\",\n  \"status\": 200,\n  \"data\": {\n    \"firstName\": \"John\",\n    \"lastName\": \"Doe\",\n    \"email\": \"johndoe@example.com\",\n    \"bio\": \"This is my bio\",\n    \"skills\": [\"JavaScript\", \"Node.js\"],\n    \"profileUrl\": \"http://example.com/profile.jpg\",\n    \"dateOfBirth\": \"1990-01-01\"\n  }\n}\n```\n\n- **Error (401):**\n```json\n{\n  \"success\": false,\n  \"message\": \"Unauthorized access, please login first.\",\n  \"status\": 401,\n  \"data\": null\n}\n```\n\n\n### **Update User Profile**\n\n```http\nPUT /api/v1/auth/update/:userId\n```\n\n| Parameter         | Type     | Description                              | Required |\n|-------------------|----------|------------------------------------------|----------|\n| `authentication`  | `string` | Your token                               | yes      |\n| `firstName`       | `string` | User's first name (3-15 characters)      | no       |\n| `lastName`        | `string` | User's last name (3-15 characters)       | no       |\n| `email`           | `string` | Valid email address                      | no       |\n| `bio`             | `string` | User's bio (max 500 characters)          | no       |\n| `skills`          | `array`  | Array of skills (optional)               | no       |\n| `profileUrl`      | `string` | Valid URL for profile picture            | no       |\n\n#### **Description:**\n\n- **Endpoint:** PUT /api/v1/auth/update/:userId\n- **Functionality:** Updates the user's profile with the provided information.\n\n**Request Body:**\n```json\n{\n  \"firstName\": \"John\",\n  \"lastName\": \"Doe\",\n  \"bio\": \"Updated bio\",\n  \"skills\": [\"JavaScript\", \"Node.js\"],\n  \"profileUrl\": \"http://example.com/updated_profile.jpg\"\n}\n```\n\n**Response:**\n- **Success (200):**\n```json\n{\n  \"success\": true,\n  \"message\": \"User profile updated successfully.\",\n  \"status\": 200,\n  \"data\": null\n}\n```\n\n- **Error (401):**\n```json\n{\n  \"success\": false,\n  \"message\": \"Unauthorized access, please login first.\",\n  \"status\": 401,\n  \"data\": null\n}\n```\n\n- **Error (422): Validation Error:**\n```json\n{\n  \"success\": false,\n  \"error\": \"Validation error\",\n  \"message\": \"One or more fields are invalid.\",\n  \"status\": 422,\n  \"data\": null\n}\n```\n\n\n\n##  **Users API Reference**\n\n\n### **Get User Feed**\n\n```http\nGET /api/v1/user/feed\n```\n\n| Parameter         | Type     | Description             | Required |\n|-------------------|----------|-------------------------|----------|\n| `authentication`  | `string` | Your token              | yes      |\n| `page`            | `number` | Page number for pagination | no      |\n| `limit`           | `number` | Number of results per page | no      |\n\n#### **Description:**\n\n- **Endpoint:** `GET /api/v1/user/feed`\n- **Functionality:** Fetches the user feed excluding the current user's profile and users involved in any connection requests with them (accepted, ignored, pending).\n\n**Request Header:**\n```json\n{\n  \"authentication\": \"yourjsonwebtoken\"\n}\n```\n\n**Response:**\n- **Success (200):**\n```json\n{\n  \"success\": true,\n  \"error\": false,\n  \"message\": \"User feed loaded successfully.\",\n  \"status\": 200,\n  \"data\": {\n    \"users\": [\n      {\n        \"firstName\": \"John\",\n        \"lastName\": \"Doe\",\n        \"profileUrl\": \"https://example.com/profile/johndoe\"\n      }\n    ],\n    \"pagination\": {\n      \"currentPage\": 1,\n      \"limit\": 20,\n      \"totalDocs\": 100,\n      \"totalPages\": 5,\n      \"nextPage\": 2,\n      \"prevPage\": null,\n      \"lastPage\": 5\n    }\n  }\n}\n```\n- **No Users Found (200):**\n```json\n{\n  \"success\": true,\n  \"error\": false,\n  \"message\": \"No users found for your feed.\",\n  \"status\": 200,\n  \"data\": {\n    \"users\": [],\n    \"pagination\": {\n      \"currentPage\": 1,\n      \"limit\": 20,\n      \"totalDocs\": 0,\n      \"totalPages\": 0,\n      \"nextPage\": null,\n      \"prevPage\": null,\n      \"lastPage\": 0\n    }\n  }\n}\n```\n\n---\n\n### **Get Pending Connection Requests**\n\n```http\nGET /api/v1/user/requests/pending\n```\n\n| Parameter         | Type     | Description         | Required |\n|-------------------|----------|---------------------|----------|\n| `authentication`  | `string` | Your token          | yes      |\n\n#### **Description:**\n\n- **Endpoint:** `GET /api/v1/user/requests/pending`\n- **Functionality:** Fetches all pending connection requests where the logged-in user is the recipient (status is `'interested'`).\n- **Response Data:**\n  - An array of pending connection requests with details of the sender (`firstName`, `lastName`, `profileUrl`).\n\n**Request Header:**\n```json\n{\n  \"authentication\": \"yourjsonwebtoken\"\n}\n```\n\n**Response:**\n- **Success (200):**\n```json\n{\n  \"success\": true,\n  \"error\": false,\n  \"message\": \"Pending connection requests retrieved successfully.\",\n  \"status\": 200,\n  \"data\": [\n    {\n      \"fromUserId\": {\n        \"firstName\": \"Jane\",\n        \"lastName\": \"Doe\",\n        \"profileUrl\": \"https://example.com/profile/janedoe\"\n      }\n    }\n  ]\n}\n```\n- **No Pending Requests (200):**\n```json\n{\n  \"success\": true,\n  \"error\": false,\n  \"message\": \"No pending connection requests found.\",\n  \"status\": 200,\n  \"data\": []\n}\n```\n\n---\n\n### **Get Matches \u0026 Connections**\n\n```http\nGET /api/v1/user/match/connections\n```\n\n| Parameter         | Type     | Description         | Required |\n|-------------------|----------|---------------------|----------|\n| `authentication`  | `string` | Your token          | yes      |\n\n#### **Description:**\n\n- **Endpoint:** `GET /api/v1/user/match/connections`\n- **Functionality:** Fetches all accepted connections (matches) where the logged-in user is either the sender or the receiver.\n\n**Request Header:**\n```json\n{\n  \"authentication\": \"yourjsonwebtoken\"\n}\n```\n\n**Response:**\n- **Success (200):**\n```json\n{\n  \"success\": true,\n  \"error\": false,\n  \"message\": \"User connections retrieved successfully.\",\n  \"status\": 200,\n  \"data\": [\n    {\n      \"firstName\": \"John\",\n      \"lastName\": \"Doe\",\n      \"profileUrl\": \"https://example.com/profile/johndoe\"\n    }\n  ]\n}\n```\n- **No Connections Found (204):**\n```json\n{\n  \"success\": true,\n  \"error\": false,\n  \"message\": \"No connections found.\",\n  \"status\": 204,\n  \"data\": []\n}\n```\n\n---\n\n\n##  **Connection Request API Reference**\n\n\n\n### **Send Connection Request**\n\n```http\nPOST /api/v1/request/send/:status/:toUserId\n```\n\n| Parameter         | Type     | Description                                          | Required |\n|-------------------|----------|------------------------------------------------------|----------|\n| `authentication`  | `string` | Your token                                           | yes      |\n| `status`          | `string` | Connection request status ('interested', 'ignored')   | yes      |\n| `toUserId`        | `string` | The ID of the user to whom the connection is sent     | yes      |\n\n#### **Description:**\n\n- **Endpoint:** `POST /api/v1/request/send/:status/:toUserId`\n- **Functionality:** Sends a connection request from the logged-in user to another user. The status can be either 'interested' or 'ignored'.\n- **Restrictions:** A user cannot send a connection request to themselves or send a duplicate request to the same user.\n\n**Request Header:**\n```json\n{\n  \"authentication\": \"yourjsonwebtoken\"\n}\n```\n\n**Request Example:**\n```http\nPOST /api/v1/request/send/interested/5f8f8c44b54764421b7156f2\n```\n\n**Response:**\n- **Success (200):**\n```json\n{\n  \"success\": true,\n  \"error\": false,\n  \"message\": \"Connection request sent successfully.\",\n  \"status\": 200,\n  \"data\": {\n    \"_id\": \"60b6ae5d2f9b8e001f2e4177\",\n    \"fromUserId\": \"60b6a7e5d2f9b8e001f2e4171\",\n    \"toUserId\": \"5f8f8c44b54764421b7156f2\",\n    \"status\": \"interested\",\n    \"createdAt\": \"2023-01-15T10:01:34.879Z\",\n    \"updatedAt\": \"2023-01-15T10:01:34.879Z\"\n  }\n}\n```\n- **Error Responses:**\n  - **(400) Sending request to self:**\n  ```json\n  {\n    \"success\": false,\n    \"error\": true,\n    \"message\": \"You cannot send a connection request to yourself.\",\n    \"status\": 400\n  }\n  ```\n  - **(400) Invalid status:**\n  ```json\n  {\n    \"success\": false,\n    \"error\": true,\n    \"message\": \"Invalid status provided. Valid statuses are 'interested' or 'ignore'.\",\n    \"status\": 400\n  }\n  ```\n  - **(400) Duplicate request:**\n  ```json\n  {\n    \"success\": false,\n    \"error\": true,\n    \"message\": \"A connection request between these users already exists.\",\n    \"status\": 400\n  }\n  ```\n  - **(404) User not found:**\n  ```json\n  {\n    \"success\": false,\n    \"error\": true,\n    \"message\": \"The user you are trying to connect with does not exist.\",\n    \"status\": 404\n  }\n  ```\n\n---\n\n### **Review Connection Request**\n\n```http\nPOST /api/v1/request/review/:status/:requestId\n```\n\n| Parameter         | Type     | Description                                         | Required |\n|-------------------|----------|-----------------------------------------------------|----------|\n| `authentication`  | `string` | Your token                                          | yes      |\n| `status`          | `string` | Connection request review status ('accepted', 'rejected') | yes      |\n| `requestId`       | `string` | The ID of the connection request to be reviewed     | yes      |\n\n#### **Description:**\n\n- **Endpoint:** `POST /api/v1/request/review/:status/:requestId`\n- **Functionality:** Allows the recipient of a connection request to review it, accepting or rejecting the request.\n- **Restrictions:** Only pending connection requests (status: 'interested') can be reviewed.\n\n**Request Header:**\n```json\n{\n  \"authentication\": \"yourjsonwebtoken\"\n}\n```\n\n**Request Example:**\n```http\nPOST /api/v1/request/review/accepted/60b6ae5d2f9b8e001f2e4177\n```\n\n**Response:**\n- **Success (200):**\n```json\n{\n  \"success\": true,\n  \"error\": false,\n  \"message\": \"Connection request successfully accepted.\",\n  \"status\": 200,\n  \"data\": {\n    \"_id\": \"60b6ae5d2f9b8e001f2e4177\",\n    \"fromUserId\": \"60b6a7e5d2f9b8e001f2e4171\",\n    \"toUserId\": \"60b6a8e5d2f9b8e001f2e4172\",\n    \"status\": \"accepted\",\n    \"createdAt\": \"2023-01-15T10:01:34.879Z\",\n    \"updatedAt\": \"2023-01-15T10:10:23.879Z\"\n  }\n}\n```\n- **Error Responses:**\n  - **(400) Invalid status:**\n  ```json\n  {\n    \"success\": false,\n    \"error\": true,\n    \"message\": \"Invalid status provided. Valid statuses are 'rejected' or 'accepted'.\",\n    \"status\": 400\n  }\n  ```\n  - **(404) Request not found:**\n  ```json\n  {\n    \"success\": false,\n    \"error\": true,\n    \"message\": \"Connection request not found or already reviewed.\",\n    \"status\": 404\n  }\n  ```\n\n---\n\n\n\n## Error Handling\n\nThe API utilizes `createHttpError` to manage error responses, ensuring a consistent approach to error handling. Below are some common error codes and their descriptions:\n\n- **400 Bad Request**: Invalid request parameters or missing required fields.\n- **401 Unauthorized**: Authentication failure or insufficient permissions to perform the action.\n- **403 Forbidden**: Access is forbidden for the requested action, typically due to lack of authorization.\n- **404 Not Found**: The requested resource could not be found.\n- **409 Conflict**: Resource conflict, such as an existing user with the same email.\n- **422 Unprocessable Entity**: Invalid or incomplete data provided, such as failed validation or a failed update.\n- **500 Internal Server Error**: An unexpected error occurred on the server side.\n\nThese error codes provide a standardized way to communicate issues with the request or server, allowing for better debugging and handling of failures in the client application.\n\n\n## Authentication Token\n\nAfter logging in, the user will receive a JWT token, which should be passed in the `Authorization` header as `Bearer \u003ctoken\u003e` for requests requiring authentication.\n\n---\n\n## Cookie Management\n\nThe `authToken` is stored as a cookie. To logout, the `authToken` is cleared from the cookies.\n\n\n\n\n# **Deployment**\n\nTo deploy this application, follow these steps:\n\n## **Deploying to Production**\n\n1. **Prepare Environment Variables**:\n   Ensure that the necessary environment variables are set up in your production environment. This includes variables like:\n\n- `DB_URI`: MongoDB connection string (ensure this points to your production MongoDB database).\n- `PORT`: The port on which the app will run.\n- `JWT_SECRET`: Secret key used for JWT token signing.\n- Other environment-specific variables.\n\n**Important**: Make sure to check the `.env.example` file for required environment variables. Copy the `.env.example` file to a new `.env` file, and fill in the necessary values for your production environment.\n\n2. **Push your code to a Git repository**:\n   If you are using a service like GitHub, GitLab, or Bitbucket, push your code to a remote repository.\n\n3. **Set up a Hosting Service**:\n   You can deploy the app on platforms like:\n\n   - **Heroku**:\n     - Install the Heroku CLI and log in.\n     - Create a Heroku app with `heroku create`.\n     - Deploy the app using `git push heroku master`.\n     - Configure environment variables using `heroku config:set`.\n     - For more up-to-date instructions, check the [Heroku documentation](https://devcenter.heroku.com/articles/deploying-nodejs) as it may update over time.\n   - **Render**:\n     - Sign up or log in to [Render](https://render.com/).\n     - Create a new **Web Service** by connecting your GitHub (or GitLab) account and selecting the repository.\n     - In the **Environment** section, select **Node** as the environment.\n     - Under **Build \u0026 Deploy**, Render will automatically detect and install the required dependencies.\n     - Add environment variables:\n       - Go to the \"Environment\" section in your Render app dashboard and set environment variables like:\n         ```bash\n         DB_URI=your_mongo_db_connection_string\n         JWT_SECRET=your_jwt_secret_key\n         ```\n     - Click **Create Web Service** to deploy your app.\n       -. For more detailed and up-to-date instructions, check Render's [documentation](https://render.com/).\n\n4. **Set up MongoDB**:\n   - For production, ensure that MongoDB is either hosted on MongoDB Atlas or a self-hosted instance.\n   - If using MongoDB Atlas, follow their [documentation](https://www.mongodb.com/cloud/atlas) to set up a cluster and get the connection string.\n   - If using a self-hosted MongoDB instance, ensure it is properly configured and secured.\n\n- Once deployed, your application will be live, and you can start interacting with it via the provided URL.\n\n## **Contributing**\n\nWe welcome contributions from the community! Here’s how you can help:\n\n### **How to Contribute**\n\n1. **Fork the repository**:\n\n   - Go to the project repository on GitHub and click on the **Fork** button to create a copy of the repository under your own GitHub account.\n\n2. **Clone the repository**:\n\n   - Clone your forked repository to your local machine:\n     ```bash\n     git clone https://github.com/saddamarbaa/node-express-mongodb-developer-match-rest-api\n     ```\n\n3. **Create a new branch**:\n\n   - Create a new branch for your feature or bug fix:\n     ```bash\n     git checkout -b your-feature-branch\n     ```\n\n4. **Make your changes**:\n\n   - Make your changes or additions to the project. Be sure to write clear, concise commit messages explaining your changes.\n\n5. **Test your changes**:\n\n   - Run tests and ensure everything works as expected.\n\n6. **Commit your changes**:\n\n   - Stage and commit your changes:\n     ```bash\n     git add .\n     git commit -m \"Add/Update feature description\"\n     ```\n\n7. **Push your changes**:\n\n   - Push your changes to your forked repository:\n     ```bash\n     git push origin your-feature-branch\n     ```\n\n8. **Create a Pull Request (PR)**:\n   - Go to the **Pull Requests** tab of the original repository and click **New Pull Request**.\n   - Select your branch and explain the changes you've made.\n   - Submit the PR for review.\n\n### **Code of Conduct**\n\nBy participating in this project, you agree to abide by the project's Code of Conduct. Please be respectful and kind to other contributors.\n\n### **Issues and Bugs**\n\nIf you find a bug or want to request a feature:\n\n1. **Check the issues**: Before opening a new issue, check if the problem or feature request already exists.\n2. **Report a bug or request a feature**: If the issue hasn’t been reported, create a new issue with a clear description of the problem or feature request. Please include:\n   - Steps to reproduce the issue (if applicable)\n   - Expected and actual behavior\n   - Any error messages or logs\n\n### **Documentation**\n\nIf you're contributing to the documentation:\n\n1. Ensure that any new or updated features are properly documented in the **README.md**.\n2. Ensure that any API changes are reflected in the API documentation.\n\n### **Thanks for your contributions!**\n\nYour contributions help improve this project and make it better for everyone. Thank you for your help!\n\n# **Project Status**\n\n- **Current Status**: This project is in **active development**.\n- **Upcoming Features**:\n  - **Notifications**: Users will receive notifications for post likes, comments, mentions, follows, and other interactions.\n  - **Content Moderation**: Admins will be able to flag posts or comments based on keywords, reports, or other indicators. Implement content filters (e.g., profanity filters, image moderation) for posts and comments. Users can report posts and comments as inappropriate.\n- **Contributions**: Contributions are welcome! See the [Contributing](#contributing) section for more.\n- **Known Issues**:\n  - Issue 1: Add tests for admin endpoints.\n  - See the [GitHub Issues page] for more.\n\n\n# **Feedback**\n\nWe value your feedback and would love to hear from you! If you have any suggestions, improvements, or bugs to report, please feel free to:\n\n- Open an issue on the [GitHub Issues page].\n- Send us an email at [saddamarbaas@gmail.com].\n\nYour feedback helps us improve the project and provide a better experience for everyone.\n\n# **Support**\n\nFor support, email saddamarbaas@gmail.com.\n\n# **License**\n\nThis project is licensed under the [MIT License](LICENSE).\n\nYou are free to use, modify, and distribute the code, but please ensure you follow the terms of the license. See the [LICENSE](LICENSE) file for more details.\n\n# 🔗 Social Links\n\n[![linkedin](https://img.shields.io/badge/linkedin-Code?style=for-the-badge\u0026logo=linkedin\u0026logoColor=white\u0026color=0077B5)](https://www.linkedin.com/in/saddamarbaa/)\n\n[![twitter](https://img.shields.io/badge/twitter-Code?style=for-the-badge\u0026logo=twitter\u0026logoColor=white\u0026color=1DA1F2)](https://twitter.com/ArbaaSaddam)\n\n# **Related Projects**\n\n\n\n### Open Source Blog REST API built with Node.js, Express, MongoDB, and TypeScript\n- [**GitHub Repo**](https://github.com/saddamarbaa/node-express-mongodb-typescript-blog-rest-api)\n- A powerful RESTful API built with Node.js, Express, MongoDB, and TypeScript for managing blog posts, user authentication, and content moderation. Includes features like filtering, pagination, sorting, and full-text search. Easily customizable and scalable for various use cases.\n\n\n### Dev Match App built with React, Vite, and TypeScript (Integrated with the current API)\n- [**GitHub Repo**](https://github.com/saddamarbaa/developer-match-app-vite-react-typescript)\n- A modern web application built with React, Vite, and TypeScript, integrated with the Developer Match API. It enables users to register, create and manage their profiles, and connect with other developers based on skills, interests, and technologies.\n\n---\n\n### **E-Commerce \u0026 Social API** built with Node.js, Express, MongoDB, and TypeScript\n\n- [**API Repository**](https://github.com/saddamarbaa/node-express-mongodb-typescript-ecom-social-rest-api)\n- An open-source RESTful API for User Authentication, E-commerce Management, and Social Media Post Management.\n- Includes features such as Filter, Pagination, Sort, and Search APIs to enhance your application.\n\n\n---\n\n### **Twitter API** built with Node.js, Express, and MongoDB\n\n- [**API Repository**](https://github.com/saddamarbaa/twitter-clone-api)\n- A simple Twitter clone API for building a social media platform with features like user authentication, tweets, follows.\n\n---\n\n### **Netflix API** built with Node.js, Express, and MongoDB\n\n- [**API Repository**](https://github.com/saddamarbaa/netflix-clone-api)\n- A clone of Netflix's backend API that allows you to manage movies, users, and subscriptions, with features such as authentication and content management.\n\n ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaddamarbaa%2Fnode-express-mongodb-developer-match-rest-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaddamarbaa%2Fnode-express-mongodb-developer-match-rest-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaddamarbaa%2Fnode-express-mongodb-developer-match-rest-api/lists"}