Skip to main content

Overview

This guide will walk you through setting up Documenso on your local machine for development. Documenso is a full-stack document signing platform built with React Router (Remix), TypeScript, Prisma, and PostgreSQL.

Prerequisites

Before you begin, ensure you have the following installed:
  • Node.js v22.0.0 or higher
  • npm v10.7.0 or higher
  • PostgreSQL database (or Docker to run one)
  • Git for version control
  • Docker and Docker Compose (optional, but recommended)
The fastest way to get started is using the developer quickstart, which uses Docker Compose to set up all dependencies.
1

Fork and clone the repository

First, fork the Documenso repository to your GitHub account.Then clone your fork:
git clone https://github.com/<your-username>/documenso
cd documenso
2

Set up environment variables

Copy the example environment file:
cp .env.example .env
The default values in .env.example are configured to work with the Docker Compose setup out of the box.
3

Run the developer quickstart

The quickest way to get everything running:
npm run d
This single command:
  • Installs all dependencies
  • Starts PostgreSQL, MinIO (S3), and Inbucket (email) in Docker
  • Runs database migrations
  • Seeds the database with test data
  • Compiles translations
  • Starts the development server
Alternatively, you can run these steps individually:
# Install dependencies and start Docker services
npm run dx

# Start the development server
npm run dev
4

Access the application

Once everything is running, you can access:
5

Create your account

Navigate to http://localhost:3000/signup and register a new user account to get started.

Manual Setup

If you prefer to set up services manually without Docker:
1

Fork and clone the repository

git clone https://github.com/<your-username>/documenso
cd documenso
2

Install dependencies

npm install
3

Configure environment variables

Create a .env file from the example:
cp .env.example .env
Update the following required variables:
# Authentication
NEXTAUTH_SECRET="your-random-secret-here"

# Application URLs
NEXT_PUBLIC_WEBAPP_URL="http://localhost:3000"

# Database (adjust for your PostgreSQL setup)
NEXT_PRIVATE_DATABASE_URL="postgres://user:password@localhost:5432/documenso"
NEXT_PRIVATE_DIRECT_DATABASE_URL="postgres://user:password@localhost:5432/documenso"

# SMTP (for local development, use a service like Inbucket or MailHog)
NEXT_PRIVATE_SMTP_FROM_NAME="Documenso"
NEXT_PRIVATE_SMTP_FROM_ADDRESS="noreply@documenso.com"
NEXT_PRIVATE_SMTP_HOST="localhost"
NEXT_PRIVATE_SMTP_PORT=2500

# Encryption keys (generate random strings)
NEXT_PRIVATE_ENCRYPTION_KEY="your-32-char-encryption-key"
NEXT_PRIVATE_ENCRYPTION_SECONDARY_KEY="your-32-char-secondary-key"
4

Set up the database

Run Prisma migrations to create the database schema:
npm run prisma:migrate-dev
See the Database Setup guide for more details.
5

Compile translations

npm run translate:compile
6

Start the development server

npm run dev
The application will be available at http://localhost:3000
7

Seed the database (optional)

Create test data including a test user and sample document:
npm run prisma:seed

Development Workflow

Available Scripts

The following npm scripts are available for development:
# Start the main development server (Remix app)
npm run dev

# Start the documentation site
npm run dev:docs

# Start the OpenPage API
npm run dev:openpage-api

Project Structure

Documenso is organized as a monorepo:
documenso/
├── apps/
│   └── remix/              # Main application (React Router)
├── packages/
│   ├── api/               # API routes and endpoints
│   ├── app-tests/         # E2E tests (Playwright)
│   ├── auth/              # Authentication logic
│   ├── email/             # Email templates (react-email)
│   ├── lib/               # Shared utilities and helpers
│   ├── prisma/            # Database schema and migrations
│   ├── trpc/              # tRPC API definitions
│   └── ui/                # Shared UI components (shadcn/ui)
├── docker/
│   ├── development/       # Docker Compose for local dev
│   ├── production/        # Production Docker setup
│   └── Dockerfile
└── .env.example          # Environment variables template

Environment Variables

Key environment variables you’ll work with:

Required Variables

VariableDescriptionExample
NEXTAUTH_SECRETSecret for NextAuth.js session encryptionyour-random-secret
NEXT_PUBLIC_WEBAPP_URLPublic URL of your applicationhttp://localhost:3000
NEXT_PRIVATE_DATABASE_URLPostgreSQL connection stringpostgres://user:pass@localhost:5432/db
NEXT_PRIVATE_DIRECT_DATABASE_URLDirect database connection (non-pooled)Same as above for local dev
NEXT_PRIVATE_SMTP_FROM_NAMEEmail sender nameDocumenso
NEXT_PRIVATE_SMTP_FROM_ADDRESSEmail sender addressnoreply@documenso.com
NEXT_PRIVATE_ENCRYPTION_KEY32+ character encryption keyRandom string
NEXT_PRIVATE_ENCRYPTION_SECONDARY_KEY32+ character secondary keyRandom string

Development Services (with Docker Compose)

VariableDefaultDescription
NEXT_PRIVATE_SMTP_HOST127.0.0.1SMTP server (Inbucket)
NEXT_PRIVATE_SMTP_PORT2500SMTP port
NEXT_PRIVATE_UPLOAD_ENDPOINThttp://127.0.0.1:9002MinIO S3 endpoint
NEXT_PRIVATE_UPLOAD_BUCKETdocumensoS3 bucket name
NEXT_PRIVATE_UPLOAD_ACCESS_KEY_IDdocumensoMinIO access key
NEXT_PRIVATE_UPLOAD_SECRET_ACCESS_KEYpasswordMinIO secret key

Optional Features

VariableDescription
NEXT_PRIVATE_GOOGLE_CLIENT_IDGoogle OAuth client ID
NEXT_PRIVATE_GOOGLE_CLIENT_SECRETGoogle OAuth client secret
NEXT_PRIVATE_MICROSOFT_CLIENT_IDMicrosoft OAuth client ID
NEXT_PRIVATE_MICROSOFT_CLIENT_SECRETMicrosoft OAuth client secret
NEXT_PRIVATE_STRIPE_API_KEYStripe API key for billing
GOOGLE_VERTEX_API_KEYGoogle Vertex AI API key for AI features
See the .env.example file for a complete list of environment variables.

Using Environment Variables in Scripts

If you need to run a script with environment variables loaded, use the with:env wrapper:
npm run with:env -- <your-command>
This loads environment variables from both .env and .env.local files.

Common Issues

Not Receiving Emails

When using the Docker quickstart, emails are captured by Inbucket instead of being sent. Access the web UI at http://localhost:9000 to view all outgoing emails.

Environment Variables Not Loading

If you’re running package scripts directly, wrap them with with:env:
npm run with:env -- npx prisma studio

Port Already in Use

If port 3000 is already in use, you can change it by setting the PORT environment variable:
PORT=3001 npm run dev
Or update it in your .env file:
PORT=3001

Database Connection Issues

If you’re having trouble connecting to the database:
  1. Ensure PostgreSQL is running (check Docker with docker ps if using Docker Compose)
  2. Verify the connection string in NEXT_PRIVATE_DATABASE_URL
  3. Check that the database exists
  4. Ensure the database port (default 54320 for Docker) is not blocked

Next Steps

Video Tutorial

Prefer a video walkthrough? Check out this setup guide: Documenso Local Setup

Alternative Development Environments

Gitpod

Launch a ready-to-use development environment in your browser: Open in Gitpod

DevContainer (VS Code)

Open the project in a VS Code DevContainer: Open in DevContainer