{"id":15553561,"url":"https://github.com/ikuzweshema/next-auth-example","last_synced_at":"2025-03-22T18:32:54.207Z","repository":{"id":257311305,"uuid":"857882192","full_name":"Ikuzweshema/next-auth-example","owner":"Ikuzweshema","description":"🔐Example of Multi Factor Authentication in next Js with Next-auth","archived":false,"fork":false,"pushed_at":"2024-10-24T19:50:11.000Z","size":852,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-25T16:50:15.450Z","etag":null,"topics":["2factor-authentication","app-router","next-auth","nextjs","oauth","prisma-orm","shadcn-ui","typescript","zod"],"latest_commit_sha":null,"homepage":"https://nextauthappexample.vercel.app/","language":"TypeScript","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/Ikuzweshema.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-09-15T21:05:01.000Z","updated_at":"2024-10-24T20:02:06.000Z","dependencies_parsed_at":"2024-09-15T23:39:46.475Z","dependency_job_id":"299ec651-5b7f-4bcc-ab08-aedaf1ec9cee","html_url":"https://github.com/Ikuzweshema/next-auth-example","commit_stats":null,"previous_names":["ikuzweshema/next-auth-example"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ikuzweshema%2Fnext-auth-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ikuzweshema%2Fnext-auth-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ikuzweshema%2Fnext-auth-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ikuzweshema%2Fnext-auth-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ikuzweshema","download_url":"https://codeload.github.com/Ikuzweshema/next-auth-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221832247,"owners_count":16888202,"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":["2factor-authentication","app-router","next-auth","nextjs","oauth","prisma-orm","shadcn-ui","typescript","zod"],"created_at":"2024-10-02T14:38:06.896Z","updated_at":"2024-10-28T13:31:16.192Z","avatar_url":"https://github.com/Ikuzweshema.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Next.js Authentication Example with NextAuth.js\n\nThis repository provides an example authentication system for Next.js using **NextAuth.js**. It includes user authentication with providers such as Google, GitHub, and credentials-based login, utilizing MongoDB as the database.\n\n## Table of Contents\n\n- [Introduction](#introduction)\n- [Features](#features)\n- [Prerequisites](#prerequisites)\n- [Installation](#installation)\n- [Environment Variables Setup](#environment-variables-setup)\n- [Database Setup](#database-setup)\n- [Running the Project](#running-the-project)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Introduction\n\nThis project demonstrates how to integrate Next.js with **NextAuth.js** for a fully functional authentication system. It supports multiple providers and stores user data in a MongoDB database using **Prisma** as an ORM.\n\n## Features\n\n- Authentication with Google, GitHub, and credentials\n- Session management using **NextAuth.js**\n- MongoDB as a persistent database via **Prisma ORM**\n- Secure environment with `.env` configuration\n\n## Prerequisites\n\nBefore you begin, ensure you have the following installed on your system:\n\n- [Node.js](https://nodejs.org/)\n- [PNPM](https://pnpm.io/) (for package management)\n- [MongoDB](https://www.mongodb.com/) (for database setup)\n- [Prisma CLI](https://www.prisma.io/docs/concepts/components/prisma-cli) (for database schema management)\n\n## Installation\n\nFollow these steps to install and set up the project:\n\n1. **Clone the repository:**\n\n   ```bash\n   git clone https://github.com/Ikuzweshema/next-auth-example.git\n   ```\n\n2. **Navigate to the project directory:**\n\n ```bash\n   cd next-auth-example\n  ````\n\n3. **Install dependencies using PNPM:**\n\n  ```bash\n   pnpm install\n   ```\n\n## Environment Variables Setup\n\nNext, you need to set up the environment variables for the project. Create a `.env` file in the root directory and configure the following variables:\n\n# .env file\n\nNEXTAUTH_SECRET=your-nextauth-secret\n\n# \nGOOGLE_CLIENT_ID=your-google-client-id\n#\nGOOGLE_CLIENT_SECRET=your-google-client-secret\n#\nGITHUB_ID=your-github-id\n#\nGITHUB_SECRET=your-github-secret\n#\nDATABASE_URL=mongodb+srv://username:password@cluster.mongodb.net/dbname\n\n\nEnsure you replace the placeholder values with your actual credentials.\n\n## Database Setup\n\nThe project uses **Prisma** to manage the database schema. To set up the MongoDB database:\n\n1. **Create a MongoDB database** on [MongoDB Atlas](https://www.mongodb.com/cloud/atlas) or any other MongoDB provider.\n\n2. Push the Prisma schema to the database using this command:\n\n  ```bash\n   pnpm prisma db push\n   ```\n\nThis will synchronize your Prisma schema with your MongoDB database.\n\n## Running the Project\n\nOnce you have the environment variables and database set up, you can start the development server:\n\n```bash\npnpm dev\n```\n\nThe application will be running locally  on [http://localhost:3000](http://localhost:3000) .\n\n## Contributing\n\nContributions are welcome! If you would like to contribute to this project, feel free to submit a pull request. Please ensure your contributions follow the project's coding standards.\n\n## License\n\nThis project is licensed under the **MIT License**. See the [LICENSE](LICENSE) file for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fikuzweshema%2Fnext-auth-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fikuzweshema%2Fnext-auth-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fikuzweshema%2Fnext-auth-example/lists"}