{"id":20230433,"url":"https://github.com/rrrokhtar/express-dynamodb","last_synced_at":"2026-02-04T15:31:16.540Z","repository":{"id":228396277,"uuid":"773866752","full_name":"rrrokhtar/express-dynamodb","owner":"rrrokhtar","description":"express-dynamodb is a wrapper package for DynamoDB that simplifies its usage. It provides convenient functions for common operations such as inserting or updating items, deleting items, and querying items based on different criteria.","archived":false,"fork":false,"pushed_at":"2024-11-03T09:06:03.000Z","size":181,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-25T13:58:23.633Z","etag":null,"topics":["aws","database","ddb","dynamodb","dynamodb-local","easy-to-use","serverless"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/express-dynamodb","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rrrokhtar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-03-18T14:37:09.000Z","updated_at":"2024-11-19T10:11:13.000Z","dependencies_parsed_at":"2024-04-20T16:29:38.634Z","dependency_job_id":"22948747-dc90-4199-ba8c-229aa7cd1740","html_url":"https://github.com/rrrokhtar/express-dynamodb","commit_stats":null,"previous_names":["rrrokhtar/express-dynamodb"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rrrokhtar/express-dynamodb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrrokhtar%2Fexpress-dynamodb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrrokhtar%2Fexpress-dynamodb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrrokhtar%2Fexpress-dynamodb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrrokhtar%2Fexpress-dynamodb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rrrokhtar","download_url":"https://codeload.github.com/rrrokhtar/express-dynamodb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrrokhtar%2Fexpress-dynamodb/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262351371,"owners_count":23297604,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","database","ddb","dynamodb","dynamodb-local","easy-to-use","serverless"],"created_at":"2024-11-14T07:42:33.943Z","updated_at":"2026-02-04T15:31:16.494Z","avatar_url":"https://github.com/rrrokhtar.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# express-dynamodb\n\nexpress-dynamodb is a wrapper package for DynamoDB that simplifies its usage. It provides convenient functions for common operations such as inserting or updating items, deleting items, and querying items based on different criteria.\n\n## Installation\n\n```bash\nnpm install express-dynamodb\n```\n\n## Usage\n\n```javascript\nimport { insertOrUpdate, deleteOne, findOne, findMany, findManyByField, findManyPlain, findOperated, findWithin, findAll, setRegion } from 'express-dynamodb';\n\n// Set the AWS region\nsetRegion('us-east-1');\n\n// Set the AWS Secret\nsetAccessKey({accessKeyId: 'xxxxxx', secretAccessKey: 'xxxxxx'});\n\n// Set config (secret and region (opt) together)\nsetConfig({accessKeyId: 'xxxxxx', secretAccessKey: 'xxxxxx'}, 'us-east-1');\n\n// Insert or update an item\nawait insertOrUpdate('tableName', 'pk', item, 'sk');\n\n// Delete an item by partion key\nawait deleteOne('tableName', 'pk', 'pkValue');\n\n// Delete an item by partion key and sort key\nawait deleteOne('tableName', 'pk', 'pkValue', 'sk', 'skValue');\n\n// Find one item by partition key\nconst result = await findOne('tableName', 'pk', 'pkValue');\n\n// Find one item by partition key and sort key\nconst result = await findOne('tableName', 'pk', 'pkValue', 'sk', 'skValue');\n\n// Find many items by partition key\nconst results = await findMany('tableName', 'pk', 'pkValue');\n\n// Find many items by field\nconst resultsByField = await findManyByField('tableName', 'field', 'value');\n\n// Find many items using plain DynamoDB expression\nconst resultsPlain = await findManyPlain('tableName', 'filterExpression', {':u': 'value'});\n\n// Find items using operated filters\nconst operatedResults = await findOperated('tableName', { attribute: value }, { attribute: '\u003c' });\n\n// Find items within a range\nconst resultsWithinRange = await findWithin('tableName', 'key', start, end);\n\n// Find all items in the table\nconst batchSize = 100;\nlet res;\nlet iterator = findAll('tableName', batchSize);\nwhile ((res = await iterator.next()) \u0026\u0026 !res.done) {\n  for (const val of res.value) {\n    console.log(val);\n  }\n}\n```\n\n## API\n\n### setRegion(region: string)\n\nSets the AWS region for DynamoDB operations.\n\n- `region`: The AWS region (e.g., 'us-east-1').\n\n### insertOrUpdate(tableName: string, pk: string, item: any, sk?: string): Promise\\\u003cvoid\\\u003e\n\nInserts or updates an item in the table.\n\n- `tableName`: The name of the table.\n- `pk`: The partition key of the item.\n- `item`: The item to insert or update.\n- `sk` (optional): The sort key of the item.\n\n### deleteOne(tableName: string, pk: string, pkValue: string,  sk: string, skValue: string): Promise\\\u003cvoid\\\u003e\n\nDeletes one item by partition key.\n\n- `tableName`: The name of the table.\n- `pk`: The partition key of the item to be deleted.\n- `pkValue`: The value of the partition key.\n- `sk` (optional): The sort key of the item.\n- `skValue` (optional): The value of the sort key.\n\n### findOne(tableName: string, pk: string, pkValue: string, sk: string, skValue: string): Promise\\\u003cany | null\\\u003e\n\nFinds one item by partition key.\n\n- `tableName`: The name of the table.\n- `pk`: The partition key of the item to be found.\n- `pkValue`: The value of the partition key.\n- `sk` (optional): The sort key of the item.\n- `skValue` (optional): The value of the sort key.\n\nReturns `null` if the item is not found.\n\n### findMany(tableName: string, pk: string, pkValue: string): Promise\\\u003cany[]\\\u003e\n\nFinds many items by partition key.\n\n- `tableName`: The name of the table.\n- `pk`: The partition key of the items to be found.\n- `pkValue`: The value of the partition key.\n\nReturns an array of items.\n\n### findManyByField(tableName: string, field: string, value: any): Promise\\\u003cany[]\\\u003e\n\nFinds many items by field key.\n\n- `tableName`: The name of the table.\n- `field`: The field key of the items to be found.\n- `value`: The value of the field.\n\nReturns an array of items.\n\n### findManyPlain(tableName: string, filterExpression: string, expressionAttributeValues: Record\u003cstring, AttributeValue\u003e): Promise\\\u003cany[]\\\u003e\n\nFinds many items using a plain DynamoDB expression.\n\n- `tableName`: The name of the table.\n- `filterExpression`: The filter expression.\n- `expressionAttributeValues`: The expression attribute values.\n\nReturns an array of items.\n\n### findOperated(tableName: string, filter: any, operators: { [key: string]: '\u003c' | '\u003c=' | '=' | '\u003e=' | '\u003e' }): Promise\\\u003cany[]\\\u003e\n\nFinds items using operated filters.\n\n- `tableName`: The name of the table.\n- `filter`: The attributes to be searched and their values in an object.\n- `operators`: The operators for each attribute in an object.\n\nReturns an array of items.\n\n### findWithin(tableName: string, key: string, start: number, end: number): Promise\\\u003cany[]\\\u003e\n\nFinds items within a range.\n\n- `tableName`: The name of the table.\n- `key`: The key to filter within.\n- `start`: The start value of the range.\n- `end`: The end value of the range.\n\nReturns an array of items.\n\n### findAll(tableName: string, limit: number = 10): AsyncGenerator\u003cRecord\u003cstring, any\u003e[], void, unknown\u003e\n\nFindsall items in the table.\n\n- `tableName`: The name of the table.\n- `limit`: The maximum number of items to retrieve per batch (default is 10).\n\nReturns an async iterable that yields batches of items. Each batch is an array of items.\n\n## Conclusion\n\nexpress-dynamodb is a useful package for simplifying the usage of DynamoDB in an Express.js application. It provides convenient functions for common operations and helps abstract away some of the complexity of working with DynamoDB. By using this package, you can easily perform CRUD operations on your DynamoDB tables and retrieve data based on different criteria.\n\n\nAuthor: [@rrrokhtar](https://github.com/rrrokhtar)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frrrokhtar%2Fexpress-dynamodb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frrrokhtar%2Fexpress-dynamodb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frrrokhtar%2Fexpress-dynamodb/lists"}