Database Integration in Express.js: A Complete Guide to Popular Node.js Database Drivers

Express.js does not include built‑in database support, but its flexibility allows you to connect it to virtually any database system simply by installing the appropriate Node.js driver. This article provides a complete overview of how to integrate Express with many popular SQL and NoSQL databases, including installation commands and example usage.

Express Database IntegrationNode.js Database Drivers

~2 min read • Updated Dec 26, 2025

1. Introduction


Express.js is a minimal framework and does not manage databases internally. To connect a database, you simply install the appropriate driver and use its API. This guide covers how to integrate Express with the following databases:

  • Cassandra
  • Couchbase
  • CouchDB
  • LevelDB
  • MySQL
  • MongoDB
  • Neo4j
  • Oracle
  • PostgreSQL
  • Redis
  • SQL Server
  • SQLite
  • Elasticsearch

2. Cassandra

Module: cassandra-driver

npm install cassandra-driver
const cassandra = require('cassandra-driver')
const client = new cassandra.Client({ contactPoints: ['localhost'] })

client.execute('select key from system.local', (err, result) => {
  if (err) throw err
  console.log(result.rows[0])
})

3. Couchbase

Module: couchbase

npm install couchbase
const couchbase = require('couchbase')
const bucket = (new couchbase.Cluster('http://localhost:8091')).openBucket('bucketName')

bucket.insert('document-key', { name: 'Matt', shoeSize: 13 }, ...)

4. CouchDB

Module: nano

npm install nano
const nano = require('nano')('http://localhost:5984')
nano.db.create('books')
const books = nano.db.use('books')

books.insert({ name: 'The Art of war' }, null, ...)

5. LevelDB

Module: levelup

npm install level levelup leveldown
const levelup = require('levelup')
const db = levelup('./mydb')

db.put('name', 'LevelUP', ...)

6. MySQL

Module: mysql

npm install mysql
const mysql = require('mysql')
const connection = mysql.createConnection({ host:'localhost', user:'dbuser', ... })
connection.query('SELECT 1 + 1 AS solution', ...)

7. MongoDB

Module: mongodb

npm install mongodb

Example (v3.*)

const MongoClient = require('mongodb').MongoClient

MongoClient.connect('mongodb://localhost:27017/animals', (err, client) => {
  const db = client.db('animals')
  db.collection('mammals').find().toArray(...)
})

For an object‑modeling layer, use Mongoose.

8. Neo4j

Module: neo4j-driver

npm install neo4j-driver
const driver = neo4j.driver('neo4j://localhost:7687', neo4j.auth.basic('neo4j','letmein'))
driver.session().readTransaction(...)

9. Oracle

Module: oracledb

npm install oracledb
const conn = await oracledb.getConnection(config)
const result = await conn.execute('select * from employees where employee_id = :id', [empId])

10. PostgreSQL

Module: pg-promise

npm install pg-promise
const db = pgp('postgres://username:password@host:port/database')
db.one('SELECT $1 AS value', 123).then(...)

11. Redis

Module: redis

npm install redis
const client = redis.createClient()
client.set('string key', 'string val', redis.print)
client.hkeys('hash key', ...)

12. SQL Server

Module: tedious

npm install tedious
const connection = new Connection(config)
connection.execSql(new Request("select 123, 'hello world'", ...))

13. SQLite

Module: sqlite3

npm install sqlite3
const db = new sqlite3.Database(':memory:')
db.run('CREATE TABLE lorem (info TEXT)')

14. Elasticsearch

Module: elasticsearch

npm install elasticsearch
client.search({
  index: 'books',
  body: { query: { multi_match: { query:'express js', fields:['title','description'] } } }
})

Conclusion


Express.js can integrate with virtually any database—relational or NoSQL—simply by installing the appropriate driver and using its API. This flexibility makes Express an excellent choice for building modern, scalable, and data‑driven applications.

Written & researched by Dr. Shahin Siami