{"id":28287189,"url":"https://github.com/karan19698/mern-auth","last_synced_at":"2026-04-12T10:44:19.279Z","repository":{"id":283759899,"uuid":"952827115","full_name":"karanshah1561998/mern-auth","owner":"karanshah1561998","description":"Full-stack MERN auth app with JWT, email verification, password reset, and protected routes.","archived":false,"fork":false,"pushed_at":"2025-04-04T21:57:09.000Z","size":189,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-21T22:11:36.383Z","etag":null,"topics":["express","javascript","jwt","mailtrap","mern","mongodb-atlas","nodejs","react","render","tailwindcss"],"latest_commit_sha":null,"homepage":"https://mern-auth-ysso.onrender.com","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/karanshah1561998.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":"2025-03-22T00:41:40.000Z","updated_at":"2025-04-04T21:57:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"bf0b80e9-5be3-4df5-a0e4-c5cf613ce156","html_url":"https://github.com/karanshah1561998/mern-auth","commit_stats":null,"previous_names":["karanshah1561998/mern-auth"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/karanshah1561998/mern-auth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karanshah1561998%2Fmern-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karanshah1561998%2Fmern-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karanshah1561998%2Fmern-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karanshah1561998%2Fmern-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/karanshah1561998","download_url":"https://codeload.github.com/karanshah1561998/mern-auth/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karanshah1561998%2Fmern-auth/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260488369,"owners_count":23016900,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["express","javascript","jwt","mailtrap","mern","mongodb-atlas","nodejs","react","render","tailwindcss"],"created_at":"2025-05-21T22:11:11.626Z","updated_at":"2025-12-30T23:04:38.395Z","avatar_url":"https://github.com/karanshah1561998.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🔐 MERN Auth\nA full-stack **authentication system** built using the MERN stack (MongoDB, Express.js, React.js, Node.js). Includes robust features like email verification, password reset, and JWT-protected routes. Ideal for bootstrapping secure, modern web applications.\n\n## 🚀 Live Demo\nAccess the live app here: [MERN Auth](https://mern-auth-ysso.onrender.com)\n\n## ✨ Features\n- User Signup \u0026 Login\n- JWT Authentication \u0026 Session Management\n- Email Verification (via Mailtrap)\n- Forgot Password \u0026 Reset Functionality\n- Protected Routes (Frontend + Backend)\n- Responsive UI with TailwindCSS\n- Password Strength Meter\n- Toast Notifications\n- Real-Time Form Validation\n\n## 🛠 Tech Stack\n- Frontend: React.js (Vite), Tailwind CSS\n- Backend: Node.js, Express.js\n- Database: MongoDB (Atlas)\n- Authentication: JWT + Email Verification\n- Email Service: Mailtrap Email Sending API\n- Hosting: Render\n\n## ⚙️ Installation\n### Prerequisites\n**Ensure you have the following installed:**\n- Node.js (v16+)\n- MongoDB (local or Atlas)\n- Mailtrap account with verified domain (`karanshah.dev`)\n\n### Setup\n1. **Clone the Repository:**\n   ```bash\n   git clone https://github.com/karanshah1561998/mern-auth.git\n   cd mern-auth\n\n2. **Install dependencies:**\n   ```bash\n   cd mern-auth/backend\n   npm install\n   \n   cd mern-auth/frontend\n   npm install\n\n3. **Set up environment variables:**\n   Create a `.env` file in the mern-auth/backend directory and add:\n   ```bash\n   PORT = 3000\n   NODE_ENV = development\n   MONGODB_URI = your_mongodb_uri\n   JWT_SECRET = your_jwt_secret\n   MAILTRAP_TOKEN = your_token\n   CLIENT_URL = http://localhost:5173\n\n4. **Navigate to the backend directory and start the backend server:**\n   ```bash\n   cd friendsync/backend\n   npm run dev\n\n5. **Navigate to the frontend directory and start the React app:**\n   ```bash\n   cd friendsync/frontend\n   npm run dev\n\n   Open http://localhost:5173 to view the app in your browser.\n\n## 📩 Email Functionality (Mailtrap Setup)\n- Domain: `karanshah.dev` (Verified with Mailtrap)\n- Emails sent via `@karanshah.dev` using Mailtrap Email Sending\n- Templates: Welcome Email, Password Reset, Email Verification\n- Uses Mailtrap Email API, not SMTP\n\n## 🧩 Troubleshooting\n\n### 1. Email Not Sending\n- Ensure `MAILTRAP_TOKEN` and other Mailtrap credentials are correct in `.env`.\n- Verify that your domain `yourdomain.com` is verified on Mailtrap.\n- Make sure you're using Mailtrap **Email Sending** (not SMTP).\n\n### 2. Invalid JWT / Auth Errors\n- Check if the JWT secret in `.env` matches what's used in your backend logic.\n- Confirm if the token is being correctly stored (e.g., localStorage or cookies).\n- Look for expired tokens or improperly signed tokens.\n\n### 3. MongoDB Connection Issues\n- Double-check your `MONGODB_URI` in the `.env` file.\n- Ensure your current IP address is whitelisted in MongoDB Atlas.\n- Verify that your cluster is active and accessible.\n\n### 4. CORS or Proxy Issues\n- Add CORS middleware in your Express app and allow requests from your frontend domain.\n- If using Vite, set `\"proxy\"` in `vite.config.js` for API requests.\n- Use tools like browser dev tools or Postman to inspect CORS headers.\n\n### 5. Password Reset Not Working\n- Confirm that the token is sent to the correct user email and is valid.\n- Check the backend logic for token expiration time and validation.\n- Ensure the frontend is sending the token correctly via the reset URL.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaran19698%2Fmern-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaran19698%2Fmern-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaran19698%2Fmern-auth/lists"}