{"id":15288985,"url":"https://github.com/tracworx/nestjs-dataloader","last_synced_at":"2025-08-21T02:31:21.188Z","repository":{"id":37048595,"uuid":"439976963","full_name":"tracworx/nestjs-dataloader","owner":"tracworx","description":"Quick and easy GraphQL dataloaders for NestJS","archived":false,"fork":false,"pushed_at":"2024-12-09T12:14:15.000Z","size":2237,"stargazers_count":13,"open_issues_count":14,"forks_count":5,"subscribers_count":0,"default_branch":"master","last_synced_at":"2024-12-13T07:04:50.826Z","etag":null,"topics":["batch","dataloader","graphql","nestjs","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@tracworx/nestjs-dataloader","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tracworx.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2021-12-19T21:59:35.000Z","updated_at":"2024-01-19T13:49:16.000Z","dependencies_parsed_at":"2024-04-26T09:39:15.055Z","dependency_job_id":"710363aa-5b21-4f56-a8c3-e603db27eb70","html_url":"https://github.com/tracworx/nestjs-dataloader","commit_stats":{"total_commits":576,"total_committers":6,"mean_commits":96.0,"dds":"0.44270833333333337","last_synced_commit":"3fb313222887ba3b6c2a896d3cf5d38298a9b890"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tracworx%2Fnestjs-dataloader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tracworx%2Fnestjs-dataloader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tracworx%2Fnestjs-dataloader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tracworx%2Fnestjs-dataloader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tracworx","download_url":"https://codeload.github.com/tracworx/nestjs-dataloader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230479864,"owners_count":18232630,"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":["batch","dataloader","graphql","nestjs","typescript"],"created_at":"2024-09-30T15:55:11.075Z","updated_at":"2024-12-19T18:15:12.166Z","avatar_url":"https://github.com/tracworx.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GraphQL Dataloaders for NestJS\n\n[![NPM Version](https://img.shields.io/npm/v/@tracworx/nestjs-dataloader.svg)](https://www.npmjs.com/package/@tracworx/nestjs-dataloader)\n[![Package License](https://img.shields.io/npm/l/@tracworx/nestjs-dataloader.svg)](https://www.npmjs.com/package/@tracworx/nestjs-dataloader)\n![Libraries.io dependency status for latest release](https://img.shields.io/librariesio/release/npm/@tracworx/nestjs-dataloader)\n[![NPM Downloads](https://img.shields.io/npm/dm/@tracworx/nestjs-dataloader.svg)](https://www.npmjs.com/package/@tracworx/nestjs-dataloader)\n[![Lint Code Base](https://github.com/tracworx/nestjs-dataloader/actions/workflows/super-linter.yml/badge.svg)](https://github.com/tracworx/nestjs-dataloader/actions/workflows/super-linter.yml)\n[![Node.js CI](https://github.com/tracworx/nestjs-dataloader/actions/workflows/ci.yml/badge.svg)](https://github.com/tracworx/nestjs-dataloader/actions/workflows/ci.yml)\n[![Node.js Package](https://github.com/tracworx/nestjs-dataloader/actions/workflows/npm-publish.yml/badge.svg)](https://github.com/tracworx/nestjs-dataloader/actions/workflows/npm-publish.yml)\n[![Maintainability](https://img.shields.io/codeclimate/maintainability/tracworx/nestjs-dataloader)](https://codeclimate.com/github/tracworx/nestjs-dataloader/maintainability)\n[![Test Coverage](https://img.shields.io/codeclimate/coverage/tracworx/nestjs-dataloader)](https://codeclimate.com/github/tracworx/nestjs-dataloader/test_coverage)\n[![Twitter](https://img.shields.io/twitter/follow/realEoinOBrien.svg?style=social\u0026label=Follow)](https://twitter.com/realEoinOBrien)\n\n## Description\n\nQuick and easy GraphQL [dataloaders](https://github.com/graphql/dataloader) for NestJS.\n\n## Installation\n\n```bash\n$ npm install @tracworx/nestjs-dataloader\n```\n\n## Usage\n\nImport the `DataloaderModule` in your root module.\n\n```typescript\nimport { Module } from '@nestjs/common';\nimport { DataloaderModule } from '@tracworx/nestjs-dataloader';\nimport { ItemResolver } from './item.resolver';\nimport { ItemLoader } from './item.loader';\n\n@Module({\n  imports: [DataloaderModule],\n  providers: [ItemResolver, ItemLoader],\n})\nexport class AppModule {}\n```\n\nDecorate dataloader factory classes with `@DataloaderProvider()` to automatically provide them to the GraphQL context object for each request.\n\n```typescript\nimport DataLoader from 'dataloader';\nimport { DataloaderProvider } from '@tracworx/nestjs-dataloader';\n\n@DataloaderProvider()\nclass ItemLoader {\n  createDataloader(ctx: GqlExecutionContext) {\n    // Fetch request-scoped context data if needed\n    const user = ctx.getContext().req.user;\n    // Replace this with your actual dataloader implementation\n    return new DataLoader\u003cstring, Item\u003e(async (ids) =\u003e getItemsWithIds(user, ids));\n  }\n}\n```\n\nUse `@Loader(...)` to inject a dataloader instance into your resolver methods.\n\n```typescript\nimport DataLoader from 'dataloader';\nimport { Loader } from '@tracworx/nestjs-dataloader';\nimport { ItemLoader } from './item.loader';\n\n@Resolver()\nclass ItemResolver {\n  @Query(() =\u003e Item, { name: 'item' })\n  getItem(@Args('id') id: string, @Loader(ItemLoader) itemLoader) {\n    return itemLoader.load(id);\n  }\n}\n```\n\nAnd that's it. Happy coding!\n\n## Development\n\n```bash\n# build\n$ npm run build\n\n# format with prettier\n$ npm run format\n\n# lint with eslint\n$ npm run lint\n```\n\n## Test\n\n```bash\n# unit tests\n$ npm run test\n\n# e2e tests\n$ npm run test:e2e\n\n# test coverage\n$ npm run test:cov\n```\n\n## Stay in touch\n\n- Author - [Eoin O'Brien](https://github.com/eoin-obrien)\n- Website - [https://tracworx.ai](https://tracworx.ai/)\n- Twitter - [@realEoinOBrien](https://twitter.com/realEoinOBrien)\n\n## License\n\n`@tracworx/nestjs-dataloader` is [MIT licensed](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftracworx%2Fnestjs-dataloader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftracworx%2Fnestjs-dataloader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftracworx%2Fnestjs-dataloader/lists"}