SQLite-backed molecular database for substructure, exact, and similarity search using OpenChemLib (OCL). Current version: 2.0.0, released September 2025. Uses Node.js built-in node:sqlite (requires Node >=22.5). Does not own the molecules table — you provide it. Key differentiator: works alongside your existing table, uses OCL 512-bit fingerprints, supports stereo-insensitive exact search via optional id_code_no_stereo column. Released as needed; mature library with active maintenance.
npm install openchemlib-sqliteNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Set up an in-memory SQLite database, create molecules table, insert a molecule (caffeine), then substructure-search for benzene ring.
Upgrade Node.js to v22.5.0 or later, or use older openchemlib-sqlite v1.x which did not require node:sqlite.
Use import instead of require(). Ensure your project is configured for ESM (type: module in package.json).
Install openchemlib@^9.20.1 alongside this package.
Ensure molDB.migrate() is called. It is idempotent.
Create your molecules table with appropriate columns before constructing MoleculesDBSQLite.
Always convert lastInsertRowid to Number: molDB.insert(Number(lastInsertRowid), mol);
After search, use the entryId to fetch additional columns from your table.
Replace require() with import, and set type: module in package.json, or rename file to .mjs.
Use import { DatabaseSync } from 'node:sqlite' and create db = new DatabaseSync('path').Provide entriesTable: 'your_table_name' in the config object.
Call molDB.migrate() after constructing MoleculesDBSQLite and before any operations.