{"id":22688221,"url":"https://github.com/emanuelefavero/next-auth-prisma-db","last_synced_at":"2025-04-12T05:30:34.304Z","repository":{"id":69318080,"uuid":"597642137","full_name":"emanuelefavero/next-auth-prisma-db","owner":"emanuelefavero","description":"A starter Next.js Typescript project using NextAuth.js and Prisma","archived":false,"fork":false,"pushed_at":"2023-09-29T19:20:40.000Z","size":82,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-26T00:51:21.438Z","etag":null,"topics":["authentication","database","db","nextauth","nextjs","prisma"],"latest_commit_sha":null,"homepage":"https://next-auth-prisma-db.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/emanuelefavero.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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-02-05T06:57:20.000Z","updated_at":"2024-11-25T09:15:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"83c48c50-a40e-416a-89a4-17a29bc5d524","html_url":"https://github.com/emanuelefavero/next-auth-prisma-db","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emanuelefavero%2Fnext-auth-prisma-db","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emanuelefavero%2Fnext-auth-prisma-db/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emanuelefavero%2Fnext-auth-prisma-db/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emanuelefavero%2Fnext-auth-prisma-db/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emanuelefavero","download_url":"https://codeload.github.com/emanuelefavero/next-auth-prisma-db/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248523382,"owners_count":21118493,"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","database","db","nextauth","nextjs","prisma"],"created_at":"2024-12-10T00:13:32.822Z","updated_at":"2025-04-12T05:30:34.245Z","avatar_url":"https://github.com/emanuelefavero.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NextAuth.js Prisma Database\n\nThis is a starter project using [NextAuth.js](https://next-auth.js.org/) as an authentication provider and [Prisma](https://www.prisma.io/) as a database ORM for PostgreSQL.\n\n\u003e It allows to store user credentials automatically in a database during the authentication process\n\n## IMPORTANT\n\nWhen you are deploying your application to production, remember to set `Homepage URL` and `Authorization callback URL` in your GitHub OAuth App settings in Developer Settings on GitHub.\n\n\u003e Do the same for other providers\n\n#### Example\n\n- Homepage URL: `https://yourdomain.com`\n- Authorization callback URL: `https://yourdomain.com/api/auth/callback/github`\n\n#### Screenshot\n\n\u003cimg src=\"screenshot.png\" alt=\"screenshot\" width=\"150\"\u003e\n\n## Getting Started\n\n- clone this repo and `cd` into it\n- run `npm install`\n- Add `.env` file to the root of the project with the following content:\n\n```bash\n# * Prisma\n# You can create a PostgreSQL database easly on Supabase\nDATABASE_URL=\"postgresql://YOUR_SUPABASE_URL/postgres\"\n\n\u003e Note: After 2023 Supabase migration, we need to copy/paste a new DATABASE_URL from Supabase. This will probably not work\n\n\n# * NextAuth.js\n# You will find these values in your GitHub OAuth App settings in Developer Settings on GitHub (Client ID and client secret), you will need to create a new OAuth App (remember to set Homepage URL and Authorization callback URL to production URL during production)\nGITHUB_ID=YOUR_GITHUB_ID\nGITHUB_SECRET=YOUR GITHUB SECRET\n\n# ! Your NEXTAUTH_SECRET secret should be at least 32 characters long, not parakeet :)\nNEXTAUTH_SECRET=parakeet\n# ! Your NEXTAUTH_URL should be the URL of your site, change it in production\nNEXTAUTH_URL=http://localhost:3000\n```\n\n\u003e Note: If you are deploying to Vercel, the `NEXTAUTH_URL` env variable is not necessary\n\n### Running the app\n\n```bash\nnpm run dev\n```\n\n- Open [http://localhost:3000](http://localhost:3000) with your browser to see the result\n\n\u003e Note: NextAuth.js has many providers, you can find them [here](https://next-auth.js.org/configuration/providers)\n\n## Add Prisma to an existing NextAuth.js project\n\n- follow the instructions to [setup Prisma with NextAuth.js](https://next-auth.js.org/adapters/prisma)\n\n### Prisma Configuration for this project\n\n- run `npx prisma migrate dev` every time you change the schema\n- run `npx prisma studio` to if you want to see the database in a GUI\n\n### Prisma Configuration for new projects\n\n- run `npm install prisma --save-dev`\n- run `npm install next-auth @prisma/client @next-auth/prisma-adapter`\n\n- run `npx prisma init` to initialize the Prisma project\n\n\u003e Note: I've created a new database with [Supabase](https://supabase.com/) which is a firebase-like database service that uses PostgreSQL\n\u003e\n\u003e - Create a new database with [Supabase](https://supabase.com/)\n\u003e\n\u003e - Go to `Project Settings` / `Database` / `Connection string` / `URI` and copy the `URI` string\n\n- Paste the `URI` string in the `.env` file (DATABASE_URL)\n\n- run `npx db pull` if you already have data in your database and you want to generate the Prisma schema\n\n- add your schema in `schema.prisma`\n\n- run `npx prisma migrate dev --name init` to create the database schema (run `npx prisma migrate dev` every time you change the schema)\n\n- run `npx prisma generate` to generate the Prisma Client (run this command every time you change the schema)\n\n- run `npx prisma studio` to if you want to see the database in a GUI\n\n## NextAuth.js Providers\n\n- [Email](https://next-auth.js.org/configuration/providers/email)\n- [Credentials](https://next-auth.js.org/configuration/providers/credentials)\n- [GitHub](https://next-auth.js.org/providers/github)\n- [Google](https://next-auth.js.org/providers/google)\n- [Apple](https://next-auth.js.org/providers/apple)\n- [Facebook](https://next-auth.js.org/providers/facebook)\n- [Discord](https://next-auth.js.org/providers/discord)\n- [LinkedIn](https://next-auth.js.org/providers/linkedin)\n- [More...](https://next-auth.js.org/configuration/providers/oauth#built-in-providers)\n\n## Learn More\n\n- [How to set up Providers](https://next-auth.js.org/configuration/providers/oauth#built-in-providers)\n- [NextAuth.js Getting Starter](https://next-auth.js.org/getting-started/example)\n- [NextAuth.js Prisma Setup](https://next-auth.js.org/adapters/prisma)\n- [Prisma](https://www.prisma.io/)\n\n## License\n\n- [MIT](LICENSE.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femanuelefavero%2Fnext-auth-prisma-db","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femanuelefavero%2Fnext-auth-prisma-db","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femanuelefavero%2Fnext-auth-prisma-db/lists"}