{"id":19475740,"url":"https://github.com/faiziimam/contact-manager-be","last_synced_at":"2026-04-29T21:01:43.442Z","repository":{"id":244628750,"uuid":"815795495","full_name":"Faiziimam/contact-manager-be","owner":"Faiziimam","description":"This repository contains the code for a Contact Management API built using Node.js, Express, and MongoDB. The API allows authenticated users to manage their contacts and user accounts through various endpoints for creating, retrieving, updating, and deleting contact information as well as user registration, login, and profile retrieval.","archived":false,"fork":false,"pushed_at":"2024-06-19T08:06:12.000Z","size":51,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-27T22:00:00.325Z","etag":null,"topics":["backend","contact-management-api-s","express","javascript","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Faiziimam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2024-06-16T07:16:33.000Z","updated_at":"2024-06-19T08:06:15.000Z","dependencies_parsed_at":"2024-06-19T16:29:19.175Z","dependency_job_id":"5bb22422-7e45-462a-8cd0-9043cff67fbd","html_url":"https://github.com/Faiziimam/contact-manager-be","commit_stats":null,"previous_names":["faiziimam/contact-manager-be"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Faiziimam/contact-manager-be","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Faiziimam%2Fcontact-manager-be","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Faiziimam%2Fcontact-manager-be/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Faiziimam%2Fcontact-manager-be/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Faiziimam%2Fcontact-manager-be/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Faiziimam","download_url":"https://codeload.github.com/Faiziimam/contact-manager-be/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Faiziimam%2Fcontact-manager-be/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32443576,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T20:22:27.477Z","status":"ssl_error","status_checked_at":"2026-04-29T20:22:26.507Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["backend","contact-management-api-s","express","javascript","nodejs"],"created_at":"2024-11-10T19:34:37.082Z","updated_at":"2026-04-29T21:01:43.398Z","avatar_url":"https://github.com/Faiziimam.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Contact Management API\n\nThis repository contains the code for a Contact Management API built using Node.js, Express, and MongoDB. The API allows authenticated users to manage their contacts and user accounts through various endpoints for creating, retrieving, updating, and deleting contact information as well as user registration, login, and profile retrieval.\n\n## Features\n\n- **Authentication**: All contact-related endpoints are protected and require the user to be authenticated.\n- **User Management**: Endpoints for user registration, login, and profile retrieval.\n- **CRUD Operations**: Users can create, read, update, and delete contacts.\n- **Error Handling**: Proper error handling and response status codes for different scenarios.\n\n## API Endpoints\n\n### User Endpoints\n\n#### Register a New User\n\n- **Description**: Register a new user.\n- **Route**: `POST /api/users/register`\n- **Access**: Public\n- **Request Body**:\n  ```json\n  {\n        \"userName\": \"NewUser\",\n        \"email\": \"newuser@example.com\",\n        \"password\": \"userpassword\"\n  }\n\n-   **Response**:\n\n    ```json\n\n    {\n          \"isSuccess\": true,\n          \"id\": \"user_id\",\n          \"email\": \"newuser@example.com\"\n    }\n    \n#### Login a User\n\n-   **Description**: Login an existing user.\n-   **Route**: `POST /api/users/login`\n-   **Access**: Public\n-   **Request Body**:\n\n     ```json\n\n\n    {\n          \"email\": \"user@example.com\",\n          \"password\": \"userpassword\"\n    }\n\n-   **Response**:\n\n      ```json\n\n    {\n          \"accessToken\": \"jwt_token\"\n    }\n\n#### Get Current User Details\n\n-   **Description**: Retrieve details of the currently authenticated user.\n-   **Route**: `GET /api/users/currentUserDetails`\n-   **Access**: Private\n-   **Response**:\n\n    ```json\n\n    {\n          \"isSuccess\": true,\n          \"user\": {\n            \"id\": \"user_id\",\n            \"userName\": \"User\",\n            \"email\": \"user@example.com\"\n          }\n    }\n\n### Contact Endpoints\n\n#### Get All Contacts\n\n-   **Description**: Retrieve all contacts for the authenticated user.\n-   **Route**: `GET /api/contacts`\n-   **Access**: Private\n-   **Response**:\n\n    ```json\n\n    {\n      \"isSuccess\": true,\n      \"contact\": [ ... ]\n    }\n\n#### Create a Contact\n\n-   **Description**: Create a new contact for the authenticated user.\n-   **Route**: `POST /api/contacts`\n-   **Access**: Private\n-   **Request Body**:\n\n     ```json\n\n    {\n      \"name\": \"Contact Name\",\n      \"email\": \"contact@example.com\",\n      \"phone\": \"123-456-7890\"\n    }\n\n-   **Response**:\n\n    ```json\n\n    {\n      \"isSuccess\": true,\n      \"contact\": { ... }\n    }\n\n#### Get Individual Contact\n\n-   **Description**: Retrieve a specific contact by its ID.\n-   **Route**: `GET /api/contacts/:id`\n-   **Access**: Private\n-   **Response**:\n\n    ```json\n\n    {\n      \"isSuccess\": true,\n      \"contact\": { ... }\n    }\n\n#### Update a Contact\n\n-   **Description**: Update the details of a specific contact.\n-   **Route**: `PUT /api/contacts/:id`\n-   **Access**: Private\n-   **Request Body**: (fields to update)\n\n    ```json\n\n    {\n      \"name\": \"Updated Name\",\n      \"email\": \"updated@example.com\",\n      \"phone\": \"098-765-4321\"\n    }\n\n-   **Response**:\n\n    ```json\n\n    {\n      \"isSuccess\": true,\n      \"message\": \"Contact updated for ID: :id\",\n      \"updatedContact\": { ... }\n    }\n\n#### Delete a Contact\n\n-   **Description**: Delete a specific contact.\n-   **Route**: `DELETE /api/contacts/:id`\n-   **Access**: Private\n-   **Response**:\n\n     ```json\n\n    \n    {\n      \"isSuccess\": true,\n      \"message\": \"Contact Deleted with ID: :id\",\n      \"deletedContact\": { ... }\n    }\n\nError Handling\n--------------\n\nThe API uses standard HTTP status codes to indicate success or failure of requests:\n\n-   200 OK: The request was successful.\n-   201 Created: A new resource has been created.\n-   400 Bad Request: The request was invalid or cannot be otherwise served.\n-   401 Unauthorized: The request requires user authentication.\n-   403 Forbidden: The request is understood, but it has been refused or access is not allowed.\n-   404 Not Found: The requested resource could not be found.\n-   500 Internal Server Error: An error occurred on the server.\n\nSetup and Installation\n----------------------\n\n1.  **Clone the repository**:\n\n    ```bash\n    git clone https://github.com/yourusername/contact-management-api.git\n    cd contact-management-api\n    ```\n\n2.  **Install dependencies**:\n\n    ```bash\n\n    npm install\n\n3.  **Set up environment variables**:\n\n    Create a `.env` file in the root of the project and add the following:\n\n    ```env\n\n    CONNECTION_STRING=your_mongodb_connection_string\n    ACCESS_TOKEN_SECRET_KEY=your_jwt_secret\n\n4.  **Start the server**:\n\n   ```bash\n   npm start\n   ```\n\nUsage\n-----\n\nMake sure you have a tool like Postman or curl to test the API endpoints. All requests to the API should include a valid JWT token in the Authorization header.\n\nLicense\n-------\n\nThis project is licensed under the MIT License. See the `LICENSE` file for more details.\n\nContributing\n------------\n\nContributions are welcome! Please open an issue or submit a pull request for any bugs or improvements.\n\nContact\n-------\n\nFor any inquiries, please contact faizkalwara@gmail.com.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaiziimam%2Fcontact-manager-be","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffaiziimam%2Fcontact-manager-be","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaiziimam%2Fcontact-manager-be/lists"}