{"id":50490757,"url":"https://github.com/uhop/dynamodb-toolkit-koa","last_synced_at":"2026-06-02T02:31:00.496Z","repository":{"id":352503655,"uuid":"1214784084","full_name":"uhop/dynamodb-toolkit-koa","owner":"uhop","description":"Koa adapter for dynamodb-toolkit — mounts the standard REST route pack as Koa middleware.","archived":false,"fork":false,"pushed_at":"2026-04-19T22:20:02.000Z","size":49,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-04-19T23:30:13.499Z","etag":null,"topics":["adapter","aws","aws-sdk","aws-sdk-v3","bun","crud","deno","dynamodb","dynamodb-toolkit","esm","hooks","http","koa","koa-middleware","middleware","pagination","rest","toolkit","typescript","zero-dependencies"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uhop.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-04-19T03:30:09.000Z","updated_at":"2026-04-19T22:50:36.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/uhop/dynamodb-toolkit-koa","commit_stats":null,"previous_names":["uhop/dynamodb-toolkit-koa"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/uhop/dynamodb-toolkit-koa","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uhop%2Fdynamodb-toolkit-koa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uhop%2Fdynamodb-toolkit-koa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uhop%2Fdynamodb-toolkit-koa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uhop%2Fdynamodb-toolkit-koa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uhop","download_url":"https://codeload.github.com/uhop/dynamodb-toolkit-koa/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uhop%2Fdynamodb-toolkit-koa/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33803734,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-02T02:00:07.132Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["adapter","aws","aws-sdk","aws-sdk-v3","bun","crud","deno","dynamodb","dynamodb-toolkit","esm","hooks","http","koa","koa-middleware","middleware","pagination","rest","toolkit","typescript","zero-dependencies"],"created_at":"2026-06-02T02:30:59.541Z","updated_at":"2026-06-02T02:31:00.492Z","avatar_url":"https://github.com/uhop.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dynamodb-toolkit-koa [![NPM version][npm-img]][npm-url]\n\n[npm-img]: https://img.shields.io/npm/v/dynamodb-toolkit-koa.svg\n[npm-url]: https://npmjs.org/package/dynamodb-toolkit-koa\n\nKoa adapter for [`dynamodb-toolkit`](https://github.com/uhop/dynamodb-toolkit) v3. Mounts the toolkit's standard REST route pack as a Koa middleware — same wire contract as `dynamodb-toolkit/handler` (the bundled `node:http` adapter), translated for Koa's `(ctx, next)` shape.\n\nZero runtime dependencies; `koa` and `dynamodb-toolkit` are peer dependencies.\n\n## Install\n\n```sh\nnpm install dynamodb-toolkit-koa dynamodb-toolkit koa @aws-sdk/client-dynamodb @aws-sdk/lib-dynamodb\n```\n\n## Quick start\n\n```js\nimport Koa from 'koa';\nimport mount from 'koa-mount';\nimport {DynamoDBClient} from '@aws-sdk/client-dynamodb';\nimport {DynamoDBDocumentClient} from '@aws-sdk/lib-dynamodb';\nimport {Adapter} from 'dynamodb-toolkit';\nimport {createKoaAdapter} from 'dynamodb-toolkit-koa';\n\nconst client = DynamoDBDocumentClient.from(new DynamoDBClient({region: 'us-east-1'}));\n\nconst adapter = new Adapter({\n  client,\n  table: 'planets',\n  keyFields: ['name']\n});\n\nconst app = new Koa();\napp.use(mount('/planets', createKoaAdapter(adapter)));\napp.listen(3000);\n```\n\n`koa-mount` (or any upstream that strips the collection prefix from `ctx.path`) is the idiomatic way to mount the adapter at a sub-path. Unrecognized routes hand back to `next()`, so the adapter composes cleanly with the rest of your Koa stack.\n\n## Options\n\n| Option               | Default                                      | Purpose                                                                                   |\n| -------------------- | -------------------------------------------- | ----------------------------------------------------------------------------------------- |\n| `policy`             | `defaultPolicy`                              | Partial overrides for prefixes, envelope keys, status codes.                              |\n| `sortableIndices`    | `{}`                                         | Map sort-field name → GSI name for `?sort=` / `?sort=-field`.                             |\n| `keyFromPath`        | `(raw, a) =\u003e ({[a.keyFields[0].name]: raw})` | Convert `:key` path segment to a key object (composite keys).                             |\n| `exampleFromContext` | `() =\u003e ({})`                                 | Derive `prepareListInput` `example` from `{query, body, adapter, framework: 'koa', ctx}`. |\n| `maxBodyBytes`       | `1048576` (1 MiB)                            | Cap for stream-parsed bodies, measured in bytes (ignored when a body-parser ran).         |\n\nConsumers using `koa-bodyparser` (or `@koa/bodyparser`) can rely on their pre-parsed `ctx.request.body`; the adapter uses it when set, falls back to streaming the raw request otherwise.\n\n## Routes\n\nRooted at the mount point:\n\n| Method | Path               | Adapter method                |\n| ------ | ------------------ | ----------------------------- |\n| GET    | `/`                | `getList` (envelope + links)  |\n| POST   | `/`                | `post`                        |\n| DELETE | `/`                | `deleteListByParams`          |\n| GET    | `/-by-names`       | `getByKeys`                   |\n| DELETE | `/-by-names`       | `deleteByKeys`                |\n| PUT    | `/-load`           | `putItems`                    |\n| PUT    | `/-clone`          | `cloneListByParams` (overlay) |\n| PUT    | `/-move`           | `moveListByParams` (overlay)  |\n| PUT    | `/-clone-by-names` | `cloneByKeys` (overlay)       |\n| PUT    | `/-move-by-names`  | `moveByKeys` (overlay)        |\n| GET    | `/:key`            | `getByKey`                    |\n| PUT    | `/:key`            | `put` (URL key merged in)     |\n| PATCH  | `/:key`            | `patch` (meta keys → options) |\n| DELETE | `/:key`            | `delete`                      |\n| PUT    | `/:key/-clone`     | `clone`                       |\n| PUT    | `/:key/-move`      | `move`                        |\n\nWire contract — query syntax, envelope shape, meta-key prefixes, status codes — matches the bundled [HTTP handler](https://github.com/uhop/dynamodb-toolkit/wiki/HTTP-handler). Everything is configurable through `options.policy`.\n\n## Compatibility\n\n- **Koa 2** and **Koa 3** (peer range `^2.15.0 || ^3.0.0`).\n- **Node 20+**, **Bun**, **Deno** — the adapter's tests run cleanly under all three.\n\n## License\n\n[BSD-3-Clause](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuhop%2Fdynamodb-toolkit-koa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuhop%2Fdynamodb-toolkit-koa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuhop%2Fdynamodb-toolkit-koa/lists"}