CloudPDF
DocsPricing
Start building

Configuration reference

The server is configured entirely through environment variables. The same variables work whether you run it via npm, Docker, Compose, or Helm — only how you set them differs.

Only one variable is strictly required: CLOUDPDF_LICENSE_KEY (see Licensing). With a development key, everything else has a sensible default — a minimal server runs with just that. Any other license kind also requires CLOUDPDF_JWT_SECRET and CLOUDPDF_PASSWORD_VERIFICATION_HMAC_SECRET (plus CLOUDPDF_PASSWORD_SESSION_SERVER_SECRET when a KMS is configured) to be real random values of at least 32 bytes — the server fails closed at boot and names the variable it needs.

Licensing#

VariableDefaultDescription
CLOUDPDF_LICENSE_KEYRequired. Your license key; secret:// references resolve through the secrets providers.
CLOUDPDF_LICENSE_MODEconnected when a key is setconnected or air-gapped.

See Licensing.

Process#

VariableDefaultDescription
PORT3000Port the HTTP server listens on.
HOST0.0.0.0Interface to bind.
CLOUDPDF_WORKER_POOL_SIZEmin(2, cpus)Native PDFium worker threads. Integer, or max to use all cores. See Health & scaling.

Engine plane#

VariableDefaultDescription
CLOUDPDF_ENGINE_ISOLATIONinlinehost runs PDFium in a supervised child process: a native crash costs a sub-second engine respawn instead of the instance. See Health & scaling.
CLOUDPDF_ENGINE_SHARDS1Host mode: split the engine into K child processes (worker total must divide evenly). One crash costs 1/K of open documents.
CLOUDPDF_ENGINE_MAX_IN_FLIGHTworkers × 2Admission cap on concurrently dispatched engine jobs; beyond the bounded queue the server sheds with 503 + Retry-After.
CLOUDPDF_ENGINE_BG_MAX_IN_FLIGHT⌊workers / 2⌋Of the cap, how much background work (thumbnail warming) may occupy. 0 disables the background lane entirely.
CLOUDPDF_ENGINE_RECYCLEoff1 opts into memory-watermark engine recycling (host mode). Companion knobs: _RECYCLE_SOFT_PCT (70), _RECYCLE_HARD_PCT (85), CLOUDPDF_ENGINE_MAX_RSS_MB, CLOUDPDF_ENGINE_MAX_LIFETIME_HOURS.
CLOUDPDF_ENCODE_IN_ENGINEon0 reverts image encoding to the API process (one-release escape hatch; rasters cross the engine boundary raw).

Authentication#

VariableDefaultDescription
CLOUDPDF_JWT_SECRETdev fallbackHS256 secret used to verify document and admin tokens. Must match the secret your backend signs with. Required (≥32 bytes) under a production license; development keys fall back to a public dev value with a warning.
CLOUDPDF_API_AUTH_TOKENSComma-separated static API tokens for trusted backends and tooling (root credential for the admin plane). ≥32 bytes each under a production license.
CLOUDPDF_PASSWORD_VERIFICATION_HMAC_SECRETdev fallbackHMAC pepper for the encrypted-PDF password-verification cache — it keeps stored password proofs non-reversible. Required (≥32 bytes) under a production license, whether or not you open encrypted PDFs.
CLOUDPDF_PASSWORD_SESSION_SERVER_SECRETdev fallbackServer key material for encrypted-PDF unlock sessions. Required (≥32 bytes) under a production license when a KMS is configured; unused otherwise.
CLOUDPDF_PASSWORD_SESSION_SERVER_SECRET_IDdev-v1Label for the active session secret, recorded on each session. Changing it (or the secret) invalidates existing sessions.

See Authentication, and Encrypted-PDF secrets for what the last three protect.

Database#

VariableDefaultDescription
CLOUDPDF_DB_DRIVERsqlitesqlite or postgres.
CLOUDPDF_DB_SQLITE_PATH./data/cloudpdf.dbSQLite file path (when driver is sqlite).
CLOUDPDF_DB_URLPostgres connection string (required when driver is postgres).

See Database.

Storage (object store)#

VariableDefaultDescription
CLOUDPDF_STORAGE_KINDfsfs, s3, gcs, or azure-blob.
CLOUDPDF_STORAGE_FS_ROOT./data/objectsDirectory for stored objects (when kind is fs).
CLOUDPDF_STORAGE_S3_BUCKETBucket name (S3).
CLOUDPDF_STORAGE_S3_REGIONBucket region (S3).
CLOUDPDF_STORAGE_S3_ENDPOINTCustom endpoint for S3-compatible stores (e.g. MinIO).

See Storage.

Imports (server-side pull)#

On by default with a safe posture (HTTPS-only, public networks, 128 MiB cap). Registered connections let the server pull from your own buckets without presigning.

VariableDefaultDescription
CLOUDPDF_IMPORT_ENABLEDonSet 0 to disable the import endpoint.
CLOUDPDF_IMPORT_MAX_BYTES128 MiBPer-document transfer ceiling.
CLOUDPDF_IMPORT_TIMEOUT_MS120000Wall-clock budget per transfer attempt.
CLOUDPDF_IMPORT_MAX_CONCURRENT4Concurrent transfers per replica (sync + async).
CLOUDPDF_IMPORT_ALLOW_HTTPoffPermit http:// URL sources (dev / MinIO).
CLOUDPDF_IMPORT_ALLOW_PRIVATE_NETWORKSoffPermit private-address URL sources (dev / in-VPC).
CLOUDPDF_IMPORT_CONNECTIONSComma-separated registry of named pull sources (S3, GCS, Azure Blob, filesystem), each configured via CLOUDPDF_IMPORT_CONNECTION_* variables.

See Imports.

Engine cache#

The cache holds recently used documents and renders so repeat requests are fast. It is disposable — the server rebuilds it from the object store.

VariableDefaultDescription
CLOUDPDF_CACHE_ROOT./data/cacheCache directory.
CLOUDPDF_CACHE_MAX_BYTES4 GiBMaximum cache size before eviction.

Fonts#

VariableDefaultDescription
CLOUDPDF_FALLBACK_FONTSJSON array of fallback fonts ({ key, path, … }) for glyphs a document’s own fonts are missing.

See Fallback fonts.

Lifecycle & migrations#

VariableDefaultDescription
CLOUDPDF_AUTO_MIGRATEon for SQLite, off for PostgresApply pending migrations on boot.
CLOUDPDF_FAIL_ON_PENDINGoffRefuse to start if migrations are pending. Recommended for multi-replica deploys.
CLOUDPDF_AUTO_PROVISION_TENANToffLazily create tenant rows. Dev convenience — leave off in production.

See Migrations.

Shutdown & observability#

VariableDefaultDescription
CLOUDPDF_SHUTDOWN_TIMEOUT_MS30000Budget for closing in-flight HTTP during shutdown before teardown proceeds anyway. Keep it below your orchestrator’s kill deadline.
CLOUDPDF_SHUTDOWN_DRAIN_MS0Settle window after /readyz flips to 503 (and SSE streams end) before the listener closes — for probe-driven load balancers.
CLOUDPDF_METRICSoff1 exposes an unauthenticated Prometheus /metrics endpoint (scrape it inside your private network).

Optional adapters#

These are opt-in. You only need them for the corresponding feature.

VariableDefaultDescription
CLOUDPDF_CDN_KINDnoneSign delivery URLs via a CDN: bunny, cloud-cdn, cloudfront, azure-fd, custom-hmac.
CLOUDPDF_KMS_KINDstaticKey management for encrypted-PDF sessions: aws-kms, gcp-kms, azure-kv.
CLOUDPDF_SECRETS_PROVIDERSenvComma-separated registry of secret sources.

See CDN, KMS & secrets.

The CLI prints this whole surface at any time: cloudpdf-server —help.

Where to set these#