{"id":19454496,"url":"https://github.com/codemaster17/role-based-authentication-authjs","last_synced_at":"2025-07-11T08:03:55.620Z","repository":{"id":215769794,"uuid":"737594332","full_name":"CodeMaster17/role-based-authentication-Authjs","owner":"CodeMaster17","description":"Role based authentication system","archived":false,"fork":false,"pushed_at":"2024-02-05T17:40:16.000Z","size":487,"stargazers_count":15,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-14T23:37:02.368Z","etag":null,"topics":["authentication-system","authjs","github-auth","google-authentication","google-cloud","middleware","neon-db","nextjs14","oauth","prisma-orm","resend-email","role-based-access-control"],"latest_commit_sha":null,"homepage":"https://role-based-authentication-authjs.vercel.app","language":"TypeScript","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/CodeMaster17.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":"2023-12-31T17:03:23.000Z","updated_at":"2025-01-28T07:59:18.000Z","dependencies_parsed_at":"2025-01-08T00:55:59.366Z","dependency_job_id":"163accf9-5a3d-438c-ae45-a07a886d6f72","html_url":"https://github.com/CodeMaster17/role-based-authentication-Authjs","commit_stats":{"total_commits":24,"total_committers":2,"mean_commits":12.0,"dds":0.125,"last_synced_commit":"39f49f522b28f7ac953d7eaaee1e862b1fb87c92"},"previous_names":["codemaster17/next-auth-v5-toolkit","codemaster17/role-based-authentication-authjs"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/CodeMaster17/role-based-authentication-Authjs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeMaster17%2Frole-based-authentication-Authjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeMaster17%2Frole-based-authentication-Authjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeMaster17%2Frole-based-authentication-Authjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeMaster17%2Frole-based-authentication-Authjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CodeMaster17","download_url":"https://codeload.github.com/CodeMaster17/role-based-authentication-Authjs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeMaster17%2Frole-based-authentication-Authjs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264763124,"owners_count":23660302,"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":["authentication-system","authjs","github-auth","google-authentication","google-cloud","middleware","neon-db","nextjs14","oauth","prisma-orm","resend-email","role-based-access-control"],"created_at":"2024-11-10T17:09:54.712Z","updated_at":"2025-07-11T08:03:55.565Z","avatar_url":"https://github.com/CodeMaster17.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\r\nHome Page\r\n![image](https://github.com/CodeMaster17/role-based-authentication-Authjs/assets/96763776/e1dfd40a-1dda-43ea-8f62-e839aadd30f5)\r\n\r\nLogin page\r\n![image](https://github.com/CodeMaster17/role-based-authentication-Authjs/assets/96763776/9f0e2fad-b380-4f1c-a622-1b45ac9702f3)\r\n\r\nRegister Page\r\n![image](https://github.com/CodeMaster17/role-based-authentication-Authjs/assets/96763776/91375ff6-d19d-47c3-be3e-d8893a6eff66)\r\n\r\nSettings Page\r\n![image](https://github.com/CodeMaster17/role-based-authentication-Authjs/assets/96763776/91663aaf-f2e1-4aa4-87fe-3b4fde78817d)\r\n\r\nDescription: \u003cbr/\u003e\r\nWelcome to our Next.js Authentication Guide, a comprehensive resource designed to empower developers with the tools and knowledge needed to implement a robust authentication system in their Next.js applications. Leveraging NextAuth.js, this guide covers everything from setting up basic login mechanisms to implementing advanced security features. \r\n\r\nKey Features:\r\n- 🔐 Next-auth v5 (Auth.js)\r\n- 🚀 Next.js 14 with server actions\r\n- 🔑 Credentials Provider\r\n- 🌐 OAuth Provider (Social login with Google \u0026 GitHub)\r\n- 🔒 Forgot password functionality\r\n- ✉️ Email verification\r\n- 📱 Two factor verification\r\n- 👥 User roles (Admin \u0026 User)\r\n- 🔓 Login component (Opens in redirect or modal)\r\n- 📝 Register component\r\n- 🤔 Forgot password component\r\n- ✅ Verification component\r\n- ⚠️ Error component\r\n- 🔘 Login button\r\n- 🚪 Logout button\r\n- 🚧 Role Gate\r\n- 🔍 Exploring next.js middleware\r\n- 📈 Extending \u0026 Exploring next-auth session\r\n- 🔄 Exploring next-auth callbacks\r\n- 👤 useCurrentUser hook\r\n- 🛂 useRole hook\r\n- 🧑 currentUser utility\r\n- 👮 currentRole utility\r\n- 🖥️ Example with server component\r\n- 💻 Example with client component\r\n- 👑 Render content for admins using RoleGate component\r\n- 🛡️ Protect API Routes for admins only\r\n- 🔐 Protect Server Actions for admins only\r\n- 📧 Change email with new verification in Settings page\r\n- 🔑 Change password with old password confirmation in Settings page\r\n- 🔔 Enable/disable two-factor auth in Settings page\r\n- 🔄 Change user role in Settings page (for development purposes only)\r\n\r\n### Prerequisites\r\n\r\n**Node version 18.7.x**\r\n\r\n### Cloning the repository\r\n\r\n```shell\r\ngit clone https://github.com/CodeMaster17/role-based-authentication-Authjs.git\r\n```\r\n\r\n### Install packages\r\n\r\n```shell\r\nnpm i\r\n```\r\n\r\n### Setup .env file\r\n\r\n\r\n```js\r\nDATABASE_URL=\r\nDIRECT_URL=\r\n\r\nAUTH_SECRET=\r\n\r\nGITHUB_CLIENT_ID=\r\nGITHUB_CLIENT_SECRET=\r\n\r\nGOOGLE_CLIENT_ID=\r\nGOOGLE_CLIENT_SECRET=\r\n\r\nRESEND_API_KEY=\r\n\r\nNEXT_PUBLIC_APP_URL=\r\n```\r\n\r\n### Setup Prisma\r\n```shell\r\nnpx prisma generate\r\nnpx prisma db push\r\n```\r\n\r\n### Start the app\r\n\r\n```shell\r\nnpm run dev\r\n```\r\n\r\n## Available commands\r\n\r\nRunning commands with npm `npm run [command]`\r\n\r\n| command         | description                              |\r\n| :-------------- | :--------------------------------------- |\r\n| `dev`           | Starts a development instance of the app |\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodemaster17%2Frole-based-authentication-authjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodemaster17%2Frole-based-authentication-authjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodemaster17%2Frole-based-authentication-authjs/lists"}