{"id":18143206,"url":"https://github.com/tobidi0410/kysely-sqlite-http","last_synced_at":"2026-01-27T13:04:35.858Z","repository":{"id":260645763,"uuid":"881944688","full_name":"ToBiDi0410/kysely-sqlite-http","owner":"ToBiDi0410","description":"An Kysely dialect for querying data from statically hosted sqlite databases","archived":false,"fork":false,"pushed_at":"2024-11-01T22:23:29.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-01T17:58:03.227Z","etag":null,"topics":["database","dialect","gh-pages","http","kysely","sqlite","static-site","vfs"],"latest_commit_sha":null,"homepage":"","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/ToBiDi0410.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}},"created_at":"2024-11-01T14:47:59.000Z","updated_at":"2024-11-01T22:23:10.000Z","dependencies_parsed_at":"2024-11-01T15:43:40.012Z","dependency_job_id":null,"html_url":"https://github.com/ToBiDi0410/kysely-sqlite-http","commit_stats":null,"previous_names":["tobidi0410/kysely-sqlite-http"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ToBiDi0410%2Fkysely-sqlite-http","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ToBiDi0410%2Fkysely-sqlite-http/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ToBiDi0410%2Fkysely-sqlite-http/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ToBiDi0410%2Fkysely-sqlite-http/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ToBiDi0410","download_url":"https://codeload.github.com/ToBiDi0410/kysely-sqlite-http/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230547694,"owners_count":18243227,"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":["database","dialect","gh-pages","http","kysely","sqlite","static-site","vfs"],"created_at":"2024-11-01T19:06:05.036Z","updated_at":"2026-01-27T13:04:30.824Z","avatar_url":"https://github.com/ToBiDi0410.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kysely SQLite HTTP\n\nKysely SQLite HTTP allows you to run queries on a remote sqlite database without fetching the entire database by only fetching fragments relevant to the query.\nIt wraps the [sql.js-httpvfs](https://github.com/phiresky/sql.js-httpvfs) library and provides a simple kysely-compatible interface that is similar to the interface of [sql.js-httpvfs](https://github.com/phiresky/sql.js-httpvfs).\n\n# Features\n- 🧵 Runs the queries in a web worker so queries do not block the main thread\n- 📂 Only fetches data relevant to the queries, which reduces bandwidth usage\n- 🚀 Speeds up queries on remote HTTP(S) databases drastically\n- 🔎 Uses SQLite speed-optimizations (such as indices for queries)\n- 🛠️ Works with Kysely for creating type-safe queries\n\n# Usage\n## Example code\n```javascript\nimport { Kysely } from 'kysely';\nimport { SqliteHttpDialect } from 'kysely-sqlite-http';\nimport { type Database } from './database.ts'; //Your database definition\n\nconst dialect = new SqliteHttpDialect({\n    debug: true,\n    /* These options match the ones needed for sql.js-httpvfs */\n    maxBytesToRead: 10 * 1024 * 1024,\n    fileConfigs: [ \n        {\n        from: \"inline\",\n            config: {\n                serverMode: \"full\",\n                requestChunkSize: 4096,\n                url: \"./fancyRemote.db\"\n            }\n        }\n    ]\n});\n\nexport const db = new Kysely\u003cDatabase\u003e({\n    dialect,\n});\n```\nLearn more about the options at https://github.com/phiresky/sql.js-httpvfs/tree/master?tab=readme-ov-file#usage\n\n## Installation\nInstallable via NPM Repository\n\n```sh\nnpm install kysely-sqlite-http\n# or...\npnpm install kysely-sqlite-http\n```\n\n## Optimization\nTo speed up queries you can run the following queries on your SQLite database:\n```sql\n-- first, add whatever indices you need. Note that here having many and correct indices is even more important than for a normal database.\npragma journal_mode = delete; -- to be able to actually set page size\npragma page_size = 1024; -- trade off of number of requests that need to be made vs overhead. \n\ninsert into ftstable(ftstable) values ('optimize'); -- for every FTS table you have (if you have any)\n\nvacuum; -- reorganize database and apply changed page size\n```\nThere are other methods to speed up queries, please checkout the actual driver implementation for this.\n\nLearn more at https://github.com/phiresky/sql.js-httpvfs/tree/master?tab=readme-ov-file#usage\n\n# ⚠️ Maintenance notice\nThis repository was created as part of a private project and therefore, it is \u003cb\u003enot actively maintained!\u003c/b\u003e\u003cbr\u003e\nI will do my best to fix bugs as quickly as possible and process your pull requests but i won't be adding new features.\n\n# Credits\n- [sql.js-httpvfs](https://github.com/phiresky/sql.js-httpvfs) for creating the SQLite HTTP-VFS driver\n- [kysely](https://github.com/kysely-org/kysely) for creating an awesome query builder\n- [SQLocal/README.md](https://github.com/DallasHoff/sqlocal/blob/main/README.md) for inspiration on this README","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobidi0410%2Fkysely-sqlite-http","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftobidi0410%2Fkysely-sqlite-http","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobidi0410%2Fkysely-sqlite-http/lists"}