Registry / database / effect-dynamodb

effect-dynamodb

JSON →
library1.8.2jsnpmunverified

Schema-driven DynamoDB ORM for Effect TS that implements single-table design as a first-class pattern. Current stable version is 1.8.2. It provides type-safe entity modeling, composite key composition, Stream-based pagination, Layer-based dependency injection, and transaction support. Unlike other DynamoDB ORMs, it is designed specifically for Effect TS ecosystem, leveraging Effect's Schema for validation and Effect's Stream for pagination. The library is actively maintained with regular releases.

npm install effect-dynamodb
INSTALL
IMPORT
SIG · EFFECT-DYNAMODB
E
effect-dynamodb
databasejavascriptv1.8.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

DynamoClient
import { DynamoClient } from "effect-dynamodb"
const DynamoClient = require("effect-dynamodb").DynamoClient
ESM-only since v1; CommonJS require may work in some bundlers but not recommended.
Entity
import { Entity } from "effect-dynamodb"
import Entity from "effect-dynamodb"
Entity is a named export, not default.
DynamoSchema
import { DynamoSchema } from "effect-dynamodb"
import { DynamoSchema as Schema } from "effect-dynamodb"
Do not confuse with Effect's Schema; DynamoSchema is a different concept.

Creates a single-table DynamoDB setup with a Task entity, defines composite keys and a GSI, then performs a put and a filtered query using the client.

import { Effect, Schema } from "effect" import { DynamoSchema, Entity, Table, DynamoClient } from "effect-dynamodb" class Task extends Schema.Class<Task>("Task")({ taskId: Schema.String, projectId: Schema.String, title: Schema.NonEmptyString, status: Schema.Literals(["todo", "active", "done"]), }) {} const AppSchema = DynamoSchema.make({ name: "myapp", version: 1 }) const Tasks = Entity.make({ model: Task, entityType: "Task", primaryKey: { pk: { field: "pk", composite: ["taskId"] }, sk: { field: "sk", composite: [] }, }, indexes: { byProject: { name: "gsi1", pk: { field: "gsi1pk", composite: ["projectId"] }, sk: { field: "gsi1sk", composite: ["status", "taskId"] }, }, }, }) const MainTable = Table.make({ schema: AppSchema, entities: { Tasks } }) const program = Effect.gen(function* () { const db = yield* DynamoClient.make({ entities: { Tasks }, tables: { MainTable } }) yield* db.entities.Tasks.put({ taskId: "t-1", projectId: "p-1", title: "Ship v1", status: "active", }) const active = yield* db.entities.Tasks .byProject({ projectId: "p-1" }) .filter((t, { eq }) => eq(t.status, "active")) .collect() })
Debug
Known issues
breakingEffect peer dependency requires >=4.0.0-beta.74. Using older effect versions will cause type errors or runtime failures.
fix
Upgrade effect to ^4.0.0-beta.74 or later.
affects: >=1.0.0
deprecatedDynamoSchema.make with version 1 is stable but schema versioning may change in future releases.
fix
Use DynamoSchema.make({ name, version }) as documented.
affects: >=1.0.0
gotchaComposite key order matters: field values are concatenated in the order defined in the composite array.
fix
Ensure composite array order matches the desired sort order in DynamoDB.
affects: >=1.0.0
gotchaClient methods return Effect effects; forgetting to run them with Effect.runPromise or yield* will result in no operation.
fix
Always execute effects using Effect.runPromise, Effect.runSync, or yield* inside an Effect.gen.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'effect-dynamodb' or its corresponding type declarations.
Package not installed or types not resolved.
fix
npm install effect-dynamodb
Type 'Schema<...>' is missing the following properties from type '...'
Mismatch between schema class definition and Entity.model expectations.
fix
Ensure the class extends Schema.Class and uses correct field definitions (e.g., Schema.String, Schema.Number).
Error: DynamoClient.make requires tables and entities to be provided.
Missing required configuration argument.
fix
Pass { entities: { ... }, tables: { ... } } to DynamoClient.make.
Upgrade
Version history
1.8.2latest on npm
Audit
Dependencies
effectrequiredPeer dependency — core Effect TS runtime and Schema package
@aws-sdk/client-dynamodbrequiredAWS SDK v3 client for DynamoDB
@aws-sdk/util-dynamodbrequiredUtilities for marshalling/unmarshalling DynamoDB attribute values
Agent activity
8 hits · last 30 days
node
6
Resources
effect-dynamodb — npm install effect-dynamodb · libregistry