{"id":15688321,"url":"https://github.com/dimkl/clerk-koa","last_synced_at":"2026-03-10T17:07:04.621Z","repository":{"id":227351568,"uuid":"771161354","full_name":"dimkl/clerk-koa","owner":"dimkl","description":"Clerk server SDK for usage with Koa","archived":false,"fork":false,"pushed_at":"2024-09-03T12:34:41.000Z","size":232,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-11T21:06:34.130Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/dimkl.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"docs/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-12T19:52:05.000Z","updated_at":"2024-09-03T12:34:44.000Z","dependencies_parsed_at":"2024-03-12T21:51:04.425Z","dependency_job_id":"f85098a9-6200-4510-9b5f-03c309f93b58","html_url":"https://github.com/dimkl/clerk-koa","commit_stats":null,"previous_names":["dimkl/clerk-koa"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/dimkl/clerk-koa","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimkl%2Fclerk-koa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimkl%2Fclerk-koa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimkl%2Fclerk-koa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimkl%2Fclerk-koa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dimkl","download_url":"https://codeload.github.com/dimkl/clerk-koa/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimkl%2Fclerk-koa/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264614394,"owners_count":23637576,"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":[],"created_at":"2024-10-03T17:57:53.330Z","updated_at":"2026-03-10T17:06:59.591Z","avatar_url":"https://github.com/dimkl.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://clerk.com?utm_source=github\u0026utm_medium=koa\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\n    \u003cpicture\u003e\n      \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://images.clerk.com/static/logo-dark-mode-400x400.png\"\u003e\n      \u003cimg src=\"https://images.clerk.com/static/logo-light-mode-400x400.png\" height=\"64\"\u003e\n    \u003c/picture\u003e\n  \u003c/a\u003e\n  \u003cbr /\u003e\n\u003c/p\u003e\n\n# @dimkl/clerk-koa\n\n\u003cdiv align=\"center\"\u003e\n\n[![Chat on Discord](https://img.shields.io/discord/856971667393609759.svg?logo=discord)](https://clerk.com/discord)\n[![Clerk documentation](https://img.shields.io/badge/documentation-clerk-green.svg)](https://clerk.com/docs?utm_source=github\u0026utm_medium=koa)\n[![Follow on Twitter](https://img.shields.io/twitter/follow/ClerkDev?style=social)](https://twitter.com/intent/follow?screen_name=ClerkDev)\n\n[Changelog](https://github.com/dimkl/clerk-koa/blob/main/CHANGELOG.md)\n·\n[Ask a Question](https://github.com/dimkl/clerk-koa/discussions)\n\n\u003c/div\u003e\n\n---\n\n## Overview\n\n[Clerk](https://clerk.com?utm_source=github\u0026utm_medium=koa) is the easiest way to add authentication and user management to your Node.js application. To gain a better understanding of the Clerk Backend API, refer to the \u003ca href=\"https://clerk.com/docs/reference/backend-api\" target=\"_blank\"\u003eBackend API\u003c/a\u003e documentation.\n\n## Getting started\n\n### Prerequisites\n\n- Node.js `\u003e=18.17.0` or later\n- Koa installed (follow their [Getting started](https://koajs.com/) guide)\n\n## Installation\n\n```sh\nnpm install @dimkl/clerk-koa\n```\n\nTo build the package locally with the TypeScript compiler, run:\n\n```sh\nnpm run build\n```\n\n## Usage\n\nRetrieve your Backend API key from the [API Keys](https://dashboard.clerk.com/last-active?path=api-keys) screen in your Clerk dashboard and set it as an environment variable in a `.env` file:\n\n```sh\nCLERK_PUBLISHABLE_KEY=pk_*******\nCLERK_SECRET_KEY=sk_******\n```\n\nYou will then be able to access all the available methods.\n\n```js\nimport 'dotenv/config'; // To read CLERK_SECRET_KEY\nimport { clerkClient } from '@dimkl/clerk-koa';\n\nconst { data: userList } = await clerkClient.users.getUserList();\n```\n\nYou will also be able to secure an Koa app.\n\n```js\nimport Koa from \"koa\";\nimport { clerkMiddleware, getAuth } from \"@dimkl/clerk-koa\";\n\nconst app = new Koa();\n\napp.use(clerkMiddleware());\n\napp.use(async (ctx: KoaContext) =\u003e {\n  const auth = getAuth(ctx);\n  ctx.body = `\u003cbody\u003eHello ${auth?.userId}\u003c/body\u003e`;\n  ctx.status = 200;\n});\napp.listen(3000);\n```\n\nYou will also be able to protect a specific endpoint in a Koa app.\n\n```js\nimport Koa from \"koa\";\nimport Router from \"@koa/router\";\nimport { clerkMiddleware, getAuth, requireAuth } from \"@dimkl/clerk-koa\";\n\nconst app = new Koa();\n\napp.use(clerkMiddleware());\n\nrouter.get(\"/\", (ctx) =\u003e {\n  ctx.body = `\u003cbody\u003e Public Homepage ${auth.userId}\u003c/body\u003e`;\n  ctx.status = 200;\n});\n\nrouter.get(\"/protected\", requireAuth, async (ctx: KoaContext) =\u003e {\n  const auth = getAuth(ctx);\n  ctx.body = `\u003cbody\u003eSigned-in user \"${auth.userId}\"\u003c/body\u003e`;\n  ctx.status = 200;\n});\n\napp.use(router.routes()).use(router.allowedMethods());\n\napp.listen(3000);\n```\n\n## Support\n\nYou can get in touch with me in any of the following ways:\n\n- Create a [GitHub Discussion](https://github.com/dimkl/clerk-koa/discussions) and mention `@dimkl`\n\n## Contributing\n\nWe're open to all community contributions!\n\n## Security\n\n`@dimkl/clerk-koa` follows good practices of security, but 100% security cannot be assured.\n\n`@dimkl/clerk-koa` is provided **\"as is\"** without any **warranty**. Use at your own risk.\n\n_For more information and to report security issues, please refer to the [security documentation](https://github.com/dimkl/clerk-koa/blob/main/docs/SECURITY.md)._\n\n## License\n\nThis project is licensed under the **MIT license**.\n\nSee [LICENSE](https://github.com/dimkl/clerk-koa/blob/main/LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimkl%2Fclerk-koa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdimkl%2Fclerk-koa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimkl%2Fclerk-koa/lists"}