A DynamoDB library to ease the use of modeling complex hierarchical relationships and implementing a Single Table Design while keeping your query code readable.
Installations
npm install electrodb
Developer Guide
Typescript
Yes
Module System
CommonJS
Node Version
22.6.0
NPM Version
10.8.2
Score
62.5
Supply Chain
99.6
Quality
82.2
Maintenance
100
Vulnerability
99.3
License
Releases
Unable to fetch releases
Contributors
Languages
JavaScript (42.69%)
TypeScript (40.16%)
MDX (15.75%)
Astro (0.85%)
CSS (0.53%)
Shell (0.03%)
Developer
tywalch
Download Statistics
Total Downloads
12,420,730
Last Day
15,012
Last Week
455,550
Last Month
1,586,031
Last Year
11,409,488
GitHub Statistics
1,038 Stars
510 Commits
69 Forks
13 Watching
170 Branches
28 Contributors
Bundle Size
229.59 kB
Minified
59.01 kB
Minified + Gzipped
Package Meta Information
Latest Version
3.0.1
Package Id
electrodb@3.0.1
Unpacked Size
537.05 kB
Size
92.00 kB
File Count
27
NPM Version
10.8.2
Node Version
22.6.0
Publised On
20 Oct 2024
Total Downloads
Cumulative downloads
Total Downloads
12,420,730
Last day
-77.2%
15,012
Compared to previous day
Last week
45.6%
455,550
Compared to previous week
Last month
-2.7%
1,586,031
Compared to previous month
Last year
1,151.9%
11,409,488
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
ElectroDB
ElectroDB is a DynamoDB library to ease the use of having multiple entities and complex hierarchical relationships in a single DynamoDB table.
Please submit issues/feedback or reach out on Twitter @tinkertamper.
ElectroDB v3 now released
Visit the v3 migration page to learn more about this new update.
Documentation now found at ElectroDB.dev
ElectroDB's new website for Documentation is now live at electrodb.dev.
The NEW ElectroDB Playground
Try out and share ElectroDB Models, Services, and Single Table Design at electrodb.fun
Features
- Single-Table Entity Isolation - Entities created with ElectroDB will not conflict with other entities when using a single DynamoDB table.
- Attribute Schema Enforcement - Define a schema for your entities with enforced attribute validation, defaults, types, aliases, and more.
- Easily Compose Hierarchical Access Patterns - Plan and design hierarchical keys for your indexes to multiply your possible access patterns.
- Simplified Sort Key Condition Querying - Write efficient sort key queries by easily building compose keys.
- Simplified Filter Composition - Easily create complex readable filters for DynamoDB queries without worrying about the implementation of
ExpressionAttributeNames
,ExpressionAttributeValues
, andFilterExpressions
. - Simplified Condition Composition - Use the same interface to casily create complex readable mutation conditions for DynamoDB queries without worrying about the implementation of
ExpressionAttributeNames
,ExpressionAttributeValues
, andConditionExpressions
. - Simplified Update Expression Composition - Easily compose type safe update operations without having to format tedious
ExpressionAttributeNames
,ExpressionAttributeValues
, andUpdateExpressions
. - Easily Query Across Entities - Define "collections" to create powerful/idiomatic queries that return multiple entities in a single request.
- Automatic Index Selection - Use
.find()
or.match()
methods to dynamically and efficiently query based on defined sort key structures. - Simplified Pagination API - ElectroDB generates url safe cursors for pagination, allows for fine grain automated pagination, and supports async iteration.
- Strong TypeScript Inference - Strong TypeScript support for both Entities and Services now in Beta.
- Query Directly via the Terminal - Execute queries against your
Entities
,Services
,Models
directly from the command line. - Stand Up Rest Server for Entities - Stand up a REST Server to interact with your
Entities
,Services
,Models
for easier prototyping. - Use with your existing tables - ElectroDB simplifies building DocumentClient parameters, so you can use it with existing tables/data.
Turn this
1tasks 2 .patch({ 3 team: "core", 4 task: "45-662", 5 project: "backend", 6 }) 7 .set({ status: "open" }) 8 .add({ points: 5 }) 9 .append({ 10 comments: [ 11 { 12 user: "janet", 13 body: "This seems half-baked.", 14 }, 15 ], 16 }) 17 .where(({ status }, { eq }) => eq(status, "in-progress")) 18 .go();
Into This
1{ 2 "UpdateExpression": "SET #status = :status_u0, #points = #points + :points_u0, #comments = list_append(#comments, :comments_u0), #updatedAt = :updatedAt_u0, #gsi1sk = :gsi1sk_u0", 3 "ExpressionAttributeNames": { 4 "#status": "status", 5 "#points": "points", 6 "#comments": "comments", 7 "#updatedAt": "updatedAt", 8 "#gsi1sk": "gsi1sk" 9 }, 10 "ExpressionAttributeValues": { 11 ":status0": "in-progress", 12 ":status_u0": "open", 13 ":points_u0": 5, 14 ":comments_u0": [ 15 { 16 "user": "janet", 17 "body": "This seems half-baked." 18 } 19 ], 20 ":updatedAt_u0": 1630977029015, 21 ":gsi1sk_u0": "$assignments#tasks_1#status_open" 22 }, 23 "TableName": "your_table_name", 24 "Key": { 25 "pk": "$taskapp#team_core", 26 "sk": "$tasks_1#project_backend#task_45-662" 27 }, 28 "ConditionExpression": "attribute_exists(pk) AND attribute_exists(sk) AND #status = :status0" 29}
No vulnerabilities found.
Reason
5 commit(s) and 12 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 14/30 approved changesets -- score normalized to 4
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/cicd.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/cicd.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/tywalch/electrodb/cicd.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/cicd.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/tywalch/electrodb/cicd.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/cicd.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/tywalch/electrodb/cicd.yml/master?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/cicd.yml:35
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 third-party GitHubAction dependencies pinned
- Info: 0 out of 1 npmCommand dependencies pinned
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 22 are checked with a SAST tool
Reason
70 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-rrc9-gqf8-8rwg
- Warn: Project is vulnerable to: GHSA-wf5p-g6vw-rhxx
- Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw
- Warn: Project is vulnerable to: GHSA-wg6g-ppvx-927h
- Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-xwcq-pm8m-c4vf
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq
- Warn: Project is vulnerable to: GHSA-f6v4-cf5j-vf3w
- Warn: Project is vulnerable to: GHSA-434g-2637-qmqr
- Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m
- Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw
- Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p
- Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747
- Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc
- Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx
- Warn: Project is vulnerable to: GHSA-c2ff-88x2-x9pg
- Warn: Project is vulnerable to: GHSA-2j2x-2gpw-g8fm
- Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc
- Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp
- Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5
- Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44
- Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988
- Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj
- Warn: Project is vulnerable to: GHSA-hhhv-q57g-882q
- Warn: Project is vulnerable to: GHSA-896r-f27r-55mw
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-8hfj-j24r-96c4
- Warn: Project is vulnerable to: GHSA-wc69-rhjr-hc9g
- Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j
- Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w
- Warn: Project is vulnerable to: GHSA-g6ww-v8xp-vmwg
- Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg
- Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p
- Warn: Project is vulnerable to: GHSA-g4rg-993r-mgx7
- Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-wqq4-5wpv-mx2g
- Warn: Project is vulnerable to: GHSA-3787-6prv-h9w3
- Warn: Project is vulnerable to: GHSA-9qxr-qj54-h672
- Warn: Project is vulnerable to: GHSA-m4v8-wqvr-p9f7
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
- Warn: Project is vulnerable to: GHSA-776f-qx25-q3cc
- Warn: Project is vulnerable to: GHSA-c4pw-33h3-35xw
- Warn: Project is vulnerable to: GHSA-49w6-73cw-chjr
- Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j
- Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55
- Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j
- Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm
- Warn: Project is vulnerable to: GHSA-54xq-cgqr-rpm3
- Warn: Project is vulnerable to: GHSA-353f-5xf4-qw67
- Warn: Project is vulnerable to: GHSA-c24v-8rfc-w8vw
- Warn: Project is vulnerable to: GHSA-8jhw-289h-jh2g
- Warn: Project is vulnerable to: GHSA-64vr-g452-qvp3
- Warn: Project is vulnerable to: GHSA-9cwx-2883-4wfx
- Warn: Project is vulnerable to: GHSA-m95q-7qp3-xv42
Score
3.8
/10
Last Scanned on 2024-12-16
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to electrodb
electrocli
Electro is a CLI utility toolbox for extending the functionality of the node library ElectroDB to the terminal.
electrodb-refactor-test
A library to more easily create and interact with multiple entities and heretical relationships in dynamodb
@ryands17/ddb-cache
A full serverless cache for DynamoDB that uses [ElectroDB](https://electrodb.dev/en/core-concepts/introduction/) under the hood for querying and TTL management.