{"id":24628425,"url":"https://github.com/gudzsv/nodejs-auth-api-mongodb","last_synced_at":"2026-04-08T20:50:53.379Z","repository":{"id":250059414,"uuid":"833305517","full_name":"gudzsv/nodejs-auth-api-mongodb","owner":"gudzsv","description":"This is a fully-featured backend application for managing contacts, tasks, and users. The system supports user sessions with automatic expiration after a set duration. It includes functionality for password reset, with a link sent to the user's email through a customizable email template. Contacts and other data are stored in a MongoDB","archived":false,"fork":false,"pushed_at":"2024-09-03T01:49:06.000Z","size":980,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-20T04:07:10.544Z","etag":null,"topics":["bcrypt","handlebars","jwt-token","mongodb","multer","nodejs","nodemailer","rest-api","swagger","validation"],"latest_commit_sha":null,"homepage":"https://nodejs-auth-api-mongodb.onrender.com/api-docs/","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/gudzsv.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}},"created_at":"2024-07-24T19:08:05.000Z","updated_at":"2024-11-29T14:07:01.000Z","dependencies_parsed_at":"2024-11-25T07:50:34.253Z","dependency_job_id":"2043b6a1-0202-4d01-92ad-e90c13578a85","html_url":"https://github.com/gudzsv/nodejs-auth-api-mongodb","commit_stats":null,"previous_names":["gudzsv/nodejs-hw-mongodb","gudzsv/nodejs-auth-api-mongodb"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gudzsv/nodejs-auth-api-mongodb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gudzsv%2Fnodejs-auth-api-mongodb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gudzsv%2Fnodejs-auth-api-mongodb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gudzsv%2Fnodejs-auth-api-mongodb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gudzsv%2Fnodejs-auth-api-mongodb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gudzsv","download_url":"https://codeload.github.com/gudzsv/nodejs-auth-api-mongodb/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gudzsv%2Fnodejs-auth-api-mongodb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31573788,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"ssl_error","status_checked_at":"2026-04-08T14:31:17.202Z","response_time":54,"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":["bcrypt","handlebars","jwt-token","mongodb","multer","nodejs","nodemailer","rest-api","swagger","validation"],"created_at":"2025-01-25T05:43:41.875Z","updated_at":"2026-04-08T20:50:53.357Z","avatar_url":"https://github.com/gudzsv.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Backend Application for Managing Contacts and Users\n\n## Overview\n\nThis project is a fully-featured backend application designed to manage contacts and users. It includes functionality for user session management, password reset, and email notification. The application also supports adding user photos, which are stored in Cloudinary, with the image URLs saved in MongoDB.\n\n## Features\n\n- **User Management**:\n  - Register, login, and manage user sessions with JWT tokens.\n  - Password reset functionality with a reset link sent via email.\n- **Contacts Management**:\n  - Create, update, and manage contacts.\n  - Upload user photos, which are stored in Cloudinary with URLs saved in MongoDB.\n- **API Documentation**:\n  - RESTful API documentation available through Swagger.\n\n## Technology Stack\n\n- **Node.js**: Server-side runtime environment.\n- **Express.js**: Web framework for building RESTful APIs.\n- **MongoDB**: NoSQL database for storing user data, contacts, and session information.\n- **Handlebars**: Template engine for dynamic email templates.\n- **Swagger**: API documentation tool.\n- **bcrypt**: Library for hashing and comparing passwords.\n- **JWT (JSON Web Tokens)**: Secure method for transmitting user session data.\n- **Multer**: Middleware for handling `multipart/form-data`, used for uploading files.\n- **Nodemailer**: Node.js module for sending emails.\n- **Cloudinary**: Cloud-based service for storing and managing images.\n\n## Installation\n\n### Prerequisites\n\n- Node.js\n- MongoDB\n- Cloudinary Account (for image storage)\n\n### Steps to Set Up\n\n1. **Clone the repository:**\n   ```bash\n   git clone https://github.com/gudzsv/nodejs-hw-mongodb.git\n   cd your-repository\n\t ```\n\n2. **Install dependencies:**\n\t```bash\n\tnpm install\n\t```\n\n3. **Set up environment variables:**\n \tCreate a .env file in the root of your project and add the following:\n\t```env\n\tAPP_DOMAIN=\n\tAPP_PORT=\n\tMONGODB_USER=\n\tMONGODB_PASSWORD=\n\tMONGODB_URL=\n\tMONGODB_DB=\n\tSALT=\n\tSMTP_HOST=\n\tSMTP_PORT=\n\tSMTP_USER=\n\tSMTP_PASSWORD=\n\tSMTP_FROM=\n\tCLOUDINARY_CLOUD_NAME=\n\tCLOUDINARY_API_KEY=\n\tCLOUDINARY_API_SECRET=\n\tJWT_SECRET=\n\t```\n4. **Run the application:**\n\t```bash\n\tnpm run dev\n\t```\n5. **Access the API Documentation:**\nAfter running the application, you can access the Swagger API documentation at:\n\t```bash\n\tlocal:\n\thttp://localhost:8080/api-docs\n\ton server:\n\thttps://nodejs-hw-mongodb-n71x.onrender.com/api-docs/\n\t```\n## Usage\n**User Registration and Authentication**\n- Users can register with an email and password and name.\n- Upon registration, a token is issued for session management.\n- Users can reset their password by receiving a reset link via email.\n\n**Contact Management**\n- Users can create and manage their contacts.\n- Each contact can have an associated photo, which is uploaded via the API and stored in Cloudinary.\n- The URL to the photo is stored in MongoDB for easy retrieval.\n\n**API Endpoints**\nHere are some of the key API endpoints:\n\n- User Authentication\n\n  - POST /auth/register: Register a new user.\n  - POST /auth/login: Login and receive a JWT token.\n  - POST /auth/refresh: Refresh session accessToken\n  - POST /auth/logout: Logout clear cookies and remove session from database\n  - POST /auth/send-reset-email: Request a password reset link.\n  - POST /auth/reset-pwd: Reset user password\n\n- Contacts\n\n  - GET /contacts: Get all contacts.\n  - GET /contacts/{contactId}: Get contact by id\n  - POST /contacts: Create a new contact with an optional photo.\n  - PATCH /contacts/{contactId}: Update contacts parameters\n  - DELETE /contacts/{contactId}: Delete an existing Contact\n\nFor a full list of endpoints and their details, refer to the [Swagger documentation](https://nodejs-hw-mongodb-n71x.onrender.com/api-docs/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgudzsv%2Fnodejs-auth-api-mongodb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgudzsv%2Fnodejs-auth-api-mongodb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgudzsv%2Fnodejs-auth-api-mongodb/lists"}