Skip to main content
The backend application uses environment variables for configuration. All variables should be defined in a .env file in the backend/ directory.

Database Configuration

DATABASE_URL
string
required
PostgreSQL database connection URL.Format: postgresql://USER:PASSWORD@HOST:PORT/DATABASEExample: postgresql://postgres:postgres@localhost:5432/portfolio

Email Service

RESEND_API_KEY
string
required
API key for the Resend email service used to send contact form emails.Obtain your API key at: https://resend.com/api-keysFormat: re_xxxxxxxxxxxxxxxxxxxxx
Never commit your actual RESEND_API_KEY to version control. Always use .env files and add them to .gitignore.

Authentication

ADMIN_PASSWORD
string
required
Admin password for accessing email preview endpoints.
Use a strong, unique password. This password protects access to email template previews.
JWT_SECRET
string
required
Secret key used for signing JWT tokens for authentication.Generate a secure secret:
node -e "console.log(require('crypto').randomBytes(64).toString('hex'))"
This secret must be kept confidential and should be a cryptographically random string. Never expose it in client-side code or public repositories.

Server Configuration

PORT
number
default:"3001"
The port number on which the backend server will listen.Default: 3001
NODE_ENV
string
default:"development"
Application environment mode.Values:
  • development - Uses .env file
  • production - Uses .env.production file
Default: development

Environment File Setup

The application loads different environment files based on NODE_ENV:
  • Development: Loads .env
  • Production: Loads .env.production
Refer to backend/.env.example for a template of all required variables.
Always add .env and .env.production to your .gitignore file to prevent sensitive credentials from being committed to version control.

Build docs developers (and LLMs) love