{"id":50490750,"url":"https://github.com/uhop/dynamodb-toolkit-fetch","last_synced_at":"2026-06-02T02:30:59.307Z","repository":{"id":352523594,"uuid":"1215455954","full_name":"uhop/dynamodb-toolkit-fetch","owner":"uhop","description":"Fetch adapter for dynamodb-toolkit — serves the standard REST route pack as a (Request) → Promise\u003cResponse\u003e handler. Runs on Cloudflare Workers, Deno Deploy, Bun.serve, Hono, itty-router, and Node's native fetch server.","archived":false,"fork":false,"pushed_at":"2026-04-20T00:35:50.000Z","size":42,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-04-20T02:38:49.314Z","etag":null,"topics":["adapter","aws","aws-sdk-v3","bun","cloudflare-workers","crud","deno","deno-deploy","dynamodb","dynamodb-toolkit","edge","esm","fetch","hono","itty-router","pagination","rest","serverless","toolkit","typescript"],"latest_commit_sha":null,"homepage":"https://github.com/uhop/dynamodb-toolkit-fetch#readme","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-19T23:42:26.000Z","updated_at":"2026-04-20T00:35:54.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/uhop/dynamodb-toolkit-fetch","commit_stats":null,"previous_names":["uhop/dynamodb-toolkit-fetch"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/uhop/dynamodb-toolkit-fetch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uhop%2Fdynamodb-toolkit-fetch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uhop%2Fdynamodb-toolkit-fetch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uhop%2Fdynamodb-toolkit-fetch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uhop%2Fdynamodb-toolkit-fetch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uhop","download_url":"https://codeload.github.com/uhop/dynamodb-toolkit-fetch/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uhop%2Fdynamodb-toolkit-fetch/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-v3","bun","cloudflare-workers","crud","deno","deno-deploy","dynamodb","dynamodb-toolkit","edge","esm","fetch","hono","itty-router","pagination","rest","serverless","toolkit","typescript"],"created_at":"2026-06-02T02:30:58.546Z","updated_at":"2026-06-02T02:30:59.300Z","avatar_url":"https://github.com/uhop.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dynamodb-toolkit-fetch [![NPM version][npm-img]][npm-url]\n\n[npm-img]: https://img.shields.io/npm/v/dynamodb-toolkit-fetch.svg\n[npm-url]: https://npmjs.org/package/dynamodb-toolkit-fetch\n\nFetch adapter for [`dynamodb-toolkit`](https://github.com/uhop/dynamodb-toolkit) v3. Serves the toolkit's standard REST route pack as a `(request: Request) =\u003e Promise\u003cResponse\u003e` handler — same wire contract as `dynamodb-toolkit/handler` (the bundled `node:http` adapter), [`dynamodb-toolkit-koa`](https://github.com/uhop/dynamodb-toolkit-koa), and [`dynamodb-toolkit-express`](https://github.com/uhop/dynamodb-toolkit-express), translated for the Web Fetch handler shape.\n\nZero runtime dependencies. No framework peer dep — `Request` / `Response` / `URL` are platform primitives.\n\nRuns on **Cloudflare Workers**, **Deno Deploy**, **Bun.serve**, **Hono**, **itty-router**, and Node 20+ servers that speak Fetch.\n\n## Install\n\n```sh\nnpm install dynamodb-toolkit-fetch dynamodb-toolkit @aws-sdk/client-dynamodb @aws-sdk/lib-dynamodb\n```\n\n## Quick start\n\n### Cloudflare Workers\n\n```js\nimport {DynamoDBClient} from '@aws-sdk/client-dynamodb';\nimport {DynamoDBDocumentClient} from '@aws-sdk/lib-dynamodb';\nimport {Adapter} from 'dynamodb-toolkit';\nimport {createFetchAdapter} from 'dynamodb-toolkit-fetch';\n\nconst client = DynamoDBDocumentClient.from(new DynamoDBClient({region: 'us-east-1'}));\nconst planets = new Adapter({client, table: 'planets', keyFields: ['name']});\n\nconst handler = createFetchAdapter(planets, {mountPath: '/planets'});\n\nexport default {\n  fetch: request =\u003e handler(request)\n};\n```\n\n### Bun.serve / Deno.serve\n\n```js\nimport {createFetchAdapter} from 'dynamodb-toolkit-fetch';\n\nconst handler = createFetchAdapter(planets, {mountPath: '/planets'});\n\n// Bun\nBun.serve({port: 3000, fetch: handler});\n\n// Deno\nDeno.serve(handler);\n```\n\n### Hono / itty-router composition\n\n`onMiss: () =\u003e null` lets the adapter yield control back to a parent router when the path isn't one of its own — the handler resolves to `null` and the router tries the next matcher.\n\n```js\nimport {Hono} from 'hono';\nimport {createFetchAdapter} from 'dynamodb-toolkit-fetch';\n\nconst planetsHandler = createFetchAdapter(planets, {\n  mountPath: '/planets',\n  onMiss: () =\u003e null\n});\n\nconst app = new Hono();\napp.all('/planets/*', async c =\u003e (await planetsHandler(c.req.raw)) ?? c.notFound());\n```\n\nThe adapter is terminal by default — if you omit `onMiss`, unknown routes become a plain `404 Response` so `Bun.serve`, `Deno.serve`, and `export default {fetch}` can return the handler directly with no wrapping.\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: 'fetch', request}`. |\n| `maxBodyBytes`       | `1048576` (1 MiB)                            | Cap for request bodies. Enforced via `Content-Length` + byte counter.                           |\n| `mountPath`          | `''`                                         | Path prefix to strip before route matching (e.g. `/planets`).                                   |\n| `onMiss`             | —                                            | Hook for unknown routes; return `null` to yield to a parent router.                             |\n\nBody size is enforced two ways: if the request declares a `Content-Length` above `maxBodyBytes`, the adapter rejects `413 PayloadTooLarge` before reading any bytes; otherwise it streams via `request.body.getReader()` with a running byte counter and rejects mid-stream if the cap is crossed — so chunked-encoded uploads can't smuggle past the header check.\n\n## Routes\n\nRooted at `mountPath` (or at `/` when no mount is configured):\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- Any runtime with the standard Fetch API: **Cloudflare Workers**, **Deno Deploy**, **Bun.serve**, **Hono**, **itty-router**, **Node 20+**.\n- No framework peer dep.\n- `peerDependencies`: `dynamodb-toolkit ^3.1.1` only.\n\n## License\n\n[BSD-3-Clause](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuhop%2Fdynamodb-toolkit-fetch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuhop%2Fdynamodb-toolkit-fetch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuhop%2Fdynamodb-toolkit-fetch/lists"}