OpnForm uses two .env files for configuration: one for the Laravel backend located in the api directory, and one for the Nuxt front-end located in the client directory.

Backend Environment Variables

The following environment variables are used to configure the Laravel application (OpnForm’s API).

Dedicated guides

There are dedicated configuration pages available for more detailed setup instructions on specific topics:

Configuration Environment Variables

Variable NameDescription
H_CAPTCHA_SITE_KEYSite key for hCaptcha integration.
H_CAPTCHA_SECRET_KEYSecret key for hCaptcha integration.
RE_CAPTCHA_SITE_KEYSite key for reCAPTCHA integration.
RE_CAPTCHA_SECRET_KEYSecret key for reCAPTCHA integration.
OPEN_AI_API_KEYAPI key for accessing OpenAI services.
UNSPLASH_ACCESS_KEYAccess key for Unsplash API.
UNSPLASH_SECRET_KEYSecret key for Unsplash API.
GOOGLE_CLIENT_IDClient ID for Google OAuth.
GOOGLE_CLIENT_SECRETClient secret for Google OAuth.
GOOGLE_REDIRECT_URLRedirect URL for Google OAuth.
GOOGLE_AUTH_REDIRECT_URLAuthentication redirect URL for Google OAuth.
GOOGLE_FONTS_API_KEYAPI key for accessing Google Fonts.
FRONT_URLPublic facing URL of the front-end.
FRONT_API_SECRETShared secret with the front-end.
TELEGRAM_BOT_IDID of your Telegram bot for notifications.
TELEGRAM_BOT_TOKENAuthentication token for your Telegram bot.
JWT_TTLTime to live for JSON Web Tokens (JWT).
JWT_SECRETSecret key used to sign JWTs.
JWT_SKIP_IP_UA_VALIDATIONSet to true to disable JWT IP and User Agent validation (defaults to false). Useful for dynamic IPs.

User Options Environment Variables

Variable NameDescription
ADMIN_EMAILSComma-separated list of admin email addresses.
TEMPLATE_EDITOR_EMAILSComma-separated list of template editor emails.
EXTRA_PRO_USERS_EMAILSComma-separated list of extra pro user emails.
MODERATOR_EMAILSComma-separated list of moderator email addresses.
SHOW_OFFICIAL_TEMPLATESSet to false to hide official templates from OpnForm’s template gallery (defaults to true).

PHP Configuration Environment Variables

Variable NameDescription
PHP_MEMORY_LIMITMaximum amount of memory a script may consume.
PHP_MAX_EXECUTION_TIMEMaximum time in seconds a script is allowed to run.
PHP_UPLOAD_MAX_FILESIZEMaximum size of an uploaded file.
PHP_POST_MAX_SIZEMaximum size of POST data that PHP will accept.

These PHP configuration variables are particularly important when handling file uploads and processing large amounts of data. If any of these variables are not set, PHP will use its default values from the php.ini configuration. When using Docker, these values are set in the docker-compose.yml file. For non-Docker installations, you’ll need to configure these values in your PHP configuration (php.ini) file.

Database Configuration Environment Variables

These variables are essential for connecting the Laravel backend to your database.

Variable NameDescription
DB_CONNECTIONThe database driver (e.g., mysql, pgsql).
DB_HOSTThe database server host (e.g., 127.0.0.1).
DB_PORTThe database server port (e.g., 3306).
DB_DATABASEThe name of the database.
DB_USERNAMEThe username for connecting to the database.
DB_PASSWORDThe password for the database user.

Front-end Environment Variables

Variable NameDescription
NUXT_PUBLIC_APP_URLPublic facing URL of the Nuxt application.
NUXT_PUBLIC_API_BASEBase URL for the Laravel API.
NUXT_PUBLIC_H_CAPTCHA_SITE_KEYSite key for hCaptcha integration on the front-end.
NUXT_PUBLIC_RE_CAPTCHA_SITE_KEYSite key for reCAPTCHA integration on the front-end.
NUXT_API_SECRETShared secret key between Nuxt and Laravel backend.
NUXT_PUBLIC_ROOT_REDIRECT_URLPermanently redirects users visiting the root path (/), /integrations, or any non-existent (404) page to the specified URL. This effectively “hides” OpnForm’s public pages while keeping forms and admin functionality accessible. See Subdomain Redirect Configuration for detailed setup and examples.

The easiest way to get started with OpnForm is through our official managed service in the Cloud. It takes just 1 minute to try out the builder for free, with high availability, backups, security, and maintenance all managed for you.

Docker Environment Variables

When running OpnForm with Docker, there are some important considerations for handling environment variables:

Updating Environment Variables

When changing environment variables in your .env files, you need to recreate the containers for the changes to take effect. Simply restarting the containers is not sufficient as Docker only loads environment variables when containers are created.

To apply new environment variable changes:

# For a specific service (e.g., ui)
docker compose down ui
docker compose up -d ui

# For all services
docker compose down
docker compose up -d

A simple docker compose restart will not reload environment variables from your .env files. You must use down and up commands to recreate the containers.