Installation¶
Install the packages you need based on your use case.
For standalone applications¶
Install the client package (includes core and stats):
Install AWS SDK peer dependencies:
For Amplify applications¶
Install the Amplify integration package:
Amplify should already be installed in your project.
For custom implementations¶
Install only the utilities you need:
# Just pattern helpers
npm install @ddb-lib/core
# Pattern helpers + monitoring
npm install @ddb-lib/core @ddb-lib/stats
Verify installation¶
Create a test file to verify installation:
// test.ts
import { PatternHelpers } from '@ddb-lib/core'
const key = PatternHelpers.entityKey('USER', '123')
console.log(key) // Should print: USER#123
Run it:
TypeScript configuration¶
Ensure your tsconfig.json has:
{
"compilerOptions": {
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "node",
"esModuleInterop": true,
"strict": true
}
}
Troubleshooting¶
Module not found¶
If you see "Cannot find module '@ddb-lib/core'":
- Check that the package is in
package.json - Run
npm installagain - Clear
node_modulesand reinstall
TypeScript errors¶
If you see TypeScript errors:
- Ensure TypeScript >= 5.0.0
- Check
tsconfig.jsonsettings - Restart your IDE/editor
AWS SDK errors¶
If you see AWS SDK errors with @ddb-lib/client:
# Make sure peer dependencies are installed
npm install @aws-sdk/client-dynamodb @aws-sdk/lib-dynamodb