Skip to main content

Environment Variables

To configure your application, set the following environment variables. These variables control various aspects of the application's behavior, including URLs, database connections, and third-party integrations.

Application Configuration

VariableExampleDescription
APP_URLhttps://docmost.example.comThe base URL of your application. It is optional, but useful for correct email links.
APP_SECRETLONG_SECRET_KEYA secure key for application security (32 chars minimum). Generate with openssl rand -hex 32.
PORT3000The port on which the application will run.
JWT_TOKEN_EXPIRES_IN30dThe expiration time for JSON Web Tokens (JWT). The default is 30 days.

Database Configuration

VariableExampleDescription
DATABASE_URLpostgresql://postgres:password@localhost:5432/docmost?schema=publicThe connection URL for your PostgreSQL database.

Redis Configuration

VariableExampleDescription
REDIS_URLredis://127.0.0.1:6379The connection URL for your Redis server.
Format: redis://username:password@host:port/db-number

Storage Configuration

Using Local storage

VariableExampleDescription
STORAGE_DRIVERlocalThe storage driver to use for file storage.

Using S3-compatible storage

VariableExampleDescription
STORAGE_DRIVERs3The storage driver to use for file storage.
AWS_S3_ACCESS_KEY_IDYour AWS S3 access key ID.
AWS_S3_SECRET_ACCESS_KEYYour AWS S3 secret access key.
AWS_S3_REGIONThe region where your S3 bucket is located.
AWS_S3_BUCKETThe name of your S3 bucket.
AWS_S3_ENDPOINTThe endpoint URL for your S3 service (optional).
AWS_S3_FORCE_PATH_STYLEtrueForce the request to use path-style addressing (optional).

Using Azure Blob Storage

VariableExampleDescription
STORAGE_DRIVERazureThe storage driver to use for file storage.
AZURE_STORAGE_ACCOUNT_NAMEYour Azure Storage account name.
AZURE_STORAGE_ACCOUNT_KEYYour Azure Storage account key.
AZURE_STORAGE_CONTAINERThe name of your blob container.

Storage file upload limits

VariableExampleDescription
FILE_UPLOAD_SIZE_LIMIT50mbThe maximum file size per upload. Default is 50mb.
FILE_IMPORT_SIZE_LIMIT100mbThe maximum file import size limit. Default is 200mb.

Email Configuration

Using SMTP

VariableExampleDescription
MAIL_DRIVERsmtpThe mail driver to use for sending emails.
SMTP_HOSTsmtp.example.comThe SMTP server to use for sending emails.
SMTP_PORT587The port to use for the SMTP server.
SMTP_USERNAMEThe username for the SMTP server.
SMTP_PASSWORDThe password for the SMTP server.
SMTP_SECUREfalseUse TLS when connecting to the server, typically for port 465. Defaults to false. See nodemailer 'secure' for details
MAIL_FROM_ADDRESS[email protected]The email address that emails will be sent from.
MAIL_FROM_NAMEDocmostThe name that emails will be sent from.

Using Postmark

VariableExampleDescription
MAIL_DRIVERpostmarkThe mail driver to use for sending emails.
POSTMARK_TOKENThe token for Postmark, if using Postmark as the MAIL_DRIVER.
MAIL_FROM_ADDRESS[email protected]The email address that emails will be sent from.
MAIL_FROM_NAMEDocmostThe name that emails will be sent from.

AI Configuration (Enterprise)

VariableExampleDescription
AI_DRIVERopenaiThe AI provider to use. Options: openai, openai-compatible, gemini, ollama.
AI_EMBEDDING_MODELtext-embedding-3-smallThe model used for generating vector embeddings.
AI_COMPLETION_MODELgpt-4o-miniThe model used for answering questions.
AI_EMBEDDING_DIMENSION1536Optional. The vector dimension for pgvector. Auto-detected for preset models. Supported values: 768, 1024, 1536, 2000, 3072.
AI_EMBEDDING_SUPPORTS_MRLtrueOptional. Controls whether the dimensions parameter is sent to the embedding model API. Defaults to model preset if available, otherwise true. Set to false for models that do not accept a dimensions parameter.
OPENAI_API_KEYsk-proj-xxxxxYour OpenAI API key. Required when AI_DRIVER is openai or openai-compatible.
OPENAI_API_URLhttps://api.openai.com/v1Optional. Custom API endpoint for Azure OpenAI or compatible providers.
GEMINI_API_KEYAIzaSyxxxxxYour Google Gemini API key. Required when AI_DRIVER=gemini.
OLLAMA_API_URLhttp://localhost:11434The URL of your Ollama instance. Required when AI_DRIVER=ollama.

DRAW.IO (Diagrams.net) configuration

The default Draw.io embed url is https://embed.diagrams.net.

VariableExampleDescription
DRAWIO_URLhttps://embed.diagrams.netYour custom draw.io server url.

Search Configuration (Enterprise)

VariableExampleDescription
SEARCH_DRIVERtypesenseThe search engine driver to use. Default is postgres (database search). typesense is a purpose-built search engine with typo-tolerant, fast search available in Enterprise edition.
TYPESENSE_URLhttp://localhost:8108The URL of your Typesense server. Required when SEARCH_DRIVER=typesense. (Enterprise)
TYPESENSE_API_KEYyour_api_key_hereYour Typesense API key with read/write permissions. Required when SEARCH_DRIVER=typesense. (Enterprise)
TYPESENSE_LOCALEenThe locale for text analysis and search. Default is en. Examples: en, es, fr, de, ja, zh, ko, etc. See Typesense supported languages for full list. (Enterprise)

Security

Iframe embedding

By default, Docmost blocks other origins from embedding your instance in an <iframe>. This protects users against clickjacking attacks where a malicious site loads Docmost in a hidden frame and tricks signed-in users into clicking destructive actions. Out of the box, Docmost responds with X-Frame-Options: SAMEORIGIN, so only pages served from your own Docmost origin can iframe Docmost content.

Public shared pages (/share/...) are exempt from this restriction and can always be embedded from any origin. Shares are public, read-only content with no authenticated actions, so they have no clickjacking surface.

If you legitimately need to embed the rest of Docmost (the app itself) inside another tool, for example an intranet portal or LMS, use the variables below.

VariableExampleDescription
IFRAME_EMBED_ALLOWEDfalseMaster switch for external iframe embedding. Defaults to false, which emits X-Frame-Options: SAMEORIGIN. Set to true to permit external embedding.
IFRAME_ALLOWED_ORIGINShttps://intranet.example.com,https://portal.example.comOptional comma-separated allowlist. Only consulted when IFRAME_EMBED_ALLOWED=true. When provided, Docmost emits Content-Security-Policy: frame-ancestors 'self' <origins> instead of X-Frame-Options. When empty, embedding is allowed from any origin.

Telemetry

We anonymously collect the active version, user count, page count, space and workspace count.

VariableExampleDescription
DISABLE_TELEMETRYtrueTo disable telemetry