Skip to content

Getting Started

Get started by installing Document Builder and its peer dependencies:

Terminal window
npm i dynamo-document-builder zod @aws-sdk/client-dynamodb @aws-sdk/lib-dynamodb

Document Builder follows Single Table design, to get started we’ll first need to define our table:

import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
import { DynamoDBDocumentClient } from '@aws-sdk/lib-dynamodb';
import { DynamoTable } from 'dynamo-document-builder';
const dynamoClient = new DynamoDBClient();
const documentClient = DynamoDBDocumentClient.from(dynamoClient);
const exampleTable = new DynamoTable({
name: 'ExampleTable',
documentClient,
keyNames: {
partitionKey: 'PK',
sortKey: 'SK',
},
});

Now that we have our table, we can define the entities that belong to it.