Skip to content

A DynamoDB library to ease the use of modeling complex hierarchical relationships and implementing a Single Table Design while keeping your query code readable.

License

Notifications You must be signed in to change notification settings

tywalch/electrodb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

99a32f5 · Mar 20, 2025
Sep 19, 2023
Dec 11, 2022
Oct 9, 2023
Sep 19, 2023
Feb 13, 2025
Feb 13, 2025
Mar 20, 2025
Dec 19, 2022
Jul 3, 2023
Sep 19, 2023
Sep 19, 2023
Sep 19, 2023
Feb 18, 2025
Jun 24, 2021
Oct 20, 2024
Jan 26, 2025
Sep 20, 2024
Sep 19, 2023
Feb 18, 2025
Oct 20, 2024
Jan 26, 2025
Nov 28, 2023
Oct 20, 2024
Feb 18, 2025
Nov 3, 2023
Oct 9, 2023

Repository files navigation

ElectroDB

Download Count Coverage Status NPM Bundle Size Runkit Demo Last Commit Issues Sponsors Github Stars

Logo Logo

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


Turn this

tasks
  .patch({
    team: "core",
    task: "45-662",
    project: "backend",
  })
  .set({ status: "open" })
  .add({ points: 5 })
  .append({
    comments: [
      {
        user: "janet",
        body: "This seems half-baked.",
      },
    ],
  })
  .where(({ status }, { eq }) => eq(status, "in-progress"))
  .go();

Into This

{
  "UpdateExpression": "SET #status = :status_u0, #points = #points + :points_u0, #comments = list_append(#comments, :comments_u0), #updatedAt = :updatedAt_u0, #gsi1sk = :gsi1sk_u0",
  "ExpressionAttributeNames": {
    "#status": "status",
    "#points": "points",
    "#comments": "comments",
    "#updatedAt": "updatedAt",
    "#gsi1sk": "gsi1sk"
  },
  "ExpressionAttributeValues": {
    ":status0": "in-progress",
    ":status_u0": "open",
    ":points_u0": 5,
    ":comments_u0": [
      {
        "user": "janet",
        "body": "This seems half-baked."
      }
    ],
    ":updatedAt_u0": 1630977029015,
    ":gsi1sk_u0": "$assignments#tasks_1#status_open"
  },
  "TableName": "your_table_name",
  "Key": {
    "pk": "$taskapp#team_core",
    "sk": "$tasks_1#project_backend#task_45-662"
  },
  "ConditionExpression": "attribute_exists(pk) AND attribute_exists(sk) AND #status = :status0"
}

Try it out!

About

A DynamoDB library to ease the use of modeling complex hierarchical relationships and implementing a Single Table Design while keeping your query code readable.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published