Community-maintained Node.js LDAP project

ldapjs-community

An independent, community-maintained drop-in fork of ldapjs v2, preserving its client and server APIs under the ldapjs-community npm package.

This project is not affiliated with or endorsed by the original ldapjs maintainers.

Compatibility

Built for ldapjs v2 applications

The fork targets the v2 API. If your application uses ldapjs v3, the project currently says not to switch.

Release checked
2.4.0 · October 10, 2026
Package engine
Node.js ≥10.13.0
Current CI matrix
Node.js 18, 20, 22, and 24

Installation

Replace ldapjs v2 without changing imports

Install the fork under the original package name. Existing require('ldapjs') and imports can remain unchanged.

Terminal
npm install ldapjs@npm:ldapjs-community@^2.4.0

See direct and transitive dependency options →

Quick start

Bind and search

Connect with environment-provided credentials, bind, stream search entries, and close the connection.

quick-start.js
const ldap = require('ldapjs')

const client = ldap.createClient({
  url: process.env.LDAP_URL
})

client.on('error', (err) => {
  console.error('LDAP connection error:', err)
})

client.bind(process.env.LDAP_BIND_DN, process.env.LDAP_PASSWORD, (bindError) => {
  if (bindError) {
    client.destroy()
    throw bindError
  }

  client.search(process.env.LDAP_BASE_DN, {
    scope: 'sub',
    filter: '(objectClass=person)',
    attributes: ['dn', 'cn', 'mail']
  }, (searchError, response) => {
    if (searchError) {
      client.unbind()
      throw searchError
    }

    response.on('searchEntry', (entry) => console.log(entry.object))
    response.on('error', (error) => console.error('Search error:', error))
    response.on('end', () => client.unbind())
  })
})

Read the complete search example →