Skip to content

Self-Hosted PDF Mail Merge

Why enterprises choose on-premise document automation — data sovereignty, compliance, air-gapped networks, and unlimited processing without per-page fees.

Why Enterprises Choose On-Premise Document Automation

Every day, enterprises generate thousands of personalized documents — contracts, invoices, compliance reports, employee communications, and regulatory filings. Each one contains sensitive business data: customer names, financial figures, legal terms, health records, and personally identifiable information.

For most organizations, cloud-based SaaS tools handle this well. But for enterprises operating under strict data governance, regulatory compliance, or security mandates, sending document data to third-party servers is not an option. That is where self-hosted document automation becomes essential.

Tip

Mergram Enterprise runs the same full-featured mail merge platform as the SaaS version, deployed on your own infrastructure via Docker. No data ever leaves your network.


The Business Case for Self-Hosted

Data Sovereignty and Residency

Data sovereignty laws require that certain types of data remain within specific geographic or organizational boundaries. The EU’s GDPR, for example, imposes strict requirements on transferring personal data outside the European Economic Area. Industry regulations in healthcare (HIPAA), financial services (SOX, PCI DSS), and government (FedRAMP, ITAR) impose similar constraints.

When you use a cloud SaaS tool for document generation, your template files, spreadsheet data, and generated documents all pass through the vendor’s infrastructure. Even if the vendor is compliant, the data path itself may violate your organization’s data residency policies or contractual obligations with clients.

Self-hosted deployment eliminates this concern entirely:

Air-Gapped and Restricted Networks

Some environments have no internet access at all — classified government facilities, industrial control networks, research labs, and certain financial trading floors. In these environments, cloud tools are simply not usable, regardless of their compliance certifications.

Mergram Enterprise is designed for this scenario:

Info

The license key is a JWT signed with RS256 (asymmetric RSA 2048-bit). The public key is embedded in the application — no shared secret exists on your server. Verification happens entirely locally at startup.

Cost Predictability at Scale

Cloud SaaS tools typically charge per document, per page, or per merge row. For enterprises generating tens of thousands of documents monthly, these per-unit costs accumulate significantly. A company processing 50,000 invoices per month at even $0.01 per row would spend $6,000 annually — and that cost scales linearly with volume.

Self-hosted deployment changes the cost model fundamentally:

FactorCloud SaaSSelf-Hosted
Per-document cost$0.01–$0.10 per row$0 — unlimited
Monthly capsYes — throttled or blockedNo — limited only by hardware
Billing surprisesPossible with volume spikesNone — fixed license fee
Cost at scaleGrows linearlyFixed, regardless of volume
Infrastructure costIncluded in per-unit priceYour server cost (often lower)

For high-volume use cases — batch invoicing, regulatory filing, insurance claims processing — the break-even point between SaaS per-unit pricing and self-hosted infrastructure cost is often reached within the first few months.

Regulatory Compliance

Different industries face different compliance requirements, but the common thread is control over data:

RegulationRequirementHow Self-Hosted Helps
GDPRPersonal data must stay within EEA or equivalentData never leaves your infrastructure — no cross-border transfer
HIPAAPHI must be protected with administrative, physical, and technical safeguardsSelf-hosted deployment + encryption at rest + access controls
SOXFinancial reporting controls and audit trailsFull job logging, role-based access, retention policies
ITARDefense-related data must not leave the USOn-premise deployment within US borders, no external transmission
PCI DSSCardholder data must be protectedDocument generation happens within your secure network
SOC 2Service organization controls for securityYou control the infrastructure, encryption, and access

Warning

Self-hosted deployment is a necessary but not sufficient condition for compliance. You must also implement proper network security, access controls, encryption at rest, and audit procedures as required by your specific regulatory framework.


How Self-Hosted Document Automation Works

Architecture

Mergram Enterprise deploys as a set of Docker containers on your infrastructure:

ComponentPurpose
API ServerWeb application and REST API (port 5555)
WorkerBackground job processing (PDF merges, email campaigns)
PostgreSQLDatabase for templates, jobs, users, configuration

The entire stack runs within an isolated Docker network. Only the API server port is exposed — the database and worker have no external access.

Deployment Model

# Deploy with Docker Compose
docker compose -f docker-compose.enterprise.yaml up -d

The application supports any infrastructure you choose:

Storage Options

OptionWhen to Use
Local filesystemDevelopment, small deployments, single-server setups
S3-compatibleProduction — AWS S3, MinIO, Cloudflare R2, Google Cloud Storage

Storage is configured via environment variables. Switch between local and S3 without code changes.

Authentication

Control which login methods are available:

ModeConfiguration
Email + GoogleMERGRAM_AUTH_PROVIDERS=google,email (default)
Email onlyMERGRAM_AUTH_PROVIDERS=email — no external identity provider needed
Google onlyMERGRAM_AUTH_PROVIDERS=google

The initial admin user is seeded automatically on first deployment. No external identity provider is required.


Enterprise Features

Security and Encryption

Integration and Automation

The REST API enables programmatic document generation from any system:

curl -X POST https://mergram.yourcompany.com/api/v1/merge \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"templateId": "...", "data": [...]}'

Common enterprise integration patterns:

Tip

Use Zapier or Make.com as a middleware layer between legacy systems and Mergram. Many enterprise platforms support webhook notifications that can trigger document generation workflows without custom API development.

Retention and Data Lifecycle

Self-hosted deployments give you full control over document retention:

Team Management


Who Benefits Most from Self-Hosted

IT Directors and CISOs

Maintain complete control over your document generation pipeline. No third-party data access, no vendor lock-in for your data, no compliance gaps from external data processing. Deploy on infrastructure you already manage, behind firewalls and network policies you already control.

Compliance Officers

Self-hosted deployment provides a clear, auditable data path. Templates, source data, and generated documents all reside within your security perimeter. Retention policies are enforced on your schedule. Job logs provide the audit trail regulators require.

DevOps Teams

Mergram Enterprise is a standard Docker deployment — no exotic dependencies, no special infrastructure requirements. Integrate it into your existing CI/CD pipeline, monitoring stack, and backup procedures. Health check endpoints (/health, /health/worker) plug into Prometheus, Datadog, or your preferred monitoring tool.

Procurement Teams

Fixed-cost licensing eliminates usage-based billing surprises. No per-page charges, no monthly caps, no overage fees. The total cost of ownership is the license fee plus your infrastructure cost — both predictable and budgetable.


Industries That Require Self-Hosted

IndustryRegulatory DriverTypical Documents
Government & DefenseITAR, FedRAMP, data sovereigntyCitizen correspondence, classified reports, procurement forms
HealthcareHIPAA, HITECHPatient forms, prescriptions, discharge summaries
Financial ServicesSOX, PCI DSS, GLBARegulatory filings, audit reports, client statements
LegalAttorney-client privilege, court rulesContracts, NDA, court filings, engagement letters
InsuranceState regulations, NAICClaims forms, policy documents, underwriting reports
Energy & UtilitiesNERC CIP, critical infrastructureCompliance reports, safety documentation, permit applications
PharmaceuticalFDA 21 CFR Part 11Clinical trial forms, regulatory submissions, batch records
EducationFERPA, state privacy lawsStudent records, transcripts, enrollment forms

Migration from Cloud to Self-Hosted

Organizations typically move to self-hosted document automation in three phases:

  1. Evaluation — Test the self-hosted deployment on a staging server with real document templates and data. Verify merge output matches the SaaS version (it does — same codebase).

  2. Parallel operation — Run self-hosted alongside existing cloud tools for a transition period. Migrate templates and workflows gradually. Use the REST API to integrate with existing automation.

  3. Full migration — Decommission cloud document tools once all workflows are running on the self-hosted instance. Configure production security hardening (TLS termination, database SSL, secrets management).

Info

Mergram Enterprise runs the identical codebase as the SaaS version. Every feature works the same — visual field editor, QR codes, barcodes, image fields, custom fonts, email campaigns, PDF encryption, template management, and merge history. The only differences are unlimited generation and self-managed infrastructure.


Getting Started

Mergram Enterprise deploys in minutes on any infrastructure you control. Contact the Mergram team for a license key, deployment assistance, and integration guidance tailored to your compliance requirements.

Key features

Self-Hosted

Deploy on your infrastructure — on-prem, AWS, Azure, GCP, or air-gapped

Unlimited Processing

No credits, no per-page fees, no monthly caps — scale with your hardware

REST API

Full programmatic access for automation and system integration

Data Encryption

AES-256-GCM for credentials, per-document PDF password protection

Retention Policies

Auto-purge documents on your schedule for compliance

Role-Based Access

Team permissions, API key management, and full job logging

Frequently asked questions

Why would we choose self-hosted over a cloud SaaS solution?
Self-hosted document automation keeps all data on your infrastructure. For organizations subject to GDPR, HIPAA, SOC 2, or industry-specific data residency requirements, on-premise deployment eliminates the risk of sensitive documents traversing third-party servers. It also enables operation in air-gapped or restricted networks where internet access is unavailable or prohibited.
Do we need an internet connection to run Mergram Enterprise?
No. After initial deployment, Mergram Enterprise runs entirely offline. The license is verified locally at startup using an embedded RSA public key — no phone-home, no outbound connections, no usage telemetry. This makes it suitable for air-gapped environments and classified networks.
How does pricing work for self-hosted deployments?
Self-hosted deployments use a fixed license model with unlimited document generation. There are no per-page charges, no monthly caps, and no usage-based billing. You process as many PDFs and emails as your hardware supports.
Can we integrate self-hosted Mergram with our existing systems?
Yes. Mergram Enterprise includes a full REST API with API key authentication. Trigger merges programmatically from your CRM, ERP, HR system, or any application that can make HTTP calls. You can also use Zapier or Make.com as middleware for legacy systems.
What authentication methods are supported?
Self-hosted deployments support email/password authentication out of the box — no dependency on external identity providers. You can also enable Google OAuth alongside it, or use Google-only. Authentication is configured with a single environment variable.
Where is document data stored?
All document data stays on your infrastructure. Templates, generated PDFs, and uploaded files are stored on your local filesystem or your own S3-compatible storage (AWS S3, MinIO, Cloudflare R2). The database runs on your PostgreSQL instance. Nothing is sent to Mergram's servers.

Ready to try it yourself?

Start merging PDFs in minutes — free account required, no credit card needed.

Related articles