{"_id":"@boruto_vk7/better-sqlite3-termux","name":"@boruto_vk7/better-sqlite3-termux","dist-tags":{"latest":"1.0.14"},"versions":{"1.0.14":{"name":"@boruto_vk7/better-sqlite3-termux","version":"1.0.14","description":"Drop-in better-sqlite3 wrapper for Termux (Android) and Linux — auto-compiles isolated native engines.","license":"MIT","type":"module","sideEffects":false,"exports":{".":{"import":{"types":"./types.d.cts","default":"./dist/index.mjs"},"require":{"types":"./types.d.cts","default":"./dist/index.cjs"}}},"main":"./dist/index.cjs","module":"./dist/index.mjs","types":"./types.d.cts","scripts":{"postinstall":"node ./dist/install.cjs"},"optionalDependencies":{"better-sqlite3":"^12.9.0"},"engines":{"node":">=18.0.0"},"keywords":["sqlite3","better-sqlite3","termux","android","bot","database"],"author":{"name":"Borutovk7"},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/boruto_vk7/better-sqlite3.git"},"homepage":"https://www.npmjs.com/package/@boruto_vk7/better-sqlite3","bugs":{"url":"https://github.com/boruto_vk7/better-sqlite3/issues"},"_id":"@boruto_vk7/better-sqlite3-termux@1.0.14","_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-yT7YGx0vcEm5o5QKDBQ0J1+ZYLeq7O3Rmn4jvK3lcD4F34fZmyovPZEQJ0jcUymlppxlBrRINZBEgpU3eUauNw==","shasum":"f9c8fdf26e9621ceb8734f1e8041c01b8c9ed994","tarball":"https://registry.npmjs.org/@boruto_vk7/better-sqlite3-termux/-/better-sqlite3-termux-1.0.14.tgz","fileCount":9,"unpackedSize":42852,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIEgXa1ZwTYD1Qe44tzoFsfvpgffNXWH9rtDp+Sg5zvtoAiEAsXcTvs/ILnMOtfTnFY82aCaQeD8hKlCG6afZ/z2fwFw="}]},"_npmUser":{"name":"eduh_dev021","email":"kentakakura021028@gmail.com"},"directories":{},"maintainers":[{"name":"eduh_dev021","email":"kentakakura021028@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/better-sqlite3-termux_1.0.14_1784949422920_0.6918072316817585"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-25T03:17:02.708Z","1.0.14":"2026-07-25T03:17:03.076Z","modified":"2026-07-25T03:17:03.310Z"},"maintainers":[{"name":"eduh_dev021","email":"kentakakura021028@gmail.com"}],"description":"Drop-in better-sqlite3 wrapper for Termux (Android) and Linux — auto-compiles isolated native engines.","homepage":"https://www.npmjs.com/package/@boruto_vk7/better-sqlite3","keywords":["sqlite3","better-sqlite3","termux","android","bot","database"],"repository":{"type":"git","url":"git+https://github.com/boruto_vk7/better-sqlite3.git"},"author":{"name":"Borutovk7"},"bugs":{"url":"https://github.com/boruto_vk7/better-sqlite3/issues"},"license":"MIT","readme":"# @boruto_vk7/better-sqlite3-termux\n\n![npm](https://img.shields.io/npm/v/@boruto_vk7/better-sqlite3-termux?style=flat-square)\n![node](https://img.shields.io/node/v/@boruto_vk7/better-sqlite3-termux?style=flat-square)\n![license](https://img.shields.io/npm/l/@boruto_vk7/better-sqlite3-termux?style=flat-square)\n![platform](https://img.shields.io/badge/platform-Termux%20%7C%20Linux-lightgrey?style=flat-square)\n\n**Drop-in replacement for [`better-sqlite3`](https://github.com/WiseLibs/better-sqlite3)** that actually works on **Termux (Android)** and standard Linux.\n\nSame API. ESM + CommonJS. Auto-compiles an isolated native engine when `node-gyp` would normally fail on phone storage.\n\n---\n\n## Why this package exists\n\nOn Termux / Android internal storage, classic `better-sqlite3` installs often break because:\n\n- FUSE/FAT paths under `/sdcard` hate symlinks and native builds  \n- `node-gyp` needs clang, python, headers, sqlite libs  \n- Moving a project from phone → VPS leaves the wrong binary ABI  \n\n`@boruto_vk7/better-sqlite3-termux` detects the environment, installs system deps on Termux when needed, builds `better-sqlite3` into `~/.sqlite3_engines/<projectId>/`, and loads that engine at runtime.\n\n---\n\n## Install\n\n```bash\nnpm install @boruto_vk7/better-sqlite3-termux\n```\n\n> On Termux the first install/import may take a few minutes while native code compiles.\n\n---\n\n## Usage\n\nIdentical to upstream `better-sqlite3` — only the import path changes.\n\n### CommonJS\n\n```js\nconst Database = require('@boruto_vk7/better-sqlite3-termux');\n\nconst db = new Database('bot.db');\ndb.exec('CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT)');\n\nconst insert = db.prepare('INSERT INTO users (name) VALUES (?)');\ninsert.run('Boruto');\n\nconst row = db.prepare('SELECT * FROM users').get();\nconsole.log(row.name);\n```\n\n### ESM\n\n```js\nimport Database from '@boruto_vk7/better-sqlite3-termux';\n\nconst db = new Database('bot.db');\n```\n\n---\n\n## Pin better-sqlite3 version\n\n### 1) `package.json` (recommended)\n\n```json\n{\n  \"dependencies\": {\n    \"@boruto_vk7/better-sqlite3-termux\": \"^1.0.13\"\n  },\n  \"boruto\": {\n    \"sqliteVersion\": \"12.9.0\"\n  }\n}\n```\n\n(`irithell.sqliteVersion` is still accepted for compatibility.)\n\n### 2) Environment variable\n\n```bash\nSQLITE_VERSION=12.9.0 node app.js\n# or\nBETTER_SQLITE3_VERSION=12.9.0 npm install @boruto_vk7/better-sqlite3-termux\n```\n\n### Force rebuild\n\n```bash\nnode ./node_modules/@boruto_vk7/better-sqlite3-termux/dist/install.cjs\n```\n\n---\n\n## Engine management API\n\n```js\nconst {\n  listEngines,\n  getCurrentEngine,\n  deleteEngine,\n  clearAllEngines,\n  engineManager,\n} = require('@boruto_vk7/better-sqlite3-termux');\n\nlistEngines();        // all engines in ~/.sqlite3_engines/\ngetCurrentEngine();   // this project\ndeleteEngine();       // delete current (or pass projectId)\nclearAllEngines();    // wipe all\n\n// helpers\nengineManager.list();\nengineManager.current();\nengineManager.delete();\nengineManager.clearAll();\n```\n\nCompiled engines live in:\n\n```bash\n~/.sqlite3_engines/\n```\n\n---\n\n## Features\n\n- **Termux-aware install** — installs `clang`, `make`, `python`, `pkg-config`, `libsqlite` when missing  \n- **Isolated engines per project** (MD5 of project path)  \n- **Runtime recovery** if `postinstall` was skipped (`--ignore-scripts`)  \n- **Cross-environment rebuild** when you move phone → VPS / Docker  \n- **Original better-sqlite3 types**  \n- **ESM + CJS**\n\n---\n\n## Requirements\n\n- Node.js **≥ 18**\n- Termux: ability to run `pkg install` (first build)\n- Linux/VPS: normal build tools if a native compile is needed\n\n---\n\n## Changelog\n\n### 1.0.13\n- Published as `@boruto_vk7/better-sqlite3-termux`\n- Rebranded logs and docs\n- Support `boruto.sqliteVersion` config key\n- Ship clean empty `engine-config.json` (no machine-specific paths)\n\n### 1.0.11\n- Smart package pre-check on Termux (`dpkg-query`)\n- APT sandbox flags for Android permission quirks\n\n### 1.0.10\n- Runtime install if postinstall is blocked\n- `SQLITE_VERSION` / `BETTER_SQLITE3_VERSION`\n- Engine management API\n- English logs\n\n---\n\n## License\n\nMIT © Borutovk7  \nBased on the Termux isolation approach pioneered by the better-sqlite3-termux ecosystem.\n","readmeFilename":"README.md","_rev":"1-d96667c7c635881256f0f1c5104d0451"}