-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Opinionated zero-runtime-dependency micro-library for AWS DynamoDB. Built on the AWS JS SDK v3 (@aws-sdk/client-dynamodb + @aws-sdk/lib-dynamodb). ESM-only, hand-written .d.ts sidecars, no build step. Tested on Node, Deno, and Bun — usable from TypeScript and CommonJS consumers alike.
v2 documentation lives at the
v2.3-docsgit tag of this wiki repo. v2 source remains available on npm asdynamodb-toolkit@2.3.0.
The pieces are independent. You don't need to adopt the Adapter to use the expression builders, and you don't need the builders to use the batch chunkers. Every layer has a public surface and is consumable on its own:
- Use
buildUpdate/buildConditionto prep aparamsobject, then send it with the raw SDKUpdateCommand— no Adapter in sight. - Hand-build your own
paramsand pass them toapplyBatch/applyTransactionfor chunking,UnprocessedItemsretry, and exponential backoff. - Use the
Adapterfor CRUD + hooks but swap in your own@aws-sdk/lib-dynamodbCommand invocation anywhere you want raw control. - Take the REST handler or leave it — the Adapter works standalone.
Two concrete payoffs: migration (adopt one piece at a time starting from raw-SDK code) and debugging (peel layers back one at a time when something looks off). The boundary between caller code and toolkit machinery stays explicit.
- Getting started
- Concepts — vocabulary + the additive-params-mutation model every builder uses
- Key and field design — how to choose partition / sort keys, when to reach for LSI vs GSI, and which technical fields actually earn their bytes
- Compatibility — TypeScript, CommonJS, and Node / Deno / Bun runtime support
- Migration: v2 to v3
- SDK v2 to v3 cheat sheet
- Adapter — overview
- Adapter: Constructor options
- Adapter: CRUD methods
- Adapter: Mass methods
- Adapter: Batch builders
- Adapter: Hooks
- Adapter: Raw marker
- Adapter: Indirect indices
- Adapter: Transaction auto-upgrade
-
Expressions: Update builder —
buildUpdate, patch + array ops -
Expressions: Filter builder —
buildSearch,buildFilterByExample -
Expressions: Condition builder —
buildCondition -
Expressions: Projection builder —
addProjection
-
Batch and transactions —
applyBatch,applyTransaction,getBatch,getTransaction -
Mass operations —
paginateList,iterateList,read*,write*,delete*,copy*,move* -
Paths —
getPath,setPath,applyPatch,subsetObject,normalizeFields
- REST core — parsers, builders, policy (framework-agnostic)
-
HTTP handler —
node:http(req, res) handler with the standard route pack
Framework-specific bindings ship as separate packages. Each one 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 of them.
-
dynamodb-toolkit-koa— Koa 2.x middleware. GitHub · wiki -
dynamodb-toolkit-express— Express 4.x / 5.x middleware / Router. GitHub · wiki -
dynamodb-toolkit-fetch—(Request) => Promise<Response>for Cloudflare Workers, Deno Deploy, Bun.serve, Hono, and Node's native fetch server. GitHub · wiki -
dynamodb-toolkit-lambda— AWS Lambda handler for API Gateway REST + HTTP, Function URL, and ALB; ships local-debug bridges for running the handler on real HTTP. GitHub · wiki
Pattern-first pages for common DynamoDB problems that feel trivial in SQL but need non-obvious index shapes here. See Recipes for the full grouped index (by problem domain).
-
Recipe: List records of a tier — "all states globally" via a single sparse GSI on the auto-populated
typeField. Simplest cross-partition tier listing. - Recipe: Per-tier sparse GSI markers — one GSI per tier with per-tier marker attributes. Finer control over projection + writes; sharded-marker variant for leaf-tier scale.
- Recipe: List records of a tier within a partition — sparse LSI. Cheaper than a GSI when the listing is always within a known partition.
-
Recipe: Reservation with auto-release — short-lived holds (rental car, meeting room, flash-sale item) that release automatically if the caller goes silent. Composes
versionField(optimistic concurrency) +createdAtField+asOf(scope-freeze) +deleteListByParams(resumable sweep). -
Recipe: Keys-only GSI with runtime projection — declare a GSI with
projection: 'keys-only'+indirect: true; reads Query the GSI for keys, thenBatchGetItemthe base table with the caller's per-callfields. Cheap GSI storage, rich runtime projections. -
Recipe: Cascade subtree operations —
deleteAllUnder/cloneAllUnder[By]/moveAllUnder[By]against compositekeyFieldswithrelationships: {structural: true}. Resumable leaf-first / root-first pagination, constructive-before-destructive moves,MassOpResultpartial-failure surfacing. -
Recipe: Querying subtrees with
buildKey— hierarchical subtree queries viaadapter.buildKey(values, options). Three shapes: children-only (default), self + descendants ({self: true}), narrow-prefix ({partial: 'Dal'}). Plus thegetListUndersugar and composition with mass ops.
- Release notes — what shipped in each version