{"id":15692304,"url":"https://github.com/ndom91/authjs-prisma-edge-example","last_synced_at":"2025-05-07T13:45:38.846Z","repository":{"id":223769804,"uuid":"761497891","full_name":"ndom91/authjs-prisma-edge-example","owner":"ndom91","description":"Example project for Auth.js with Prisma's Edge runtime support","archived":false,"fork":false,"pushed_at":"2024-04-04T11:51:15.000Z","size":571,"stargazers_count":51,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-31T10:42:27.117Z","etag":null,"topics":["authjs","cloudflare-workers","next-auth","prisma","vercel"],"latest_commit_sha":null,"homepage":"https://authjs-prisma-edge-example.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/ndom91.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},"funding":{"github":["ndom91"]}},"created_at":"2024-02-22T00:03:39.000Z","updated_at":"2025-03-23T08:41:38.000Z","dependencies_parsed_at":"2024-04-03T17:59:43.833Z","dependency_job_id":"0248ea49-33c5-4f43-b00b-e67d24ea1201","html_url":"https://github.com/ndom91/authjs-prisma-edge-example","commit_stats":null,"previous_names":["ndom91/authjs-prisma-edge-example"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndom91%2Fauthjs-prisma-edge-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndom91%2Fauthjs-prisma-edge-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndom91%2Fauthjs-prisma-edge-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndom91%2Fauthjs-prisma-edge-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ndom91","download_url":"https://codeload.github.com/ndom91/authjs-prisma-edge-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252889749,"owners_count":21820239,"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":["authjs","cloudflare-workers","next-auth","prisma","vercel"],"created_at":"2024-10-03T18:31:14.757Z","updated_at":"2025-05-07T13:45:38.829Z","avatar_url":"https://github.com/ndom91.png","language":"TypeScript","funding_links":["https://github.com/sponsors/ndom91"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n   \u003cbr/\u003e\n   \u003ca href=\"https://authjs.dev\" target=\"_blank\"\u003e\u003cimg width=\"150px\" src=\"https://authjs.dev/img/logo/logo-sm.png\" /\u003e\u003c/a\u003e\n   \u003ch3 align=\"center\"\u003eAuth.js + Prisma Edge Example App\u003c/h3\u003e\n   \u003cp align=\"center\"\u003e\n   Open Source. Full Stack. Own Your Data.\n   \u003c/p\u003e\n   \u003cp align=\"center\" style=\"align: center;\"\u003e\n     \u003cimg align=\"center\" alt=\"npm\" src=\"https://img.shields.io/npm/v/next-auth/beta?label=next-auth\u0026style=for-the-badge\u0026color=black\u0026labelColor=black\"\u003e\n     \u003cimg align=\"center\" src=\"https://img.shields.io/bundlephobia/minzip/next-auth/next?label=next-auth\u0026style=for-the-badge\u0026color=black\u0026labelColor=black\" alt=\"Bundle Size\"/\u003e\n     \u003cimg align=\"center\" src=\"https://img.shields.io/badge/npm-TypeScript-blue?style=for-the-badge\u0026color=black\u0026labelColor=black\" alt=\"TypeScript\" /\u003e\n   \u003c/p\u003e\n\u003c/p\u003e\n\n## 🧭 Overview\n\nThis is an example application showing [Auth.js](https://authjs.dev) (`next-auth@5.0.0-beta.15`) and [Prisma](https://prisma.io) (`@prisma/client@5.12.0`) working together in edge runtimes, like Vercel's middleware or Cloudflare Workers.\n\nThis had previously only been possible with significant workarounds and limitations. As of `@prisma/client@5.9.1` Prisma began making changes to their client, for example, to error out at query-time, not instantiation. So you could begin using Prisma with `next-auth` in Edge runtimes, as long as you didn't actually execute any queries on the edge. This implied using the Auth.js setting `session: { strategy: 'jwt' }`, as the `strategy: 'database'` didn't work because we couldn't update the expiry time of a database-based session in the `middleware` handler.\n\nPrisma has now rolled out edge-compatible clients and adapters which communicate via HTTP, making them much more straightforward to run under any JavaScript runtime. You can check out their [edge deployment](https://www.prisma.io/docs/orm/prisma-client/deployment/edge/overview#which-database-drivers-are-edge-compatible) page for a current list of supported adapters and platforms.\n\nAs this example shows, however, using Prisma + Auth.js with an Edge-compatible database provider and adapter like Neon (Vercel Postgres), PlanetScale or Turso is beginning to become much more straightforward!\n\n## 🚀 Getting Started\n\n### 1. Clone the repository and install dependencies\n\n```bash\ngit clone https://github.com/ndom91/authjs-prisma-edge-example.git\ncd authjs-prisma-edge-example\npnpm install\n```\n\n### 2. Configure your local environment\n\nCopy the .env.local.example file in this directory to .env.local (which will be ignored by Git):\n\n```bash\ncp .env.example .env\n```\n\nMake sure to fill out the `AUTH_SECRET` env var as well as your Prisma database connection string(s). Also, don't forget to add environment variables to configure any of the [supported providers](https://authjs.dev/reference/core/providers) for Auth.js login.\n\n### 3. Database\n\nThis example is configured to use a [Neon Postgres](https://neon.tech) database ([Vercel Postgres](https://vercel.com/storage/postgres) also works). Any Prisma Edge compatible database driver should work with a bit of tweaking though, these currently include:\n\n- **PlanetScale** serverless driver with `@prisma/adapter-planetscale`\n- **Neon** serverless driver with `@prisma/adapter-neon`\n- **Turso** with `@prisma/adapter-libsql`\n- **Cloudflare D1** with `@prisma/adapter-d1`\n- **PostgreSQL** with `@prisma/adapter-pg`\n\nSee Prisma's Edge compatible driver [documentation](https://www.prisma.io/docs/orm/prisma-client/deployment/edge/overview) for more details.\n\n### 4. Start the application\n\nTo run your site locally, use:\n\n```bash\npnpm dev\n```\n\n## 📝 License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fndom91%2Fauthjs-prisma-edge-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fndom91%2Fauthjs-prisma-edge-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fndom91%2Fauthjs-prisma-edge-example/lists"}