Docs / Hosting OwnBase

A Windows server, as a service

On Windows the server runs as a service through NSSM, a small program that runs another one as a service. Windows cannot run Node as a service by itself: sc.exe create with node.exe makes the service, but Node never tells Windows it has started. Windows waits, 30 seconds unless the machine is set to wait longer, then ends it with error 1053. NSSM starts Node, starts it again if it stops, writes what it prints to a log, and asks it to stop with Ctrl+C, so the server closes its database before it exits.

Run these in PowerShell as Administrator. They put the program in C:\Program Files\OwnBase and the workspace in C:\ProgramData\OwnBase.

1. Node 24. Install Node.js 24 from nodejs.org with the Windows Installer (.msi) and its default choices. It puts node.exe in C:\Program Files\nodejs.

2. The server and NSSM. Build the archive as in step 2 of A Linux server with systemd. The same archive runs on both. To build it in PowerShell, run $env:ELECTRON_SKIP_BINARY_DOWNLOAD = 1 on a line of its own, then pnpm install without that prefix. Unpack the archive, and copy in the 64-bit nssm.exe from NSSM 2.24. nssm.cc is often unavailable, so the second download line takes the same file from the Internet Archive. NSSM is not signed, so either way the third line checks the file before it is used. nssm.cc publishes its SHA-1, be7b3577c6e3a280e5106a9e9db5b3775931cefc, and the SHA-256 there is of that same file.

New-Item -ItemType Directory -Force "C:\Program Files\OwnBase\server" | Out-Null
tar -xzf ownbase-server.tar.gz -C "C:\Program Files\OwnBase\server"
try { Invoke-WebRequest https://nssm.cc/release/nssm-2.24.zip -OutFile nssm-2.24.zip }
catch { Invoke-WebRequest https://web.archive.org/web/20250206084707id_/https://nssm.cc/release/nssm-2.24.zip -OutFile nssm-2.24.zip }
if ((Get-FileHash nssm-2.24.zip).Hash -ne "727D1E42275C605E0F04ABA98095C38A8E1E46DEF453CDFFCE42869428AA6743") { throw "nssm-2.24.zip is not NSSM 2.24" }
Expand-Archive nssm-2.24.zip -DestinationPath .
Copy-Item nssm-2.24\win64\nssm.exe "C:\Program Files\OwnBase\"

nssm.cc also offers a later build, 2.24-101, made for programs that failed to start under 2.24 on Windows 10 1703. Use 2.24 all the same. On Windows Server 2025, 2.24 did everything in this section, while 2.24-101 never started the server again after it was ended.

3. The service. It starts in the program's folder, so the server's file is named without a path, and it runs as NT SERVICE\OwnBase, an account Windows makes for this one service, with no password and no rights of its own:

$nssm = "C:\Program Files\OwnBase\nssm.exe"
$data = "C:\ProgramData\OwnBase"
& $nssm install OwnBase "C:\Program Files\nodejs\node.exe"
& $nssm set OwnBase AppDirectory "C:\Program Files\OwnBase\server"
& $nssm set OwnBase AppParameters "ownbase-server.js --data $data\data --backup-dir $data\backups --invite-only"
& $nssm set OwnBase DisplayName "OwnBase workspace server"
& $nssm set OwnBase Start SERVICE_AUTO_START
& $nssm set OwnBase AppStdout "$data\logs\server.log"
& $nssm set OwnBase AppStderr "$data\logs\server.log"
& $nssm set OwnBase AppRotateFiles 1
& $nssm set OwnBase AppRotateOnline 1
& $nssm set OwnBase AppRotateBytes 10485760
& $nssm set OwnBase AppRestartDelay 5000
& $nssm set OwnBase AppStopMethodConsole 30000
sc.exe config OwnBase obj= "NT SERVICE\OwnBase"

4. The workspace's folder, open to that account, SYSTEM and Administrators, and nobody else. Other people who sign in to the machine cannot read it:

New-Item -ItemType Directory -Force "$data\data", "$data\backups", "$data\logs" | Out-Null
icacls $data /inheritance:r /grant:r "*S-1-5-18:(OI)(CI)F" "*S-1-5-32-544:(OI)(CI)F" "NT SERVICE\OwnBase:(OI)(CI)M"

5. Start it.

Start-Service OwnBase
Invoke-RestMethod http://127.0.0.1:8543/api/health
Select-String "Claim code" "$data\logs\server.log"

The first account made from this machine needs no claim code. From another machine it needs the one in the log. For other machines to reach the server, let them through the firewall:

New-NetFirewallRule -DisplayName "OwnBase" -Direction Inbound -Action Allow -Protocol TCP -LocalPort 8543 -Program "C:\Program Files\nodejs\node.exe"

Settings the server reads from the environment, such as a call relay's, go in NSSM's AppEnvironmentExtra, one NAME=value each. The server reads them when it starts:

& $nssm set OwnBase AppEnvironmentExtra "OWNBASE_TURN_URLS=turn:turn.example.org:3478" "OWNBASE_TURN_SECRET=the-shared-secret"
Restart-Service OwnBase

NSSM keeps them in the service's registry key, which anyone who signs in to the machine can read. On a computer other people use, that includes the relay's secret. With it they could use your relay, though the denied addresses in Your own relay with coturn keep them out of your network.

For people outside your network, put the server behind HTTPS and set --public-url, as in Behind a reverse proxy.

Day to day.

  • Get-Content "$data\logs\server.log" -Wait -Tail 50 follows the log. NSSM starts a new file past 10 MB and keeps the old ones beside it.
  • To update, Stop-Service OwnBase, unpack the new archive over the server's folder, and Start-Service OwnBase.
  • Commands that change the workspace, such as restore and recover, run with the service stopped, from an Administrator PowerShell: node "C:\Program Files\OwnBase\server\ownbase-server.js" recover --data C:\ProgramData\OwnBase\data.
  • & $nssm remove OwnBase confirm removes the service and leaves the workspace.

Tried on 2026-10-28 on a new GitHub Actions machine with Windows Server 2025. A script ran each block above as written in Windows PowerShell 5.1 as Administrator, with the archive built from this version:

  • node-v24.22.1-x64.msi installed without questions into C:\Program Files\nodejs.
  • nssm.cc answered 503 in three of four runs. The Internet Archive's copy then matched the hash.
  • The service ran node.exe as NT SERVICE\OwnBase. The folder's permissions listed that account, SYSTEM and Administrators, and nobody else. The service's registry key was readable by BUILTIN\Users.
  • The first Start-Service took 20 to 47 seconds across the runs, and step 5's health check answered as soon as it returned. Later starts took a second or two.
  • The first account, made on that machine, needed no code. A message, an upload and the owner's copy worked.
  • After Stop-Process -Force on node.exe, NSSM had the server answering again in 6 seconds, with its data.
  • Stop-Service returned at once, and the database's -wal file, 770 KB while the server ran, was gone: Ctrl+C reached Node and it closed the database.
  • Settings in AppEnvironmentExtra reached the server.
  • A service made for node.exe itself failed with error 1053 after 120 seconds, that machine's setting, and Windows ended Node.
  • nssm remove left the workspace's folder.

Not tried: the firewall rule from another machine, starting at boot, and NSSM's log rotation.

This page is made from docs/DEPLOYMENT.md.