{"id":18422241,"url":"https://github.com/zett-8/express-prisma-auth0","last_synced_at":"2026-04-12T17:48:33.632Z","repository":{"id":122344102,"uuid":"427954188","full_name":"zett-8/express-prisma-auth0","owner":"zett-8","description":"Secure API with Express, Prisma and Auth0","archived":false,"fork":false,"pushed_at":"2021-12-10T19:58:26.000Z","size":225,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-13T12:13:15.442Z","etag":null,"topics":["auth0","authentication","express","node","prisma","rest-api"],"latest_commit_sha":null,"homepage":"https://express-prisma-auth0.herokuapp.com/","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/zett-8.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":"2021-11-14T14:42:01.000Z","updated_at":"2021-12-10T19:58:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"e5ee3e34-ed6c-42cf-ad55-939de987f4a9","html_url":"https://github.com/zett-8/express-prisma-auth0","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/zett-8%2Fexpress-prisma-auth0","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zett-8%2Fexpress-prisma-auth0/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zett-8%2Fexpress-prisma-auth0/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zett-8%2Fexpress-prisma-auth0/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zett-8","download_url":"https://codeload.github.com/zett-8/express-prisma-auth0/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248710447,"owners_count":21149191,"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":["auth0","authentication","express","node","prisma","rest-api"],"created_at":"2024-11-06T04:28:39.321Z","updated_at":"2026-04-12T17:48:33.572Z","avatar_url":"https://github.com/zett-8.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Express + Prisma + Auth0\n\n## [💻 Demo](https://express-prisma-auth0.herokuapp.com/)\n\n## Requirements\n\n[Express](https://expressjs.com/)   \n[Prisma](https://www.prisma.io/)  \n[Auth0](https://auth0.com/)  \n\n## Protect endpoints \nTricky part is here\n\n```js\nimport jwt from 'express-jwt'\nimport jwksRsa from 'jwks-rsa'\n\nconst auth0Config = {\n  issuer: process.env.AUTH0_ISSUER,\n  audience: process.env.AUTH0_AUDIENCE,\n  algorithms: ['RS256'],\n}\n\nexport const jwtCheck = jwt({\n  secret: jwksRsa.expressJwtSecret({\n    cache: true,\n    rateLimit: true,\n    jwksRequestsPerMinute: 15,\n    jwksUri: `${auth0Config.issuer}.well-known/jwks.json`,\n  }),\n  ...auth0Config,\n})\n```\n\nThen use it for endpoints where you want to protect.  \nOnly Authenticated users can implement the endpoint with Bearer Token.\n\n```js\nimport { jwtCheck } from './jwtCheck'\n\napp.get('/sample', jwtCheck, (req, res) =\u003e {\n  res.sendStatus(200)\n})\n```\n\nAll required environment variables are the following,\n\n```text\nAUTH0_DOMAIN=*******.us.auth0.com\nAUTH0_CLIENT_ID=*******\nAUTH0_ISSUER=https://*******.us.auth0.com/\nAUTH0_AUDIENCE=https://*******.us.auth0.com/api/v2/\n```\n\nYou can find them on Auth0 dashboard,  \n```text\nDOMAIN: Auth0 dashboard -\u003e Applications -\u003e Settings -\u003e Domain  \nCLIENT_ID: Auth0 dashboard -\u003e Applications -\u003e Settings -\u003e Client ID  \nISSUER: https://\u003cDOMAIN\u003e/  \nAUDIENCE: Auth0 dashboard -\u003e APIs -\u003e API Audience  \n```\n\n*Do not forget to put trailing slash at the end of ISSUER and AUDIENCE.  \nDon't know why but without trailing slash, it didn't work well in my case.\n\n\u003cimg src=\"https://github.com/Zett-8/images/blob/master/express-prisma-auth0/sc_auth0.jpg\" /\u003e\n\n\n\n\n## Prisma commands\n\n### Migrate in Dev environment\n```shell\nprisma migrate dev\n```\n### Create migrations\n```shell\nprisma migrate dev --create-only\n```\n\n### Apply all migration files to prod\n```shell\nprisma migrate deploy\n```\n\n### Seed DB\nadd to package.json\n```json\n{\n  \"prisma\": {\n    \"seed\": \"ts-node ./prisma/seed.ts\"\n  }\n}\n```\n\n```shell\nprisma db seed\n```\n\n### Reset DB\n*This command should be run only on localhost  \n*Delete all data and populate DB with seed data\n```shell\nprisma migrate reset\n```\n\n### Generate prisma client\n*need to run this command after editing schema\n```shell\nprisma generate\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzett-8%2Fexpress-prisma-auth0","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzett-8%2Fexpress-prisma-auth0","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzett-8%2Fexpress-prisma-auth0/lists"}