Papermerge
Document management system with OCR.
Overview
Papermerge is an open-source document management system designed to transform paper-based workflows into digital, searchable archives. Built with Django, it provides OCR capabilities to automatically extract text from scanned documents, PDFs, and images, making them fully searchable and organizable through tags, metadata, and folder structures. The system excels at handling invoices, receipts, contracts, and other business documents that need long-term storage and quick retrieval.
This stack combines Papermerge with PostgreSQL and Redis to create a robust document processing pipeline. PostgreSQL serves as the primary database, storing document metadata, user information, and OCR-extracted text with full-text search capabilities. Redis handles background job queuing for OCR processing, caching frequently accessed data, and managing user sessions. When documents are uploaded, Redis queues OCR tasks while PostgreSQL indexes the extracted text for lightning-fast searches across thousands of documents.
Small businesses, accounting firms, legal offices, and home users will find this combination ideal for going paperless. The PostgreSQL backend ensures document metadata integrity and supports complex searches across multiple fields, while Redis accelerates the OCR workflow and improves response times. This setup scales from personal document archives to business-grade document repositories handling thousands of files monthly.
Key Features
- Tesseract OCR engine integration for automatic text extraction from scanned PDFs and images
- PostgreSQL full-text search with ranking across document content and metadata
- Redis-powered background job processing for non-blocking OCR operations
- Document versioning and audit trails stored in PostgreSQL with ACID compliance
- Multi-format support including PDF, TIFF, PNG, and JPEG with OCR preprocessing
- Tag-based organization with PostgreSQL foreign key relationships for data integrity
- User permission system with role-based access control backed by PostgreSQL
- Watched folder functionality for automatic document ingestion and OCR processing
Common Use Cases
- 1Small business invoice and receipt digitization with automated OCR processing
- 2Legal document archives requiring full-text search across case files and contracts
- 3Accounting firm client document management with secure multi-tenant access
- 4Home office paperless workflow for tax documents, warranties, and personal records
- 5Medical practice patient file digitization with HIPAA-compliant document storage
- 6Real estate agencies organizing property documents, contracts, and inspection reports
- 7HR departments managing employee records, contracts, and compliance documentation
Prerequisites
- Minimum 2GB RAM (1GB+ for PostgreSQL, 512MB+ for Redis, 512MB+ for Papermerge OCR processing)
- Docker and Docker Compose installed with container runtime support
- Port 12000 available for Papermerge web interface access
- Basic understanding of environment variables and password management
- At least 10GB free disk space for document storage and PostgreSQL data
- Knowledge of PostgreSQL administration for database maintenance and backups
For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
docker-compose.yml
docker-compose.yml
1services: 2 papermerge: 3 image: papermerge/papermerge:latest4 container_name: papermerge5 restart: unless-stopped6 environment: 7 PAPERMERGE__SECURITY__SECRET_KEY: ${SECRET_KEY}8 PAPERMERGE__DATABASE__URL: postgresql://papermerge:${DB_PASSWORD}@postgres:5432/papermerge9 PAPERMERGE__REDIS__URL: redis://redis:6379/010 DJANGO_SUPERUSER_USERNAME: admin11 DJANGO_SUPERUSER_PASSWORD: ${ADMIN_PASSWORD}12 volumes: 13 - papermerge_media:/app/media14 ports: 15 - "12000:80"16 depends_on: 17 - postgres18 - redis19 networks: 20 - papermerge2122 postgres: 23 image: postgres:15-alpine24 container_name: papermerge-postgres25 restart: unless-stopped26 environment: 27 POSTGRES_USER: papermerge28 POSTGRES_PASSWORD: ${DB_PASSWORD}29 POSTGRES_DB: papermerge30 volumes: 31 - postgres_data:/var/lib/postgresql/data32 networks: 33 - papermerge3435 redis: 36 image: redis:alpine37 container_name: papermerge-redis38 restart: unless-stopped39 networks: 40 - papermerge4142volumes: 43 papermerge_media: 44 postgres_data: 4546networks: 47 papermerge: 48 driver: bridge.env Template
.env
1SECRET_KEY=changeme-secret-key2DB_PASSWORD=changeme3ADMIN_PASSWORD=changemeUsage Notes
- 1Docs: https://docs.papermerge.io/
- 2Access at http://localhost:12000 - login with admin / ADMIN_PASSWORD
- 3OCR extracts text from scanned PDFs automatically
- 4Upload PDFs via web UI or watched folders
- 5Tagging, metadata, full-text search
- 6Good for digitizing paper documents, invoices, receipts
Individual Services(3 services)
Copy individual services to mix and match with your existing compose files.
papermerge
papermerge:
image: papermerge/papermerge:latest
container_name: papermerge
restart: unless-stopped
environment:
PAPERMERGE__SECURITY__SECRET_KEY: ${SECRET_KEY}
PAPERMERGE__DATABASE__URL: postgresql://papermerge:${DB_PASSWORD}@postgres:5432/papermerge
PAPERMERGE__REDIS__URL: redis://redis:6379/0
DJANGO_SUPERUSER_USERNAME: admin
DJANGO_SUPERUSER_PASSWORD: ${ADMIN_PASSWORD}
volumes:
- papermerge_media:/app/media
ports:
- "12000:80"
depends_on:
- postgres
- redis
networks:
- papermerge
postgres
postgres:
image: postgres:15-alpine
container_name: papermerge-postgres
restart: unless-stopped
environment:
POSTGRES_USER: papermerge
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: papermerge
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- papermerge
redis
redis:
image: redis:alpine
container_name: papermerge-redis
restart: unless-stopped
networks:
- papermerge
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 papermerge:5 image: papermerge/papermerge:latest6 container_name: papermerge7 restart: unless-stopped8 environment:9 PAPERMERGE__SECURITY__SECRET_KEY: ${SECRET_KEY}10 PAPERMERGE__DATABASE__URL: postgresql://papermerge:${DB_PASSWORD}@postgres:5432/papermerge11 PAPERMERGE__REDIS__URL: redis://redis:6379/012 DJANGO_SUPERUSER_USERNAME: admin13 DJANGO_SUPERUSER_PASSWORD: ${ADMIN_PASSWORD}14 volumes:15 - papermerge_media:/app/media16 ports:17 - "12000:80"18 depends_on:19 - postgres20 - redis21 networks:22 - papermerge2324 postgres:25 image: postgres:15-alpine26 container_name: papermerge-postgres27 restart: unless-stopped28 environment:29 POSTGRES_USER: papermerge30 POSTGRES_PASSWORD: ${DB_PASSWORD}31 POSTGRES_DB: papermerge32 volumes:33 - postgres_data:/var/lib/postgresql/data34 networks:35 - papermerge3637 redis:38 image: redis:alpine39 container_name: papermerge-redis40 restart: unless-stopped41 networks:42 - papermerge4344volumes:45 papermerge_media:46 postgres_data:4748networks:49 papermerge:50 driver: bridge51EOF5253# 2. Create the .env file54cat > .env << 'EOF'55SECRET_KEY=changeme-secret-key56DB_PASSWORD=changeme57ADMIN_PASSWORD=changeme58EOF5960# 3. Start the services61docker compose up -d6263# 4. View logs64docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/papermerge/run | bashTroubleshooting
- OCR processing fails silently: Check Redis connectivity and ensure sufficient memory allocation for Tesseract processing
- Document uploads timeout on large files: Increase Django file upload limits and Redis memory configuration in environment variables
- PostgreSQL connection refused errors: Verify database initialization completed and check POSTGRES_PASSWORD matches PAPERMERGE__DATABASE__URL credentials
- Search results incomplete or missing: Run Django management commands to rebuild PostgreSQL full-text search indexes
- Redis memory usage grows continuously: Configure Redis maxmemory policy and enable key expiration for cached OCR results
- Papermerge container fails to start: Ensure SECRET_KEY environment variable is set and database migration completed successfully
Community Notes
Loading...
Loading notes...
Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
Ad Space
Shortcuts: C CopyF FavoriteD Download