Skip to main content
All runtime configuration for NodeForgeCMS lives in a single .env file inside the server/ directory. This file controls how the Node.js backend connects to MySQL and Redis, how it signs authentication tokens, what domain it serves assets from, and how it dispatches email. Getting these values right before your first deployment is essential — misconfigured variables are the most common source of startup failures.

Create the Environment File

The repository ships with a fully annotated example file. Start by copying it:
Then open server/.env in your editor and fill in the values for your environment. The sections below explain every variable group.

Database (MySQL 8.x)

NodeForgeCMS requires MySQL 8.x. Configure the connection to match your MySQL instance:
Create the database if it doesn’t already exist:

Authentication

NodeForgeCMS uses JSON Web Tokens (JWT) to authenticate admin sessions. The secret is used to sign and verify every token issued by the server.
Use a strong, randomly generated secret in production. A weak or guessable JWT_SECRET puts every admin session at risk. Generate a value with at least 32 random characters — for example, using OpenSSL:
Never commit this value to source control.

Redis (7.x)

NodeForgeCMS uses Redis for session caching and queue management. Redis 7.x is required.
If you’re running Redis locally without authentication, you can leave REDIS_USERNAME and REDIS_PASSWORD empty.

Server

These variables tell NodeForgeCMS what public-facing URL it is running on. They are used to generate absolute links, redirect URLs, and asset paths.
Set these to your actual production domain before deploying. If you’re using separate subdomains, SERVER_HOST should point to your main domain and IMG_HOST to wherever /uploads is served from.

Email (Optional)

NodeForgeCMS can send outbound email for contact form submissions and notifications. Email configuration is optional but required if you want contact form functionality to work.
Email settings are optional. If you leave them blank, the CMS will start normally but contact form submissions will not be delivered. Configure these values if your site uses the built-in contact form.

Supported Email Services

The USER_EMAIL_SERVICE variable is passed directly to Nodemailer’s well-known services list. Supported values include: Set USER_EMAIL_SERVICE to the string that matches your provider. If your provider isn’t in the well-known list, you can configure a custom SMTP transport — refer to the Nodemailer documentation for advanced SMTP options.