Documenso

Manual Deployment

Deploy Documenso on a Linux server without Docker using Node.js and systemd.

This guide is a community contribution and may not always reflect the latest changes. If you encounter issues, please refer to the Docker or Docker Compose guides which are actively maintained.

Prerequisites

  • Node.js 20 or later
  • npm
  • PostgreSQL 14 or later
  • A Linux server (for systemd service setup)

Install and Build

Clone the repository

git clone https://github.com/documenso/documenso.git

Configure environment variables

Navigate to the documenso folder and create a .env file:

cp .env.example .env

Open the .env file and configure the required variables:

NEXTAUTH_SECRET="your-secret-here"
NEXT_PRIVATE_ENCRYPTION_KEY="your-encryption-key-min-32-chars"
NEXT_PRIVATE_ENCRYPTION_SECONDARY_KEY="your-secondary-key-min-32-chars"
NEXT_PUBLIC_WEBAPP_URL="https://your-domain.com"
NEXT_PRIVATE_INTERNAL_WEBAPP_URL="http://localhost:3000"
NEXT_PRIVATE_DATABASE_URL="postgresql://user:password@localhost:5432/documenso"
NEXT_PRIVATE_DIRECT_DATABASE_URL="postgresql://user:password@localhost:5432/documenso"
NEXT_PRIVATE_SMTP_FROM_NAME="Documenso"
NEXT_PRIVATE_SMTP_FROM_ADDRESS="noreply@your-domain.com"

If you use a reverse proxy in front of Documenso, set NEXT_PUBLIC_WEBAPP_URL to the public URL that users will access.

Install dependencies and build

npm ci
npm run build
npm run prisma:migrate-deploy

Start the application

npm run start

The server starts on localhost:3000 by default. To use a different port, set the PORT environment variable in your .env file:

PORT=3500

Run as a systemd Service

Create a service file to run Documenso as a background service on Linux:

# /etc/systemd/system/documenso.service

[Unit]
Description=Documenso
After=network.target

[Service]
Type=simple
User=www-data
WorkingDirectory=/var/www/documenso
EnvironmentFile=/var/www/documenso/.env
ExecStart=/usr/bin/node apps/remix/build/server/main.js
TimeoutSec=15
Restart=always

[Install]
WantedBy=multi-user.target

The EnvironmentFile directive loads your .env file, so configuration (including PORT) is managed in one place. Alternatively, you can set environment variables directly in the service file with Environment= directives.

Enable and start the service:

sudo systemctl enable documenso
sudo systemctl start documenso

Reverse Proxy with Nginx

A minimal Nginx configuration for proxying to Documenso:

server {
    listen 80;
    server_name your-domain.com;

    location / {
        proxy_pass http://localhost:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_cache_bypass $http_upgrade;
    }
}

For production, configure SSL termination with Let's Encrypt or your preferred certificate provider.


See Also

On this page