{"id":24317297,"url":"https://github.com/adrianmjim/nestjs-libsql-client","last_synced_at":"2025-09-27T02:30:27.749Z","repository":{"id":271461534,"uuid":"913535672","full_name":"adrianmjim/nestjs-libsql-client","owner":"adrianmjim","description":"NestJS TURSO libsql integration","archived":false,"fork":false,"pushed_at":"2025-09-22T17:59:37.000Z","size":404,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-22T19:42:22.017Z","etag":null,"topics":["database","libsql-client","libsql-client-ts","module","nestjs","postgres","sql","sqlite","turso","turso-db"],"latest_commit_sha":null,"homepage":"","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/adrianmjim.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-01-07T21:51:02.000Z","updated_at":"2025-03-06T18:27:42.000Z","dependencies_parsed_at":"2025-01-07T22:37:23.944Z","dependency_job_id":"4c2034e8-c25c-47c9-9521-1a77d6e782e9","html_url":"https://github.com/adrianmjim/nestjs-libsql-client","commit_stats":null,"previous_names":["adrianmjim/nestjs-libsql-client"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/adrianmjim/nestjs-libsql-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianmjim%2Fnestjs-libsql-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianmjim%2Fnestjs-libsql-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianmjim%2Fnestjs-libsql-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianmjim%2Fnestjs-libsql-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adrianmjim","download_url":"https://codeload.github.com/adrianmjim/nestjs-libsql-client/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianmjim%2Fnestjs-libsql-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277171377,"owners_count":25773199,"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","status":"online","status_checked_at":"2025-09-27T02:00:08.978Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["database","libsql-client","libsql-client-ts","module","nestjs","postgres","sql","sqlite","turso","turso-db"],"created_at":"2025-01-17T13:34:00.528Z","updated_at":"2025-09-27T02:30:27.432Z","avatar_url":"https://github.com/adrianmjim.png","language":"TypeScript","readme":"\u003cp align=\"center\" style=\"vertical-align:middle\"\u003e\n  \u003ca href=\"https://nestjs.com/\" target=\"blank\"\u003e\n    \u003cpicture\u003e\n      \u003cimg src=\"https://nestjs.com/img/logo_text.svg\" width=\"200\" alt=\"Nest Logo\" /\u003e\n    \u003c/picture\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://turso.tech/\" target=\"blank\"\u003e\n    \u003cpicture\u003e\n      \u003cimg src=\".github/cover.png\" alt=\"Turso\"\u003e\n    \u003c/picture\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n![Test](https://github.com/adrianmjim/nestjs-libsql-client/actions/workflows/codecov_test.yml/badge.svg)\n[![codecov](https://codecov.io/gh/Adrianmjim/nestjs-libsql-client/graph/badge.svg?token=jNHEDepqm7)](https://codecov.io/gh/Adrianmjim/nestjs-libsql-client)\n[![NPM Version](https://badge.fury.io/js/nestjs-libsql-client.svg?style=flat)](https://npmjs.org/package/nestjs-libsql-client)\n[![NPM Download Stats](https://nodei.co/npm/nestjs-libsql-client.png?downloads=true)](https://www.npmjs.com/package/nestjs-libsql-client)\n\n## Description\n\nThe [Turso Lib SQL client](https://github.com/tursodatabase/libsql-client) module for [NestJS](https://github.com/nestjs/nest).\n\n## Installation\n\nInstall the dependencies via `npm`, `pnpm` or `yarn`:\n\nnpm:\n```bash\n$ npm i -s @nestjs/common @libsql/client nestjs-libsql-client\n```\n\npnpm:\n```bash\n$ pnpm add @nestjs/common @libsql/client nestjs-libsql-client\n```\n\nyarn:\n```bash\n$ yarn add @nestjs/common @libsql/client nestjs-libsql-client\n```\n\n## Configuration\n\nFirst, import the module into your NestJS application and configure it using the configuration url provided by Turso or desired local configuration\n\n```typescript\nimport { Module } from '@nestjs/common';\nimport { LibSqlModule } from 'nestjs-libsql-client';\n\n@Module({\n  imports: [\n    LibSqlModule.forRoot({\n      url: 'file:local.db',\n    }),\n  ],\n})\nexport class AppModule {}\n```\n\nOr, You can configure it asynchronously as follows:\n\n```typescript\nimport { Module } from '@nestjs/common';\nimport { LibSqlModule } from 'nestjs-libsql-client';\n\n@Module({\n  imports: [\n    LibSqlModule.forRootAsync({\n      imports: [],\n      inject: [],\n      useFactory: () =\u003e ({\n         url: 'file:local.db',\n      }),\n    }),\n  ],\n})\nexport class AppModule {}\n```\n\n## Multiple connections\n\nIn certain situations, we will need to connect to different Turso databases, with this module this is possible:\n\n```typescript\nimport { Module } from '@nestjs/common';\nimport { LibSqlModule } from 'nestjs-libsql-client';\n\n@Module({\n  imports: [\n    LibSqlModule.forRoot([\n      {\n        name: 'connection1',\n        libSqlConfig: {\n           url: 'file:local.db',\n        },\n      },\n      {\n        name: 'connection2',\n        libSqlConfig: {\n           url: 'file:local.db2',\n        },\n      },\n    ]),\n  ],\n})\nexport class AppModule {}\n```\n\nOr asynchronously:\n\n```typescript\nimport { Module } from '@nestjs/common';\nimport { LibSqlModule } from 'nestjs-libsql-client';\n\n@Module({\n  imports: [\n    LibSqlModule.forRootAsync({\n      imports: [],\n      inject: [],\n      useFactory: () =\u003e ([\n        {\n          name: 'connection1',\n          libSqlConfig: {\n            url: 'file:local.db',\n          },\n        },\n        {\n          name: 'connection2',\n          libSqlConfig: {\n            url: 'file:local.db2',\n          },\n        },\n      ]),\n    }),\n  ],\n})\nexport class AppModule {}\n```\n\n## Usage\n\nFirst, inject the client into the module where you want to use it:\n\n```typescript\nimport { Module } from '@nestjs/common';\nimport { LibSqlModule } from 'nestjs-libsql-client';\n\n@Module({\n  imports: [\n    LibSqlModule.injectClient(),\n  ],\n})\nexport class CatModule {}\n```\n\nOr, for a specific connection:\n\n```typescript\nimport { Module } from '@nestjs/common';\nimport { LibSqlModule } from 'nestjs-libsql-client';\n\n@Module({\n  imports: [\n    LibSqlModule.injectClient('connection1', 'connection2'),\n  ],\n})\nexport class CatModule {}\n```\n\nNow you can use the Turso libsql client in any provider of your module, just use `InjectLibSqlClient` decorator:\n\n```typescript\nimport { Client } from '@libsql/client';\nimport { InjectLibSqlClient } from 'nestjs-libsql-client';\n\nexport class CatService {\n  constructor(@InjectLibSqlClient() private readonly libSqlClient: Client) {}\n\n  public doSomething(): void {\n\n  }\n}\n```\n\nOr, for a specific connection:\n\n```typescript\nimport { Client } from '@libsql/client';\nimport { InjectLibSqlClient } from 'nestjs-libsql-client';\n\nexport class CatService {\n  constructor(\n    @InjectLibSqlClient('connection1') private readonly libSqlClient: Client,\n    @InjectLibSqlClient('connection2') private readonly libSqlClient2: Client,\n  ) {}\n\n  public doSomething(): void {\n\n  }\n}\n```\n\nIt's also possible to use the `InjectLibSqlClient` decorator to inject the libsql client when you don't want to explicitly type it with the client:\n\n```typescript\nimport { InjectLibSqlClient } from 'nestjs-libsql-client';\n\nexport class CatService {\n  constructor(\n    @InjectLibSqlClient() private readonly libSqlClient: unknown,\n  ) {}\n\n  public doSomething(): void {\n\n  }\n}\n```\n\n## 🤝 Contributing [![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/adrianmjim/nestjs-libsql-client/issues)\n\nContributions, issues and feature requests are welcome.\n\n## Authors\n\n👤 **Adrián Martínez Jiménez**\n\n- Github: [@adrianmjim](https://github.com/adrianmjim)\n\nSee also the list of contributors who [participated](https://github.com/adrianmjim/nestjs-libsql-client/contributors) in this project.\n\n## Show Your Support\n\nPlease ⭐️ this repository if this project helped you!\n\n## 📝 License\n\nCopyright © 2024 [Adrián Martínez Jiménez](https://github.com/adrianmjim).\n\nThis project is licensed under the MIT License - see the [LICENSE file](LICENSE) for details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrianmjim%2Fnestjs-libsql-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadrianmjim%2Fnestjs-libsql-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrianmjim%2Fnestjs-libsql-client/lists"}