{"id":21155403,"url":"https://github.com/nuhptr/next-auth-v5-completed","last_synced_at":"2025-03-14T15:15:56.363Z","repository":{"id":227027351,"uuid":"770229632","full_name":"nuhptr/next-auth-v5-completed","owner":"nuhptr","description":"✅ Build Next 14 applied next-auth v5 to authentication login, register, verified email, forgot password, and etc","archived":false,"fork":false,"pushed_at":"2024-06-06T15:12:26.000Z","size":585,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-21T08:44:39.338Z","etag":null,"topics":["authentication","nextjs14","shadcn-ui"],"latest_commit_sha":null,"homepage":"","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/nuhptr.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":"2024-03-11T07:20:19.000Z","updated_at":"2024-06-06T15:12:29.000Z","dependencies_parsed_at":"2024-04-03T00:26:02.066Z","dependency_job_id":"3b423536-46f5-4d9b-a1b7-43de5bab970f","html_url":"https://github.com/nuhptr/next-auth-v5-completed","commit_stats":null,"previous_names":["nuhptr/authentication-full-cwa","nuhptr/next-auth-v5-completed"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuhptr%2Fnext-auth-v5-completed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuhptr%2Fnext-auth-v5-completed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuhptr%2Fnext-auth-v5-completed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuhptr%2Fnext-auth-v5-completed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nuhptr","download_url":"https://codeload.github.com/nuhptr/next-auth-v5-completed/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243597838,"owners_count":20316844,"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","nextjs14","shadcn-ui"],"created_at":"2024-11-20T11:18:42.986Z","updated_at":"2025-03-14T15:15:56.332Z","avatar_url":"https://github.com/nuhptr.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Learn Authentication Complete Features\n\nImplementation of authentication with complete features using Next.js, Prisma, and Next-Auth. Auth.js v5 beta is used for authentication. The project includes features such as login, register, forgot password, reset password, change profile data, Github OAuth, Google OAuth, and email verification.\n\n\u003cimg width=\"1440\" alt=\"next-auth\" src=\"https://github.com/nuhptr/authentication-full-cwa/assets/50306963/a08cacc3-4f43-4a18-aafb-381f3f647355\"\u003e\n\n## Features\n\nThis project includes the following features:\n\n-  [x] Login\n-  [x] Register\n-  [x] Forgot Password\n-  [x] Reset Password\n-  [x] Change Profile Data\n-  [x] Github OAuth\n-  [x] Google OAuth\n-  [x] Email Verification\n\n## General Packages\n\nPackages that are used in the project:\n\n-  [bcryptjs](https://www.npmjs.com/package/bcryptjs) - `bun add bcryptjs` - for hashing password\n-  [@types/bcryptjs](https://www.npmjs.com/package/@types/bcryptjs) - `bun add -D @types/bcryptjs` - for typescript\n-  [uuid](https://www.npmjs.com/package/uuid) - `bun add uuid` - for generating unique id\n-  [@types/uuid](https://www.npmjs.com/package/@types/uuid) - `bun add -D @types/uuid` - for typescript\n-  [react-icons](https://react-icons.github.io/react-icons/) - `bun add react-icons` - for icons\n-  [winston](https://www.npmjs.com/package/winston) - `bun add winston` - for logging\n-  [react-spinners](https://www.npmjs.com/package/react-spinners) -` bun add react-spinners` - for loading spinner\n-  [crypto] (https://nodejs.org/api/crypto.html) - // built-in package, no need to install - for generating random token\n\n## Auth Callbacks Links\n\n```bash\ncallbackUrl: http://localhost:3000/api/auth/callback/[provider]\nsigninUrl: http://localhost:3000/api/auth/signin/[provider]\n```\n\n## Google OAuth\n\nHow to set up Google OAuth:\n\n```bash\n-  [Google Console](https://console.developers.google.com/)\n-  open the console, create a project, go to the OAuth consent screen, create app-name, add email, and save\n-  go to credentials, create credentials, OAuth client ID, web application\n-  add http://localhost:3000 to authorized javascript origins\n-  add http://localhost:3000/api/auth/callback/google to authorized redirect URIs\n-  copy client ID and client secret\n```\n\n## ShadcnUI\n\n### Setup\n\nType `npx shadcn-ui@latest init`\n\nWill generate some packages after the installation\n\n-  `clsx`\n-  `class-variance-authority`\n-  `@radix-ui/react-icons`\n-  `tailwind-merge`\n-  `tailwindcss-animate`\n\nThen add some component using: `npx shadcn-ui@latest add [component]`\n\nWhen you add a component, it will add some packages related to the component\n\n```bash\n1. npx shadcn-ui@latest add button\nadded @radix-ui/react-slot\n2. npx shadcn-ui@latest add form\nadded react-hook-form, zod, @hookform/resolvers, @radix-ui/react-label\n3. npx shadcn-ui@latest add dropdown-menu\nadded @radix-ui/react-dropdown-menu\n4. npx shadcn-ui@latest add react-avatar\nadded @radix-ui/react-avatar\n5. npx shadcn-ui@latest add sooner\nadded next-themes \u0026 sooner\n6. npx shadcn-ui@latest add switch\nadded @radix-ui/react-switch\n7. npx shadcn-ui@latest add select\nadded @radix-ui/react-select\n8. npx shadcn-ui@latest add dialog\nadded @radix-ui/react-dialog\n9. npx shadcn-ui@latest add input\n-nothing added\n10. npx shadcn-ui@latest add badge\n-nothing added\n11. npx shadcn-ui@latest add card\n-nothing added\n```\n\n## DB package \u0026 Auth package\n\nInstall prisma\n\n-  [prisma](https://www.prisma.io/) - `bun add -D prisma@latest`,\n-  [@auth/prisma-adapter](https://www.npmjs.com/package/@auth/prisma-adapter) - `bun add @auth/prisma-adapter`\n-  [next-auth](https://authjs.dev/) v5 beta -` bun add next-auth@beta`\n\nThen initialize prisma\n\n-  `npx prisma init`\n\nAutomatically install packages\n\n-  `@prisma/client@latest`\n-  create `db.ts` and call `prisma client` package (\"./lib/db.ts\")\n\nIn .env file, add the following:\n\n```bash\nDATABASE_URL=\"your_db_url\"\nAUTH_SECRET=\"\" // generate secret using **npx auth secret**\n```\n\nCreate `middleware.ts`, `auth.ts`, and `auth.config.ts` (root folder)\nCreate `routes.ts` (root folder) for `auth routes` and `public routes`\nCreate database name in neon postgresql `https://console.neon.tech/app/welcome`\n\nThen add scripts in package.json :\n\n-  `\"postinstall\": \"prisma generate\"`\n-  `\"db:generate\": \"npx prisma generate\"`\n-  `\"db:migrate\": \"npx prisma migrate dev\"`\n-  `\"db:studio\": \"npx prisma studio\"`\n\nIf you want to use the `auth` function in the layout, you can use the following code:\n\n```typescript\n// layout.tsx (root folder)\nimport { auth } from \"@/auth\"\n\nconst session = await auth()\n\nreturn (\n   \u003cSessionProvider session={session}\u003e\n      \u003chtml lang=\"en\"\u003e\n         \u003cbody className={inter.className}\u003e{children}\u003c/body\u003e\n      \u003c/html\u003e\n   \u003c/SessionProvider\u003e\n)\n```\n\n## Resend Package Email\n\nCreate a new account in Resend using email\n\nOpen official documentations and choose `Next` quick start\nLink: [Resend](https://resend.io/)\n\nInstall `Resend package` in the project\n`bun add resend`\n\nCreate `mail.ts` in `lib` folder and add the following code\n\n```typescript\nimport { Resend } from \"resend\"\n\nconst resend = new Resend(process.env.RESEND_API_KEY)\nconst domain = process.env.RESEND_DOMAIN\n\n// other code\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnuhptr%2Fnext-auth-v5-completed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnuhptr%2Fnext-auth-v5-completed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnuhptr%2Fnext-auth-v5-completed/lists"}