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()
})
Errors
Common errors & fixes
Cannot find module 'effect-dynamodb' or its corresponding type declarations.
Package not installed or types not resolved.
fixnpm install effect-dynamodb
Type 'Schema<...>' is missing the following properties from type '...'
Mismatch between schema class definition and Entity.model expectations.
fixEnsure 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.
fixPass { entities: { ... }, tables: { ... } } to DynamoClient.make. 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