---
title: "Deploy Paperless-ngx — Self-Hosted Document Manager & OCR"
description: "Self-host Paperless-ngx — scan, OCR, tag & search documents"
category: "Other"
url: https://railway.com/deploy/paperless-ngx-documents
---

# Deploy Paperless-ngx — Self-Hosted Document Manager & OCR

Self-host Paperless-ngx — scan, OCR, tag & search documents

**[Deploy Paperless-ngx — Self-Hosted Document Manager & OCR on Railway](https://railway.com/template/paperless-ngx-documents)**

- **Creator:** SilverBanana
- **Category:** Other

## Template content

### Paperless-ngx https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/paperless-ngx.svg

- **Image:** paperlessngx/paperless-ngx:latest
- **Public domain:** Yes

### Redis https://cdn.sanity.io/images/sy1jschh/production/0ce0bfdcfbdbf69662b1116671f97c2dd788b655-157x157.svg

- **Image:** redis:8.2
- **Start command:** `/bin/sh -c "rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH"`

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18

## Documentation

# Deploy and Host Paperless-ngx on Railway

Paperless-ngx is the leading open-source document management system — it scans, OCRs, indexes, tags, and archives your paperwork into a searchable digital archive you fully own. Feed it invoices, receipts, contracts, and letters, and it extracts the text, auto-assigns tags and correspondents, and makes everything full-text searchable. This template deploys Paperless-ngx with PostgreSQL, Redis, an admin account, and — critically — persistent storage for your documents, so your archive is live and your scans are safe, in minutes.

---

## What This Template Deploys

| Service | Purpose |
| --- | --- |
| **Paperless-ngx** | The document manager, OCR engine, web UI, and API on port `8000` |
| **PostgreSQL** | Metadata, tags, correspondents, and full-text search index |
| **Redis** | The task queue that runs OCR and background jobs |

All connect over Railway's private network. Paperless serves the UI and processes documents, PostgreSQL stores metadata and powers search, Redis queues the OCR work, and a persistent volume holds your actual document files.

---

## About Hosting

Paperless-ngx is a multi-service app, and one persistence detail is the difference between a safe archive and lost documents — this template handles it, along with the security and wiring.

**Persist the document storage — or lose your scans.** This is the critical point: Paperless writes your original files and archived PDFs to `/usr/src/paperless/media`, and its search index and config to `/usr/src/paperless/data`. Many Paperless templates don't mount a volume for these by default, so documents vanish on redeploy. This template mounts persistent storage for both, so every scan you archive is safe across redeploys and updates.

**`PAPERLESS_SECRET_KEY` is mandatory for security.** Paperless uses `PAPERLESS_SECRET_KEY` (a long random string) to sign authentication — its own docs warn that failing to set a proper secret lets third parties forge login credentials. This template generates a strong key, so your archive is secured from the first deploy.

**Redis and Postgres aren't optional — they're the engine.** Paperless queues every OCR job through Redis (a Celery task broker) so the UI stays responsive while documents process in the background, and stores all metadata and the full-text index in PostgreSQL, which handles indexing and concurrent writes far better than SQLite. This template wires both, so OCR and search work out of the box.

**Your admin account is created for you.** `PAPERLESS_ADMIN_USER` and `PAPERLESS_ADMIN_PASSWORD` bootstrap your administrator on first boot, so you skip the manual `createsuperuser` command that trips up manual installs. Set `PAPERLESS_URL` to your Railway domain so links resolve.

**OCR is CPU-intensive — size for your volume.** Text extraction (Tesseract OCR) is genuinely CPU-heavy, so large archives or many concurrent uploads benefit from more CPU and RAM. A personal archive runs fine on a modest plan; for bulk imports of thousands of documents, scale the resources. Set `PAPERLESS_OCR_LANGUAGE` to your document language for accurate extraction.

Typical cost: **~$10–15/month** on Railway for the three services, plus storage that grows with your archive (roughly 1–10 MB per document). Paperless-ngx is GPL-3.0 and free.

---

## How It Compares

| | Paperless-ngx (self-hosted) | Google Drive | Evernote | Physical files |
| --- | --- | --- | --- | --- |
| OCR + full-text search | Yes | Partial | Some | No |
| Auto tagging | Yes (ML matching) | No | Limited | No |
| Document management | Purpose-built | File storage | Notes | Manual |
| Data ownership | Full — your infra | Google | Vendor | Physical |
| Cost model | Flat infra | Tiered | Subscription | Storage space |
| Self-hostable | Yes | No | No | N/A |

Google Drive stores files but doesn't read, tag, or organize them as documents. Evernote captures notes but isn't a document archive with OCR and correspondents. Physical files can't be searched at all. Paperless-ngx's edge is a purpose-built document management system — OCR, machine-learning tagging, full-text search, and archival formats — self-hosted, so your most sensitive paperwork stays on infrastructure you own.

---

## Deploy in Under 5 Minutes

1. Click **Deploy on Railway** — Paperless, PostgreSQL, and Redis build and wire together (~4 minutes)
2. Confirm `PAPERLESS_SECRET_KEY` is set and persistent storage is mounted for media and data
3. Set `PAPERLESS_ADMIN_USER`, `PAPERLESS_ADMIN_PASSWORD`, and `PAPERLESS_URL` to your domain
4. Open your Railway URL and sign in with your admin credentials
5. Upload a document — Paperless OCRs it, tags it, and makes it searchable

Set `PAPERLESS_OCR_LANGUAGE` to your document language, and scale CPU for large imports.

---

## Common Use Cases

- **Personal paperless office** — scan and archive invoices, receipts, and letters, fully searchable
- **Financial records** — keep tax documents, statements, and receipts indexed and OCR'd
- **Data-owned archive** — keep sensitive documents on your own infrastructure, not a cloud drive

---

## Configuration

| Variable | Required | Description |
| --- | --- | --- |
| `PAPERLESS_SECRET_KEY` | Generated | Long random key signing auth — mandatory for security |
| `PAPERLESS_ADMIN_USER` | Required | Admin username, created on first boot |
| `PAPERLESS_ADMIN_PASSWORD` | Required | Admin password — set a strong value |
| `PAPERLESS_URL` | Required | Your Railway domain, so links resolve |
| `PAPERLESS_OCR_LANGUAGE` | Recommended | Document language (e.g. `eng`) for accurate OCR |
| Storage volume | Pre-set | Persistent volume for documents (media) and the search index (data) |

> **Persist storage, or lose documents.** Paperless writes files to media and its index to data — this template mounts a volume for both so scans survive redeploys. Many templates skip this. `PAPERLESS_SECRET_KEY` is mandatory for security and is generated here.

> **Postgres and Redis are required, and OCR is CPU-heavy.** Redis queues OCR jobs and Postgres powers search — both wired here. Text extraction is CPU-intensive, so scale resources for large archives.

---

## Dependencies for Paperless-ngx Hosting

- Railway account — ~$10–15/month for the three services, plus growing document storage
- PostgreSQL and Redis (both included and wired via Railway references)
- A persistent volume for document media and the search index (included)
- Optional: Tika and Gotenberg services for Office-document conversion

### Deployment Dependencies

- [Paperless-ngx GitHub Repository](https://github.com/paperless-ngx/paperless-ngx)
- [Paperless-ngx Documentation](https://docs.paperless-ngx.com/)
- [Paperless-ngx Configuration Reference](https://docs.paperless-ngx.com/configuration/)
- [Railway Private Networking](https://docs.railway.com/guides/private-networking)

### Implementation Details

The template deploys the official `paperlessngx/paperless-ngx` image on port `8000`, wired to a Railway-managed PostgreSQL database and a Redis broker over the private network. PostgreSQL is used rather than SQLite because it handles full-text search indexing and concurrent worker writes far better; Redis is required as the Celery task broker that queues OCR and scheduled jobs so the web UI stays responsive during processing.

The critical persistence detail is document storage: Paperless writes originals and archived PDFs to `/usr/src/paperless/media` and its index and configuration to `/usr/src/paperless/data`, and a volume must be mounted for these or documents are lost on redeploy — a gap in many templates that this one closes. `PAPERLESS_SECRET_KEY` is generated (a long random value the documentation requires to prevent credential forgery), and `PAPERLESS_ADMIN_USER`/`PAPERLESS_ADMIN_PASSWORD` bootstrap the admin on first boot, avoiding the manual `createsuperuser` step. `PAPERLESS_URL` is set to the Railway domain.

OCR via Tesseract is CPU-intensive, so large archives benefit from more CPU and RAM; `PAPERLESS_OCR_LANGUAGE` sets the extraction language. Storage grows at roughly 1–10 MB per document. Optional Tika and Gotenberg services add Office-document conversion. PostgreSQL and the document volume are the backup targets.

---

## Frequently Asked Questions

**Will I lose my documents on a redeploy?** Not with this template — it mounts persistent storage for both the document media and the search-index data. Many Paperless templates skip this, which loses your scans on redeploy; here your archive is safe across deploys and updates.

**Why does Paperless need Redis and Postgres?** Redis queues OCR and background jobs so the UI stays responsive, and PostgreSQL stores metadata and powers full-text search (better than SQLite for indexing and concurrency). This template wires both, so OCR and search work immediately.

**Why is OCR slow on large imports?** Text extraction with Tesseract is CPU-intensive. A personal archive is fine on a modest plan, but bulk-importing thousands of documents benefits from more CPU and RAM — scale the plan so processing keeps up.

**Does it read my scanned PDFs?** Yes — Paperless runs OCR to extract text from scans and images, then applies machine-learning matching to auto-assign tags, correspondents, and document types, making everything full-text searchable.

---

## Why Deploy Paperless-ngx on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Paperless-ngx on Railway you get a document archive with the hard parts solved — PostgreSQL and Redis wired, the secret key and admin account generated, and — crucially — persistent storage so your scans are never lost. Scan, OCR, tag, and search your documents, self-hosted on infrastructure you own.

## Similar templates

- [Rocky Linux](https://railway.com/deploy/rocky-linux) — Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀
- [Foundry Virtual Tabletop](https://railway.com/deploy/X5tR6G) — A Self-Hosted & Modern Roleplaying Platform
- [Letta Code Remote](https://railway.com/deploy/letta-code-remote) — Run a Letta Code agent 24/7. No inbound ports, just deploy.

Open this page in a browser: https://railway.com/deploy/paperless-ngx-documents
