{"id":21876979,"url":"https://github.com/libsql/libsql-node-sqlite3","last_synced_at":"2025-07-28T11:03:14.861Z","repository":{"id":142868165,"uuid":"612172439","full_name":"libsql/libsql-node-sqlite3","owner":"libsql","description":"node-sqlite3 compatible API for libSQL","archived":false,"fork":false,"pushed_at":"2023-07-16T02:05:46.000Z","size":921,"stargazers_count":13,"open_issues_count":3,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-07-01T09:50:04.781Z","etag":null,"topics":["javascript","libsql","nodejs","sqlite3"],"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/libsql.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":"2023-03-10T11:01:04.000Z","updated_at":"2025-04-18T10:13:35.000Z","dependencies_parsed_at":"2024-08-22T23:25:18.647Z","dependency_job_id":null,"html_url":"https://github.com/libsql/libsql-node-sqlite3","commit_stats":{"total_commits":43,"total_committers":3,"mean_commits":"14.333333333333334","dds":0.06976744186046513,"last_synced_commit":"4201ac2a7391f2181a938bb8925b5385cd77a865"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/libsql/libsql-node-sqlite3","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libsql%2Flibsql-node-sqlite3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libsql%2Flibsql-node-sqlite3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libsql%2Flibsql-node-sqlite3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libsql%2Flibsql-node-sqlite3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/libsql","download_url":"https://codeload.github.com/libsql/libsql-node-sqlite3/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libsql%2Flibsql-node-sqlite3/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267505099,"owners_count":24098346,"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-07-28T02:00:09.689Z","response_time":68,"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":["javascript","libsql","nodejs","sqlite3"],"created_at":"2024-11-28T08:07:31.708Z","updated_at":"2025-07-28T11:03:14.830Z","avatar_url":"https://github.com/libsql.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `sqlite3` wrapper for libSQL\n\nThis package is a drop-in replacement of the Node package [`sqlite3`](https://www.npmjs.com/package/sqlite3) for use with [sqld](https://github.com/libsql/sqld) (the libSQL server mode). Instead of opening a local SQLite database, this package connects to sqld using a WebSocket using the [Hrana protocol](https://github.com/libsql/hrana-client-ts).\n\n## Usage\n\nYou can get many applications that use the `sqlite3` package work with sqld just by replacing `require('sqlite3')` with `require('@libsql/sqlite3')`, and using a `libsql://` URL instead of a filename:\n\n```javascript\nconst sqlite3 = require('@libsql/sqlite3').verbose();\nconst db = new sqlite3.Database('libsql://localhost:2023?tls=0');\n\ndb.serialize(() =\u003e {\n    db.run('CREATE TABLE lorem (info TEXT)');\n\n    const stmt = db.prepare('INSERT INTO lorem VALUES (?)');\n    for (let i = 0; i \u003c 10; i++) {\n        stmt.run('Ipsum ' + i);\n    }\n    stmt.finalize();\n\n    db.each('SELECT rowid AS id, info FROM lorem', (err, row) =\u003e {\n        console.log(row.id + ': ' + row.info);\n    });\n});\n\ndb.close();\n```\n\n### URL\n\nThe library accepts the same URL schemas as [`@libsql/client`][libsql-client-ts]:\n\n- `http://` and `https://` connect to a libsql server over HTTP,\n- `ws://` and `wss://` connect to the server over WebSockets,\n- `libsql://` connects to the server using the default protocol (which is now HTTP). `libsql://` URLs use TLS by default, but you can use `?tls=0` to disable TLS (e.g. when you run your own instance of the server locally).\n\nTo use a JWT for authentication, you can use the `authToken` query parameter (for example,\n`ws://localhost?authToken=\u003ctoken\u003e`).\n\nYou can also pass a `file:` URL to `new sqlite3.Database()` to use the original `sqlite3` package. The returned database will be a `Database` from `sqlite3`, not the `Database` from `@libsql/sqlite3`. You will need to install `sqlite3` yourself, this package does not depend on `sqlite3`.\n\n[libsql-client-ts]: https://github.com/libsql/libsql-client-ts\n\n### Usage with Knex\n\nYou can use this package with Knex.js by replacing the `sqlite3` package in the SQLite dialect.\n\n#### JavaScript\n\n```javascript\nconst Knex = require(\"knex\");\nconst Client_SQLite3 = require(\"knex/lib/dialects/sqlite3\");\n\nclass Client_Libsql extends Client_SQLite3 {\n    _driver() {\n        return require(\"@libsql/sqlite3\");\n    }\n}\n\nconst knex = Knex({\n    client: Client_Libsql,\n    connection: {\n        filename: url,\n    },\n});\n```\n\n#### TypeScript\n\n```typescript\nimport { Knex, knex } from \"knex\";\nconst Client_SQLite3 = require(\"knex/lib/dialects/sqlite3\");\n\nclass Client_Libsql extends Client_SQLite3 {\n    _driver() {\n        return require(\"@libsql/sqlite3\");\n    }\n}\nconst db = knex({\n    client: Client_Libsql as any,\n    connection: {\n        filename: url,\n    },\n});\n```\n\n## Unsupported features\n\nMost APIs exposed by `sqlite3` should work as expected, but the following features are not implemented:\n\n- Flags passed to `new Database()` (they are ignored)\n- `Database.configure()`\n- `Database.loadExtension()`\n- `Database.interrupt()`\n\n## License\n\nThis project is licensed under the MIT license.\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in `@libsql/sqlite3` by you, shall be licensed as MIT, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibsql%2Flibsql-node-sqlite3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flibsql%2Flibsql-node-sqlite3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibsql%2Flibsql-node-sqlite3/lists"}