Ddb-lib¶
A modular TypeScript library that makes working with AWS DynamoDB easier, faster, and more reliable.
Whether you're building with standalone DynamoDB or AWS Amplify Gen 2, ddb-lib provides the tools you need to implement best practices and avoid common pitfalls.
Modular • Type-Safe • Performance-Focused
Features¶
Modular architecture¶
Install only what you need. Use core utilities standalone, add monitoring, or integrate with Amplify.
Performance monitoring¶
Built-in statistics collection, anti-pattern detection, and actionable recommendations.
Best practices built-in¶
Pattern helpers, multi-attribute keys, and utilities that guide you toward optimal DynamoDB usage.
Type safe¶
Full TypeScript support with type inference and validation throughout.
DynamoDB patterns¶
Learn and implement proven DynamoDB design patterns with helper functions.
Quick start¶
Get up and running in minutes with comprehensive guides and examples.
Package overview¶
@ddb-lib/core¶
Pattern helpers and utilities for DynamoDB best practices.
Learn more about @ddb-lib/core
@ddb-lib/stats¶
Performance monitoring and anti-pattern detection.
Learn more about @ddb-lib/stats
@ddb-lib/client¶
Standalone DynamoDB client with monitoring.
Learn more about @ddb-lib/client
@ddb-lib/amplify¶
Seamless Amplify Gen 2 integration.
Learn more about @ddb-lib/amplify
Quick examples¶
Standalone usage¶
import { TableClient } from '@ddb-lib/client'
import { PatternHelpers } from '@ddb-lib/core'
const table = new TableClient({
tableName: 'users',
statsConfig: { enabled: true }
})
// Use pattern helpers
const userKey = PatternHelpers.entityKey('USER', '123')
// Perform operations
await table.put({
pk: userKey,
sk: 'PROFILE',
name: 'Alice'
})
// Get recommendations
const recommendations = table.getRecommendations()
Amplify integration¶
import { generateClient } from 'aws-amplify/data'
import { AmplifyMonitor } from '@ddb-lib/amplify'
const client = generateClient()
const monitor = new AmplifyMonitor({
statsConfig: { enabled: true }
})
// Wrap your model
const monitoredTodos = monitor.wrap(
client.models.Todo
)
// Operations are automatically monitored
await monitoredTodos.create({
title: 'Buy groceries'
})
// Get insights
const stats = monitor.getStats()
Ready to get started?¶
Choose your path and start building better DynamoDB applications today.