{"id":15160922,"url":"https://github.com/mhdzhhan/advanced-mern-auth","last_synced_at":"2025-04-10T11:09:59.555Z","repository":{"id":255304812,"uuid":"849110598","full_name":"mhdZhHan/advanced-mern-auth","owner":"mhdZhHan","description":"🔐 Advanced MERN Authentication System | 🚀 Secure user login, registration, and password management with modern UI enhancements.","archived":false,"fork":false,"pushed_at":"2024-10-15T04:44:50.000Z","size":184,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T09:52:57.324Z","etag":null,"topics":["cookie","express","framer-motion","jwt-auth","mailtrap","mongodb","nodejs","react","tailwindcss","zustand"],"latest_commit_sha":null,"homepage":"https://auth.mohammedsh.xyz","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/mhdZhHan.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-08-29T02:01:20.000Z","updated_at":"2024-10-28T02:18:53.000Z","dependencies_parsed_at":"2024-08-29T06:48:09.827Z","dependency_job_id":"e23e34a5-5a89-4390-870c-7bccd33ce0f8","html_url":"https://github.com/mhdZhHan/advanced-mern-auth","commit_stats":{"total_commits":32,"total_committers":2,"mean_commits":16.0,"dds":0.03125,"last_synced_commit":"a19a8532adaaf5fad856cb9d234ceb8844b066e7"},"previous_names":["mhdzhhan/advanced-mern-auth"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhdZhHan%2Fadvanced-mern-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhdZhHan%2Fadvanced-mern-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhdZhHan%2Fadvanced-mern-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhdZhHan%2Fadvanced-mern-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mhdZhHan","download_url":"https://codeload.github.com/mhdZhHan/advanced-mern-auth/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248208559,"owners_count":21065202,"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":["cookie","express","framer-motion","jwt-auth","mailtrap","mongodb","nodejs","react","tailwindcss","zustand"],"created_at":"2024-09-26T23:42:14.918Z","updated_at":"2025-04-10T11:09:59.537Z","avatar_url":"https://github.com/mhdZhHan.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 Advanced MERN Authentication\n\nWelcome to the **Advanced MERN Authentication!** This project provides a robust authentication system built with the MERN (**MongoDB**, **Express**, **React**, **Node.js**) stack. It includes essential features like user registration, `login`, `logout`, `email` `verification`, and `password management`.\n\n## 🌟 Features\n\n-   **🔒 Check Authentication** (`/check-auth`): Verify if the user is authenticated.\n-   **📝 Sign up** (`/signup`): Register a new user account.\n-   **🔐 Login** (`/login`): Authenticate and log in a user.\n-   **🚪 Logout** (`/logout`): Log out the user by invalidating the session/token.\n-   **📧 Email Verification** (`/verify-email`): Verify a user's email address.\n-   **🔑 Forgot Password** (`/forgot-password`): Initiate the password reset process.\n-   **🔄 Reset Password** (`/reset-password/:token`): Reset the user's password using a secure token.\n-   **🍪 Generate Token and Set Cookie**: Creates a JWT token and securely sets it in a cookie.\n-   **🚀 Frontend Pages**: Includes frontend pages such as `Sign Up`, `Login`, `Dashboard`, `Forgot Password`, `Reset Password`, and `Email Verification`.\n-   **📦 State Management**: The project uses `Zustand` for state management to handle user authentication state.\n-   **⚡ API Integration**: `Axios` is used for seamless integration with the authentication API.\n-   **🎨 UI Enhancements**: `Tailwind CSS` is used for modern and responsive styling, while `Framer Motion` adds smooth animations and transitions for a dynamic user experience.\n\n## 🛠️ Installation\n\nClone the repository:\n\n```bash\ngit clone https://github.com/mhdZhHan/advanced-mern-auth.git\ncd advanced-mern-auth\n```\n\n## Install dependencies and build the app:\n\n```bash\nnpm run build\n```\n\n## Set up environment variables:\n\nCreate a `.env` file in the root directory and add the following variables:\n\n```env\nMONGODB_URL=\"\" # MongoDB connection string\nJWT_SECRET=\"\" # Secret key for JWT signing\nNODE_ENV=\"development\" # Set to \"production\" in a live environment\nMAILTRAP_TOKEN=\"\" # Mailtrap API token for sending emails\nMAILTRAP_ENDPOINT=\"\" # Mailtrap API endpoint for email services\nCLIENT_URL=\"http://localhost:5173\" # URL of the React frontend application\n```\n\n## Run the application:\n\n```bash\nnpm run start\n```\n\nYour server should now be running on `http://localhost:5000`.\n\n## 🔗 API Endpoints\n\nThe authentication-related API endpoints are available under the `/api/auth` base URL. Here are the available routes:\n\n-   **GET** `/api/auth/check-auth`: Verifies if the user is authenticated by checking the token.\n-   **POST** `/api/auth/signup`: Registers a new user and sends an email verification link.\n-   **POST** `/api/auth/login`: Logs in the user and returns a JWT token.\n-   **POST** `/api/auth/logout`: Logs out the user by clearing the session.\n-   **POST** `/api/auth/verify-email`: Verifies the user's email address with a token.\n-   **POST** `/api/auth/forgot-password`: Sends a password reset link to the user's email.\n-   **POST** `/api/auth/reset-password/:token`: Resets the user's password using the provided token.\n\n## 🚀 Technologies Used\n\n-   **MongoDB**: Database for storing user information.\n-   **Express**: Web framework for handling routes and middleware.\n-   **React**: Frontend framework for creating the client-side application (not included in this repo).\n-   **Node.js**: Backend runtime environment.\n-   **JSON Web Tokens (JWT)**: For secure user authentication.\n-   **Mailtrap**: Service for sending emails (used for email verification and password reset).\n-   **Zustand**: State management library for handling user authentication state.\n-   **Axios**: HTTP client for making API requests.\n-   **Tailwind CSS**: Utility-first CSS framework for modern and responsive styling.\n-   **Framer Motion**: Library for adding smooth animations and transitions for enhanced UI interactions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmhdzhhan%2Fadvanced-mern-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmhdzhhan%2Fadvanced-mern-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmhdzhhan%2Fadvanced-mern-auth/lists"}