{"id":28416620,"url":"https://github.com/amritasri10/registration-form","last_synced_at":"2026-04-17T07:32:16.885Z","repository":{"id":234419066,"uuid":"755579527","full_name":"Amritasri10/registration-form","owner":"Amritasri10","description":"A full-stack user authentication system built with Node.js, Express, and MongoDB, featuring OTP-based email verification, Google OAuth login, JWT authentication, and session management. Includes a clean frontend with HTML, CSS, and JavaScript for seamless user experience.","archived":false,"fork":false,"pushed_at":"2025-06-14T08:56:19.000Z","size":885,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-24T16:45:35.095Z","etag":null,"topics":["authentication","backend","expressjs","fronted","full-stack","google-oauth","html-css-javascript","jwt","mongodb","mongoosejs","mvc-architecture","nodejs","nodemailer","passportjs","responsive-design","rest-api","session-management","user-authentication","web-development"],"latest_commit_sha":null,"homepage":"https://registration-form-73mx.onrender.com/","language":"HTML","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/Amritasri10.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-02-10T16:37:03.000Z","updated_at":"2025-06-14T08:56:23.000Z","dependencies_parsed_at":"2024-04-19T09:30:03.034Z","dependency_job_id":"6e8e9219-9e84-4f3a-b1b0-6b6c299ec1c2","html_url":"https://github.com/Amritasri10/registration-form","commit_stats":null,"previous_names":["amysri77/registration-form","amritasri10/registration-form"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Amritasri10/registration-form","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amritasri10%2Fregistration-form","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amritasri10%2Fregistration-form/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amritasri10%2Fregistration-form/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amritasri10%2Fregistration-form/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Amritasri10","download_url":"https://codeload.github.com/Amritasri10/registration-form/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amritasri10%2Fregistration-form/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31919958,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T18:22:33.417Z","status":"online","status_checked_at":"2026-04-17T02:00:06.879Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["authentication","backend","expressjs","fronted","full-stack","google-oauth","html-css-javascript","jwt","mongodb","mongoosejs","mvc-architecture","nodejs","nodemailer","passportjs","responsive-design","rest-api","session-management","user-authentication","web-development"],"created_at":"2025-06-03T22:39:53.513Z","updated_at":"2026-04-17T07:32:16.874Z","avatar_url":"https://github.com/Amritasri10.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 📝 Registration Form Project\n\nThe **Registration Form Project** is a complete user authentication system developed using **Node.js**, **Express**, and **MongoDB**. It provides both manual registration with **OTP-based email verification** and **Google OAuth login** through **Passport.js**, ensuring flexible and secure access for users. \n\nOnce registered or logged in, users are authenticated using **JWT tokens**, and their sessions are managed effectively to maintain persistent login states. The **frontend** is built with clean and responsive **HTML, CSS, and vanilla JavaScript**, offering a smooth user experience.\n\nOn the **backend**, robust logic ensures secure data handling, user validation, and integration with external services like email and Google OAuth. This project serves as a practical example of building modern authentication flows in full-stack web development.\n\n---\n\n## 🚀 Features\n\n- User registration with **OTP verification via email**\n- **Google OAuth 2.0** login/signup\n- **Welcome email** sent after successful registration\n- **JWT-based** secure login system\n- **Sessions managed** using `express-session`\n- Uses **MongoDB Atlas** for cloud database\n- Organized MVC structure for maintainability\n\n---\n\n## 🗂 Project Structure\n\n```\n    registration-form/      \n    ├── config/                                     #Passport.js config (Google Auth)\n    ├── controllers/                                # Auth logic: OTP \u0026 Google\n    │ ├── authController.js\n    │ └── googleAuthController.js\n    ├── middleware/                                 # Custom middleware\n    ├── models/\n    │ └── User.js                                   # Mongoose User model\n    ├── public/                                     # Static frontend (HTML, CSS)\n    │ ├── index.html                                # Registration form\n    │ ├── login.html                                # Login page\n    │ ├── verify-otp.html                           # OTP verification\n    │ ├── success.html                              # Login success\n    │ ├── error.html                                # Error screen\n    │ └── styles.css                                # Styling\n    ├── screenshots/\n    │   ├── registration-page.png\n    │   ├── otp-verification.png\n    │   ├── login-page.png\n    │   ├── success-page.png\n    │   ├── google-auth-email.png\n    ├── routes/\n    │ └── authRoutes.js                             # Express routes\n    ├── utils/\n    │ └── sendEmail.js                              # Utility to send emails\n    ├── .env # Environment variables\n    ├── server.js                                   # Main server entry point\n    ├── package.json\n    └── README.md\n```\n\n---\n\n## ⚙️ Technologies Used\n\n- **Frontend**: HTML, CSS, JavaScript\n- **Backend**: Node.js, Express.js\n- **Database**: MongoDB Atlas (via Mongoose)\n- **Authentication**: JWT, Google OAuth 2.0, OTP\n- **Email Service**: Nodemailer (SMTP)\n- **Session**: express-session\n\n---\n\n## 🔐 Authentication Flow\n\n### 🔸 Manual Registration\n\n1. User visits `/index.html` and Register the form.\n2. An OTP is sent to the provided email using `sendEmail.js`.\n3. User enters OTP at `/verify-otp.html`.\n4. On successful verification:\n   - Account is created in MongoDB.\n   - Welcome email is sent.\n   - User is redirected to `/login.html`.\n\n### 🔸 Login\n\n1. User enters email \u0026 password at `/login.html`.\n2. Server validates credentials.\n3. On success:\n   - JWT token is issued.\n   - Session is created.\n   - User is redirected to `/success.html`.\n\n### 🔸 Google OAuth\n\n1. User clicks **Google Login**.\n2. Google OAuth flow via Passport.js.\n3. New account is created (if first login).\n4. Welcome email sent.\n5. User redirected to `/success.html`.\n\n---\n\n### 🖼️ Screenshots\n\n#### Registration Page\n![Registration Page](./screenshots/registration-page.png)\n\n#### OTP Verification Page\n![OTP Verification](./screenshots/otp-verification.png)\n\n#### Login Success Page\n![Login Page](./screenshots/login-page.png)\n\n#### Success Page\n![Success Page](./screenshots/success-page.png)\n\n#### Google OAuth Welcome Email\n![Google OAuth Mail](./screenshots/google-auth-emai.png)\n\n---\n\n## 📬 Email Integration\n\n- OTP emails are triggered during registration.\n- Welcome emails are sent after:\n  - Successful manual registration\n  - Google OAuth-based registration\n\n---\n\n## 📌 API Endpoints\n\n### 🔹 `POST /register`\nRegisters a new user and sends OTP to email.\n\n### 🔹 `POST /verify-otp`\nVerifies OTP and creates the user account.\n\n### 🔹 `POST /login`\nAuthenticates user using email and password.\n\n### 🔹 `GET /auth/google`\nInitiates Google OAuth login.\n\n### 🔹 `GET /auth/google/callback`\nGoogle callback URL (used internally by Passport.js).\n\n---\n\n## 📦 Setup Instructions\n\n### 🔹 Prerequisites:\n\n- [Node.js installed](https://nodejs.org/)\n- [MongoDB Atlas account](https://www.mongodb.com/cloud/atlas)\n- [Gmail account (or SMTP credentials)](https://support.google.com/mail/answer/7126229?hl=en)\n\n### 🔹 Installation\n\n1. Clone the repo:\n   \n        `git clone https://github.com/Amritasri10/registration-form.git\n         cd registration-form`\n\n2. Install dependencies:\n   \n        `npm install` \n\n3. Create .env file:\n   \n       `PORT=5000\n        MONGO_URI=your_mongo_connection_string\n        JWT_SECRET=your_jwt_secret\n        EMAIL_USER=your_email@example.com\n        EMAIL_PASS=your_email_password\n        GOOGLE_CLIENT_ID=your_google_client_id\n        GOOGLE_CLIENT_SECRET=your_google_client_secret`\n\n4. Start the app:\n   \n        `node server.js`\n\n5. Open your browser and visit:\n\n        `http://localhost:5000`\n\n---\n\n## 🧪 Testing Instructions\n\n- Manual Register → OTP → Login → Success\n- Try wrong OTP → Should show error\n- Try Google OAuth → Should redirect and welcome\n- Check email inbox for OTP and Welcome mails\n\n---\n\n## 📄 License\n\nThis project is licensed under the MIT License - feel free to use it for personal or academic projects.\n\n---\n\n## Author \n\nConnect with me on:\n[LinkedIn ](https://www.linkedin.com/in/amrita-srivastava10/) | [GitHub](https://github.com/Amritasri10)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famritasri10%2Fregistration-form","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famritasri10%2Fregistration-form","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famritasri10%2Fregistration-form/lists"}