How to use SQLite3 in Node.js (full clear documentation for beginners)
dev.to·12h·
Discuss: DEV
Flag this post

SQLite3 is the file based database

  • No server needed.
  • Just one file → .db

You can embed this DB inside your desktop app, CLI tool or small web backend.

For using SQLite3 we need a SQLite3 package and web admin panel. You can install it from NPM

npm install sqlite3 sqlite3-admin

Making a database connection

First of all for using SQLite3 database you need a making connection (for instance create a file db.js):

const sqlite3 = require('sqlite3').verbose();

// Opens database file
// if file not exists → it will create automatically
const db = new sqlite3.Database('./app.db');

Run your db.js:

node db.js

And then we’ll connect it to sqlite3 admin panel for viewing it visually (for checking that our codes runs correctly or not). For c…

Similar Posts

Loading similar posts...