NodeBB

Community forum software

This project is funded by NLnet through these subgrants:

Try the service in a VM

  1. Install Nix
    Arch Linux
    Bash
    $ pacman --sync --refresh --noconfirm curl git jq nix
    Debian
    Bash
    $ apt install --yes curl git jq nix
    Ubuntu
    Bash
    $ apt install --yes curl git jq nix
  2. Download a configuration file
    # default.nix
    {
      ngipkgs ? import (fetchTarball "https://github.com/ngi-nix/ngipkgs/tarball/main") { },
    }:
    ngipkgs.demo-vm (
      { pkgs, ... }:
    
      {
        services.nodebb = {
          enable = true;
          enableLocalDB = true;
          openFirewall = true;
          admin = {
            username = "admin";
            email = "admin@example.com";
            # Do *NOT* do this in production!
            passwordFile = pkgs.writeText "nodebb-admin-password" "nodebb";
          };
          settings.database = "postgres";
          # Do *NOT* do this in production!
          databasePasswordFile = pkgs.writeText "postgresql-password" "nodebb";
        };
    
        # Do *NOT* do this in production!
        services.postgresql.initialScript = pkgs.writeText "init-sql-script" ''
          CREATE ROLE nodebb LOGIN PASSWORD 'nodebb';
        '';
      }
    
    )
    
  3. Enable binary substituters
    Bash
    $ export NIX_CONFIG='substituters = https://cache.nixos.org/ https://ngi.cachix.org/
    trusted-public-keys = cache.nixos.org-1:6nchdd59x431o0gwypbmraurkbj16zpmqfgspcdshjy= ngi.cachix.org-1:n+cal72roc3qqulxihpv+tw5t42whxmmhpragkrsrow='
  4. Build and run a virtual machine
    Arch Linux, Debian Sid and Ubuntu 25.04
    Bash
    $ nix-build ./default.nix && ./result
    Debian 12 and Ubuntu 24.04/24.10
    Bash
    $ rev=$(nix-instantiate --eval --attr sources.nixpkgs.rev https://github.com/ngi-nix/ngipkgs/archive/master.tar.gz | jq --raw-output)
    $ nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/$rev.tar.gz --packages nix --run "nix-build ./default.nix && ./result"

Options

services.nodebb
services.nodebb.admin.email

The admin user email address.

Type:
string
services.nodebb.admin.passwordFile

Path to a file containing the admin user's password.

Type:
absolute path
services.nodebb.admin.username

The admin user username.

Type:
string
services.nodebb.databasePasswordFile

Path to a file containing the database password.

Type:
absolute path
services.nodebb.enable

Whether to enable NodeBB.

Type:
boolean
Default:
false
services.nodebb.enableLocalDB

Whether to enable a local database for NodeBB.

Type:
boolean
Default:
false
services.nodebb.group

The group to run NodeBB under.

Type:
string
Default:
"nodebb"
services.nodebb.openFirewall

Whether to open ports in the firewall.

Type:
boolean
Default:
false
services.nodebb.package

The nodebb package to use.

Type:
package
Default:
pkgs.nodebb
Notes:
Missing update script An update script is required for automatically tracking the latest release.
services.nodebb.settings

NodeBB settings that will be written to config.json.

Type:
JSON value
services.nodebb.settings.database

Database type.

Type:
one of "mongo", "postgres", "redis"
Default:
"mongo"
services.nodebb.settings.mongo.database

Database name.

Type:
string
Default:
"nodebb"
services.nodebb.settings.mongo.host

Database host address.

Type:
string
Default:
"127.0.0.1"
services.nodebb.settings.mongo.port

Database host port.

Type:
16 bit unsigned integer; between 0 and 65535 (both inclusive)
Default:
default port of selected database
services.nodebb.settings.mongo.username

Database user.

Type:
string
Default:
"nodebb"
services.nodebb.settings.port

The port where NodeBB is accessible.

Type:
16 bit unsigned integer; between 0 and 65535 (both inclusive)
Default:
4567
services.nodebb.settings.postgres.database

Database name.

Type:
string
Default:
"nodebb"
services.nodebb.settings.postgres.host

Database host address.

Type:
string
Default:
"127.0.0.1"
services.nodebb.settings.postgres.port

Database host port.

Type:
16 bit unsigned integer; between 0 and 65535 (both inclusive)
Default:
default port of selected database
services.nodebb.settings.postgres.ssl

Whether to enable TLS.

Type:
boolean
Default:
false
services.nodebb.settings.postgres.username

Database user.

Type:
string
Default:
"nodebb"
services.nodebb.settings.redis.database

Database name.

Type:
signed integer
Default:
0
services.nodebb.settings.redis.host

Database host address.

Type:
string
Default:
"127.0.0.1"
services.nodebb.settings.redis.port

Database host port.

Type:
16 bit unsigned integer; between 0 and 65535 (both inclusive)
Default:
default port of selected database
services.nodebb.settings.url

The URL where NodeBB is accessible.

Type:
string
Default:
"http://localhost:4567"
services.nodebb.user

The user to run NodeBB under.

Type:
string
Default:
"nodebb"

Examples

{ pkgs, ... }:

{
  services.nodebb = {
    enable = true;
    enableLocalDB = true;
    openFirewall = true;
    admin = {
      username = "admin";
      email = "admin@example.com";
      # Do *NOT* do this in production!
      passwordFile = pkgs.writeText "nodebb-admin-password" "nodebb";
    };
    settings.database = "postgres";
    # Do *NOT* do this in production!
    databasePasswordFile = pkgs.writeText "postgresql-password" "nodebb";
  };

  # Do *NOT* do this in production!
  services.postgresql.initialScript = pkgs.writeText "init-sql-script" ''
    CREATE ROLE nodebb LOGIN PASSWORD 'nodebb';
  '';
}
{ config, pkgs, ... }:

{
  services.nodebb = {
    enable = true;
    enableLocalDB = true;
    admin = {
      username = "admin";
      email = "admin@example.com";
      # Do *NOT* do this in production!
      passwordFile = pkgs.writeText "nodebb-admin-password" "nodebb";
    };
    settings.database = "redis";
  };

  services.redis.servers."nodebb" = {
    port = 6379;
    # Do *NOT* do this in production!
    requirePassFile = pkgs.writeText "redis-password" "nodebb";
  };
}