dynamodb-abstract-repository
v1.12.0
Published
Easy single table design and advanced indexation patterns for DynamoDB
Downloads
5
Maintainers
Readme
DynamoDB Abstract Repository
Create repositories with custom indexation for easy lookup and hierarchy filter queries.
Out-of-the-box features:
- Custom lookup and hierarchy filter index with support for complex projections
- Automatically queries the required indexes based in the parameters provided in the item retrieval request
- Optimistic Locking with Version Number
- Enable / disable item overwrite
- Declarative expression builder for condition, projection and update expressions
- Custom counters update actions on entity create, update and delete
Considerations
This implementation does not uses DynamoDB secondary indexes (LSI/GSI) for indexing and querying. It manually creates the index entries in the same table as the item using a transaction. Also, it does not performs updates using the UpdateItem operation, so in all updates you must provide the entire item - you must get the item, modify it and then save it.
Advantages:
- Indexation strategies more flexible than LSI/GSI
- Easy to use, understand and maintain: no need to roll custom indexation strategies or write multiple commands to retrieve items based on indexes
- Simpler item update and consistent repository structure
Disadvantages
- The write operations is not optimized for cost as we use transactions and do not supports UpdateItem opreations
- The use of transactions for synchronous indexation increase the latency, as the TransactionWrite operation is far slower than PutItem operation
Next Steps
We're currently extensively testing the library and planning library interfaces improvements for the next releases
Installation
$ npm install dynamodb-abstract-repository