Examples for using SQLite extensions from @sqliteai in Node.js applications.
| Extension | Package | Repository |
|---|---|---|
| vector | @sqliteai/sqlite-vector |
github.com/sqliteai/sqlite-vector |
| cloudsync | @sqliteai/sqlite-sync |
github.com/sqliteai/sqlite-sync |
| js | @sqliteai/sqlite-js |
github.com/sqliteai/sqlite-js |
| ai | @sqliteai/sqlite-ai |
github.com/sqliteai/sqlite-ai |
# Install required dependencies
npm install better-sqlite3
# Install one or more extensions
npm install @sqliteai/sqlite-vector
npm install @sqliteai/sqlite-sync
npm install @sqliteai/sqlite-js
npm install @sqliteai/sqlite-aiFile: example.js
Comprehensive example showing how to load and use all SQLite extensions together.
npm start
# or
node example.jsFeatures:
- Load all four extensions (vector, sync, js, ai)
- Automatic version detection
- Example 1: Vector search with embeddings and quantization
- Example 2: Database synchronization with CloudSync
- Example 3: JavaScript user-defined functions (slugify, factorial, eval)
- Example 4: AI inference setup instructions
- Example 5: Combining extensions for powerful workflows
- Graceful handling of missing extensions
-
Clone or download the examples:
cd sqlite-extensions-guide/examples/node -
Install dependencies:
npm install
-
Run the example:
npm start
const { getExtensionPath } = require('@sqliteai/sqlite-vector'); // or @sqliteai/sqlite-sync @sqliteai/sqlite-js @sqliteai/sqlite-ai
const Database = require('better-sqlite3');
const db = new Database(':memory:');
db.loadExtension(getExtensionPath());
// Get the extension version
db.prepare("SELECT vector_version()").pluck().get(); // or cloudsync_version() js_version() ai_version()All extensions support:
- macOS: ARM64 (Apple Silicon), x64 (Intel)
- Linux: ARM64, x64 (both glibc and musl/Alpine)
- Windows: x64
Extensions are automatically installed for your platform via optionalDependencies.
- SQLite Vector Documentation
- SQLite Sync Documentation
- SQLite JS Documentation
- SQLite AI Documentation
- better-sqlite3 Documentation
Found an issue or have an improvement? Please open an issue or pull request on the respective repository.
See individual package licenses for details.