Thanks to visit codestin.com
Credit goes to e18e.dev

Skip to content

Replacements for sqlite3

node:sqlite (native, since Node.js 22.13.0)

Node.js ships a built-in SQLite module, node:sqlite, which is the preferred option when you can target a recent Node runtime.

Example:

ts
import sqlite3 from 'sqlite3'
import { DatabaseSync } from 'node:sqlite'

const db = new sqlite3.Database('app.db') 
const db = new DatabaseSync('app.db') 

db.all('SELECT * FROM users', (err, rows) => {}) 
const rows = db.prepare('SELECT * FROM users').all() 

better-sqlite3

better-sqlite3 is a popular and actively maintained SQLite library for Node.js.

Example:

ts
import sqlite3 from 'sqlite3'
import Database from 'better-sqlite3'

const db = new sqlite3.Database('app.db') 
const db = new Database('app.db') 

db.all('SELECT * FROM users', (err, rows) => {}) 
const rows = db.prepare('SELECT * FROM users').all() 

Released under the MIT License. (59586463)