# Docmost

Docmost is a collaborative wiki and documentation tool with real-time editing

[Docmost](https://github.com/docmost/docmost) is an open source alternative to Confluence and Notion. It is a pnpm and Nx monorepo with a NestJS server and a React client, and it needs PostgreSQL and Redis. The real-time collaboration server is built into the main process, so a single web process is all it takes to run.

## Requirements

Create a PostgreSQL database and a Redis database on the app&#39;s Databases tab. Hatchbox exposes them as `DATABASE_URL` and `REDIS_URL`, which are the variable names Docmost expects. Docmost requires PostgreSQL 16 or newer.

Docmost&#39;s Docker image builds on Node.js 26 and the project requires Node.js 24 or newer. The repository has no Node version file, so Hatchbox installs the latest Node.js, which is what you want here.

## Repository

Fork the Docmost repository and add the scripts below, then point Hatchbox at your fork:

```
https://github.com/docmost/docmost.git
```

Use the `main` branch. Releases are tagged on `main` (for example `v0.96.0`), so create a branch from a tag in your fork if you want to pin a version.

## Environment Variables

```
APP_URL=https://docs.example.com
APP_SECRET=&lt;at least 32 random characters&gt;
STORAGE_DRIVER=local
```

Generate `APP_SECRET` with `openssl rand -hex 32`; Docmost refuses to start with a secret shorter than 32 characters. `DATABASE_URL`, `REDIS_URL` and `PORT` are set by Hatchbox.

Do not set `NODE_ENV` in the Environment tab. The build needs Docmost&#39;s dev dependencies (Nx, the Nest and Vite CLIs), and the start command sets `NODE_ENV=production` itself.

To send invitation and notification emails, add `MAIL_DRIVER=smtp` with `SMTP_HOST`, `SMTP_PORT`, `SMTP_USERNAME`, `SMTP_PASSWORD` and `MAIL_FROM_ADDRESS`, or `MAIL_DRIVER=postmark` with `POSTMARK_TOKEN`. To store attachments in S3 instead of on disk, set `STORAGE_DRIVER=s3` with `AWS_S3_ACCESS_KEY_ID`, `AWS_S3_SECRET_ACCESS_KEY`, `AWS_S3_REGION`, `AWS_S3_BUCKET` and optionally `AWS_S3_ENDPOINT`.

## Build Scripts

Hatchbox runs `pnpm install` automatically because the repository has a `pnpm-lock.yaml`. The scripts below add the compile step and keep uploads outside the release directory.

### .hatchbox/pre-build

```
#!/usr/bin/env bash
set -e

mkdir -p &quot;$DIR/shared/data/storage&quot;
ln -s &quot;$DIR/shared/data&quot; data
```

### .hatchbox/post-build

```
#!/usr/bin/env bash
set -e

NX_DAEMON=false pnpm build
```

`pnpm build` runs the Nx build for the editor packages, the server and the client. `NX_DAEMON=false` stops Nx from leaving a background daemon running after every deploy. Database migrations are not part of the build: the server applies pending migrations itself every time it starts in production.

## Processes

Add one process on the Processes tab:

1. `web` on your web servers: `pnpm start`

This runs the compiled server from `apps/server` and listens on the `PORT` Hatchbox provides.

## First Login

Open your domain. Docmost shows a setup form where you create the workspace and its first user, who becomes the workspace owner. After that, invite members from the workspace settings.

## Notes

With `STORAGE_DRIVER=local`, attachments are written to `data/storage` relative to the app root, which the pre-build script points at `shared/data`. Local storage only works on a single web server. Use the S3 driver if you run more than one.

The server runs migrations on boot, so a deploy that changes the schema upgrades the database on the first start of the new release.

To upgrade, merge upstream `main` (or a newer release tag) into your fork and deploy.
