Skip to content

Commit 317e50f

Browse files
committed
Added info on adapters.
1 parent 71d2df1 commit 317e50f

4 files changed

Lines changed: 34 additions & 1 deletion

File tree

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,17 @@ createServer(handler).listen(3000);
8181

8282
The handler ships a standard route pack — `GET / POST /`, `GET PUT PATCH DELETE /:key`, `GET DELETE /-by-names`, `PUT /-load`, `PUT /-clone`, `PUT /-move`, `PUT /-clone-by-names`, `PUT /-move-by-names`, `PUT /:key/-clone`, `PUT /:key/-move` — with envelope keys, status codes, and prefixes all configurable via `options.policy`.
8383

84+
## Framework adapters
85+
86+
The bundled `dynamodb-toolkit/handler` is a pure `node:http` handler. Framework-specific bindings live in separate packages so the core stays zero-dep — each adapter is a thin wrapper that translates its framework's request/response shape into the toolkit's `rest-core` parsers + standard route pack. The wire contract (routes, query parameters, envelope keys, error mapping) is identical across all four.
87+
88+
| Package | Runtime / framework | Notes |
89+
| --- | --- | --- |
90+
| [`dynamodb-toolkit-koa`](https://www.npmjs.com/package/dynamodb-toolkit-koa) | [Koa](https://koajs.com/) 2.x | Middleware; `koa` as peer dep |
91+
| [`dynamodb-toolkit-express`](https://www.npmjs.com/package/dynamodb-toolkit-express) | [Express](https://expressjs.com/) 4.x / 5.x | Middleware / Router; `express` as peer dep |
92+
| [`dynamodb-toolkit-fetch`](https://www.npmjs.com/package/dynamodb-toolkit-fetch) | Fetch API — `(Request) => Promise<Response>` | Zero-framework; runs on Cloudflare Workers, Deno Deploy, Bun.serve, Hono, Node native fetch server |
93+
| [`dynamodb-toolkit-lambda`](https://www.npmjs.com/package/dynamodb-toolkit-lambda) | AWS Lambda handler | Four event shapes (API Gateway REST / HTTP, Function URL, ALB); ships local-debug bridges for running the handler on real HTTP without `sam local` |
94+
8495
## Sub-exports
8596

8697
The package ships discrete, tree-shakable sub-exports for callers who want only the lower-level surface:

llms-full.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,19 @@ Per `policy.statusCodes`. Default: `ConditionalCheckFailedException` / `Transact
339339

340340
`policy.errorBody` builds the response body. Default returns `{code, message}`.
341341

342+
### 7.4 Framework adapters (separate packages)
343+
344+
The bundled handler in this package is `node:http`-only. Framework-specific bindings ship as separate unscoped npm packages so the core keeps zero runtime dependencies. Each adapter is a thin wrapper (~150–300 LoC) that translates its framework's request/response shape into calls through the same `rest-core` parsers/builders + `matchRoute` used by the bundled handler. The wire contract (routes from §7.1, query parameters from §7.2, error mapping from §7.3, envelope keys from `policy`) is identical across all four.
345+
346+
| Package | Runtime / framework | Peer deps | npm |
347+
| --- | --- | --- | --- |
348+
| `dynamodb-toolkit-koa` | Koa 2.x | `koa` | https://www.npmjs.com/package/dynamodb-toolkit-koa |
349+
| `dynamodb-toolkit-express` | Express 4.x / 5.x | `express` | https://www.npmjs.com/package/dynamodb-toolkit-express |
350+
| `dynamodb-toolkit-fetch` | Fetch API — `(Request) => Promise<Response>`. Runs on Cloudflare Workers, Deno Deploy, Bun.serve, Hono, Node native fetch server | none | https://www.npmjs.com/package/dynamodb-toolkit-fetch |
351+
| `dynamodb-toolkit-lambda` | AWS Lambda — API Gateway REST (v1), API Gateway HTTP (v2), Function URL, ALB. Auto-detects event shape. Ships `createNodeListener` / `createFetchBridge` for local-debug without `sam local` | none | https://www.npmjs.com/package/dynamodb-toolkit-lambda |
352+
353+
Each adapter package ships its own wiki + `llms.txt` / `llms-full.txt` with framework-specific deployment patterns, body-reader behavior, and peer-dep notes.
354+
342355
## 8. Bare files
343356

344357
- `import {sleep} from 'dynamodb-toolkit'` — `sleep(ms): Promise<void>`

llms.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,15 @@ createServer(handler).listen(3000);
160160

161161
`ConditionalCheckFailedException` → 409, `ValidationException` → 422, throughput / limits → 429, 5xx SDK → 503, anything else → 500. Override via `policy.statusCodes` and `policy.errorBody`.
162162

163+
## Framework adapters
164+
165+
The bundled `dynamodb-toolkit/handler` is `node:http`-only. Framework-specific bindings ship as separate packages (zero runtime deps in the core; frameworks are peer deps of each adapter). All four adapters share the same wire contract (routes, query parameters, envelope, error mapping) as the bundled handler.
166+
167+
- `dynamodb-toolkit-koa` — Koa 2.x middleware. https://www.npmjs.com/package/dynamodb-toolkit-koa
168+
- `dynamodb-toolkit-express` — Express 4.x / 5.x middleware / Router. https://www.npmjs.com/package/dynamodb-toolkit-express
169+
- `dynamodb-toolkit-fetch` — `(Request) => Promise<Response>` for Cloudflare Workers, Deno Deploy, Bun.serve, Hono, and Node's native fetch server. https://www.npmjs.com/package/dynamodb-toolkit-fetch
170+
- `dynamodb-toolkit-lambda` — AWS Lambda handler for API Gateway REST + HTTP, Function URL, and ALB. Ships local-debug bridges (`createNodeListener` / `createFetchBridge`) for running the handler on real HTTP without `sam local`. https://www.npmjs.com/package/dynamodb-toolkit-lambda
171+
163172
## Patching
164173

165174
```js

wiki

Submodule wiki updated from b8168e4 to 3eb1394

0 commit comments

Comments
 (0)