{"id":44657992,"url":"https://github.com/tudddorrr/clay","last_synced_at":"2026-02-14T22:25:37.810Z","repository":{"id":41175941,"uuid":"326088780","full_name":"tudddorrr/clay","owner":"tudddorrr","description":"An ultra convenient minimal framework for building Koa apps","archived":false,"fork":false,"pushed_at":"2025-10-05T21:41:56.000Z","size":328,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-17T07:07:33.961Z","etag":null,"topics":["api","http","koa","middleware","permissions","rest","rest-api","router","services","validation"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/koa-clay","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/tudddorrr.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null}},"created_at":"2021-01-02T01:44:59.000Z","updated_at":"2025-10-05T21:41:39.000Z","dependencies_parsed_at":"2025-08-23T14:16:02.121Z","dependency_job_id":"04201d64-c748-47f1-a032-3c16d39ea128","html_url":"https://github.com/tudddorrr/clay","commit_stats":null,"previous_names":["tudddorrr/koa-rest-services","sekaru/koa-rest-services"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/tudddorrr/clay","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tudddorrr%2Fclay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tudddorrr%2Fclay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tudddorrr%2Fclay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tudddorrr%2Fclay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tudddorrr","download_url":"https://codeload.github.com/tudddorrr/clay/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tudddorrr%2Fclay/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29458457,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T21:29:27.764Z","status":"ssl_error","status_checked_at":"2026-02-14T21:28:11.111Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["api","http","koa","middleware","permissions","rest","rest-api","router","services","validation"],"created_at":"2026-02-14T22:25:37.186Z","updated_at":"2026-02-14T22:25:37.806Z","avatar_url":"https://github.com/tudddorrr.png","language":"TypeScript","readme":"Clay is an ultra convenient minimal framework for building Koa apps.\n\n## Features\n* Expose API routes with minimal config\n* Validate requests against conditions or an entity's required values\n* Secure your endpoints with permission preflight checks\n* Automatic documentation\n\n## Examples\nDocs: [docs](https://github.com/tudddorrr/clay/tree/main/docs)\n\nTests: [tests](https://github.com/tudddorrr/clay/tree/main/tests)\n\n## Installation\n```\nnpm i koa-clay --save\n```\n\n## Lightweight route configuration\n\n```typescript\n// app.ts\n\nconst app = new Koa()\n\napp.use(service('/users', new UserService()))\n\napp.listen(3000, () =\u003e console.log('Listening...'))\n```\n\nClients will now have access to handler functions you implement in your service:\n\n```typescript\n// AlbumService.ts\nclass AlbumService extends Service {\n  // e.g. http://example.me/albums/1/personnel/3\n  @Route({\n    method: 'GET',\n    path: '/:id/personnel/:personnelId'\n  })\n  async getPersonnel(req: Request) {\n    ...\n  }\n\n  // i.e. http://example.me/albums\n  @Route({\n    method: 'GET'\n  })\n  async getAll(req: Request) {\n    ...\n  }\n}\n```\n\nWhen a request is made, the specified handler function will be invoked.\n\n## Permissions and validation\n\nSecure your endpoints using the [@HasPermission decorator](https://github.com/tudddorrr/clay/tree/main/docs/permissions.md), which will run a function to determine if the route can be accessed:\n\n```typescript\nclass SecretsPolicy extends Policy {\n  async get(req: Request): Promise\u003cPolicyResponse\u003e {\n    return req.ctx.user.hasScope('get')\n  }\n}\n\nclass SecretService extends Service {\n  @HasPermission(SecretsPolicy, 'get')\n  async get(req: Request): Promise\u003cResponse\u003e { ... }\n}\n```\n\nValidate incoming request data (body, query and headers) using the [@Validate decorator](https://github.com/tudddorrr/clay/tree/main/docs/validation.md):\n\n```typescript\n@Validate({\n  body: ['username', 'age'], // these keys are required\n})\nasync post(req: Request): Promise\u003cResponse\u003e { ... }\n```\n\nYou can also validate requests against an entity's required properties. Additionally, you can make keys required based on the request method:\n\n```typescript\nclass User {\n  @Required() // required in POST and PUT requests\n  username: string\n\n  @Required({ methods: ['PUT'] }) // required in PUT requests\n  age: number\n}\n\n@Validate({\n  body: [User]\n})\nasync post(req: Request): Promise\u003cResponse\u003e { ... }\n```\n\n## Automatic documentation\n\nServices, routes and parameters are [automatically documented](https://github.com/tudddorrr/clay/tree/main/docs/documenter.md). Descriptions can be added for routes and parameters for extra clarity.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftudddorrr%2Fclay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftudddorrr%2Fclay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftudddorrr%2Fclay/lists"}