# Run without Docker

> Run the OpenNodd server directly with Node.js, using the embedded database or your own Postgres.

You can run the server as a normal program. This is handy for trying OpenNodd, for development, or on a machine without Docker.

## Requirements

- Node.js 22.5 or newer, with npm.
- For production: a Postgres server. Without one, OpenNodd uses an embedded Postgres (PGlite) that needs nothing installed.

## Install the `nodd` command

The `nodd` command includes the server. There are two ways to get it.

### From a running OpenNodd server

Every server serves its own copy:

```sh
npm install -g https://nodd.example.com/opennodd.tgz
```

### From source

You need pnpm 9 as well.

```sh
git clone https://github.com/opennodd/opennodd.git
cd opennodd
pnpm install
pnpm build
cd gateway && npm link        # puts `nodd` on your PATH
```

Or run it without linking: `pnpm --filter opennodd exec node dist/cli.js serve`.

## Start the server

```sh
nodd serve
```

With no database set, OpenNodd keeps its data in `./data/pglite`, relative to the folder you started it in. Open `http://127.0.0.1:7420/app`. The first person to sign up becomes the admin.

To use a Postgres server:

```sh
export DATABASE_URL=postgres://nodd:a-password@localhost:5432/opennodd
nodd serve
```

Or pass it as an option: `nodd serve --db postgres://...`. Create the database first; OpenNodd creates its own tables.

Other options: `--port 7420`, `--host 127.0.0.1`, `--grpc-port 7421`. All environment variables in [Configuration](/self-hosting/configuration) work here too. For example:

```sh
NODD_PUBLIC_URL=https://nodd.example.com NODD_INVITE_ONLY=1 NODD_SECRET_KEY=$(openssl rand -hex 32) nodd serve --host 127.0.0.1
```

> [!NOTE]
> Save the `NODD_SECRET_KEY` you generate, and use the same one every time you start the server.

For HTTPS, put a reverse proxy in front. See [Reverse proxy and HTTPS](/self-hosting/reverse-proxy).

## Keep it running (systemd)

Create `/etc/systemd/system/opennodd.service`. Change the user, the paths and the `Environment=` lines:

```ini
[Unit]
Description=OpenNodd
After=network-online.target

[Service]
User=nodd
WorkingDirectory=/var/lib/opennodd
EnvironmentFile=/etc/opennodd.env
ExecStart=/usr/bin/nodd serve --host 127.0.0.1 --port 7420
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target
```

Put your settings in `/etc/opennodd.env`, one per line, for example:

```text
DATABASE_URL=postgres://nodd:a-password@localhost:5432/opennodd
NODD_PUBLIC_URL=https://nodd.example.com
NODD_INVITE_ONLY=1
NODD_SECRET_KEY=<your key>
```

Then:

```sh
sudo systemctl daemon-reload
sudo systemctl enable --now opennodd
journalctl -u opennodd -f
```

Use `which nodd` to find the right path for `ExecStart`.

## Upgrading

Install the new version of the command the same way, then restart the service. Migrations run when the server starts. Back up first. See [Backups and upgrading](/self-hosting/maintenance).
