# Install the server

> Set up the Social Crawl server with Dokploy, step by step, with every command and what you should see after each step.

Source: https://crawl-docs.pdhq.win/guide/install-the-server/
Last updated: 2026-12-02

This page puts the server on a machine of your own, using [Dokploy](https://docs.dokploy.com). Dokploy builds Social Crawl from its code, runs it, gives it a web address with HTTPS, and updates it when the code changes.

> [!NOT-TESTED]
> The deploy steps below follow the repository's `docker-compose.yml` and the README. The whole stack was not started in containers while these pages were written (there was no Docker engine in the build environment), so a step may differ slightly on your machine. If one does, [Troubleshooting](https://crawl-docs.pdhq.win/guide/troubleshooting.md) covers the failures that were seen on a real Dokploy host.

## What you need before you start

- A server with Docker, where you can run Dokploy. Install Dokploy first by following its own instructions at [docs.dokploy.com](https://docs.dokploy.com).
- Two web addresses that point at that server, for example `app.example.com` (the web app) and `api.example.com` (the extension talks to this one directly).
- The Social Crawl code in a Git repository that Dokploy can reach (your copy of the repository).
- A computer with a terminal and [Node.js](https://nodejs.org) 20 or newer, to make your password's hash in step 2. Any recent Mac, Linux or Windows (with WSL or Git Bash) will do.

## Step 1: Choose your secrets

You need three values. Make them now and keep them in a password manager.

**The database password.** Letters and numbers only, because it is placed inside an address.

```bash
openssl rand -hex 24
```

You should see one line of 48 letters and digits, for example `9f2c…`. This is `POSTGRES_PASSWORD`.

**The signing secret.** It signs your login and also encrypts the WebDAV password you may save later.

```bash
openssl rand -base64 48
```

You should see one line of 64 characters. This is `JWT_SECRET`. It must be at least 32 characters.

> [!WARNING]
> Keep `JWT_SECRET` the same for the life of the install. If you change it, every login stops working and a saved WebDAV password can no longer be read, so you would have to type it again in Settings.

## Step 2: Make your password's hash

The server never stores your password. It stores a hash of it. This command makes the hash from a password you choose (at least 12 characters) without writing the password to a file:

```bash
printf '%s' 'your password here' | node -e "let s='';process.stdin.on('data',d=>s+=d).on('end',()=>{const c=require('crypto'),salt=c.randomBytes(16);c.scrypt(s.replace(/\r?\n\$/,''),salt,64,{N:32768,r:8,p:1,maxmem:67108864},(e,k)=>{if(e)throw e;console.log('scrypt:'+salt.toString('base64')+':'+k.toString('base64'))})})"
```

You should see one line that starts with `scrypt:` and is exactly 120 characters long. This is `ADMIN_PASSWORD_HASH`. Copy the whole line.

> [!TIP]
> If you have the code checked out, the project's own command makes the same hash: `printf '%s' 'your password' | yarn workspace @social-crawl/api hash-password`.

## Step 3: Create the Compose service in Dokploy

1. In Dokploy, create a project, then add a **Compose** service.
2. Set the provider to **GitHub** (or the Git provider you use), pick your Social Crawl repository and the `main` branch.
3. Set the compose path to `./docker-compose.yml`.

## Step 4: Set the environment

Open the service's **Environment** tab and paste these three lines, with your own values:

```text
POSTGRES_PASSWORD=the-48-letter-value-from-step-1
JWT_SECRET=the-64-character-value-from-step-1
ADMIN_PASSWORD_HASH=scrypt:...the whole 120-character line from step 2
```

The stack refuses to start without `JWT_SECRET` and `ADMIN_PASSWORD_HASH`. Every other setting has a default, and [Environment variables](https://crawl-docs.pdhq.win/advanced/environment-variables.md) lists them all.

## Step 5: Add the two domains

On the **Domains** tab add:

| Service | Port | Example address |
| --- | --- | --- |
| `web` | 3000 | `app.example.com` |
| `api` | 4000 | `api.example.com` |

Turn on HTTPS for both. Turn on **Auto Deploy**, so every change to the branch is built and started by itself.

## Step 6: Deploy

Press **Deploy**. Dokploy builds two images (the first build takes several minutes) and starts three containers: `db` (the database), `api` and `web`.

**What you should see:** the service's status turns to running, and the three containers are listed as healthy or running.

## Step 7: Check that it works

Open `https://api.example.com/health` in a browser. You should see:

```json
{"status":"ok"}
```

Then open `https://app.example.com`. You should see the sign-in page: the name **Social Crawl**, the line "Your saved posts, offline and in one place.", and a single **Password** box.

> [!SCREEN] The sign-in page: a centred card on the app's soft background with the Social Crawl name and logo, the line "Your saved posts, offline and in one place.", one Password field and a sign-in button.

Go on to [Sign in for the first time](https://crawl-docs.pdhq.win/guide/first-sign-in.md).

## Using plain Docker without Dokploy

The compose file was written for Dokploy. It joins an external network named `dokploy-network` and publishes no ports, because Dokploy's proxy reaches the containers by name. To run it without Dokploy you would:

1. Create the network once: `docker network create dokploy-network`.
2. Put the three values in a `.env` file next to `docker-compose.yml`.
3. Run `docker compose up -d --build`.
4. Put a reverse proxy of your own in front, sending your web address to the `web` container (port 3000) and your API address to the `api` container (port 4000), with HTTPS.

> [!NOT-TESTED]
> This plain Docker route was not run. Use Dokploy if you can.

## Optional next steps

- Keep files in Cloudflare R2 instead of on the server's disk: [Storage: WebDAV and R2](https://crawl-docs.pdhq.win/guide/storage-webdav-and-r2.md).
- Use another PostgreSQL such as Neon: [Copy the database](https://crawl-docs.pdhq.win/guide/database-copy.md).
- Make captions from the sound of videos: [Captions and transcripts](https://crawl-docs.pdhq.win/guide/captions-and-transcripts.md).
- Back up the two Docker volumes: `bundles` holds your saved files and `pgdata` holds the database.
