learn

Environment variables

Every variable the code reads, with placeholders only.

Placeholder values only — never commit real secrets. The backend .env.example does not list every name the code reads; the tables below merge the example files with the names found in the sources.

Backend

VariableRequiredPurpose
PORTYesPort the server listens on.
MONGO_URIYesMongoDB connection string.
JWT_SECRETYesSigns and verifies session tokens.
FRONTEND_URLFor OAuthRedirect target after GitHub login.
REDIS_URI / REDIS_URLNoRedis URL; falls back to localhost, then no Redis.
CLOUDINARY_CLOUD_NAMENoCloudinary account; without all three keys uploads stay local.
CLOUDINARY_API_KEYNoCloudinary key.
CLOUDINARY_API_SECRETNoCloudinary secret.
GITHUB_CLIENT_IDFor OAuthGitHub OAuth app id.
GITHUB_CLIENT_SECRETFor OAuthGitHub OAuth secret.
EMAIL_USER / GMAIL_USERFor contact mailGmail sender account.
EMAIL_PASS / GMAIL_APP_PASSWORDFor contact mailGmail app password.
EMAIL_RECEIVERNoContact form recipient; defaults to the sender.
API_BASE_URLNoBase for local upload URLs; defaults to localhost plus port.

Frontend

VariableRequiredPurpose
VITE_API_URLYesREST base, e.g. http://localhost:5000/api.
VITE_SOCKET_URLNoSocket base; derived from the API URL when missing.

Service modules fall back to /api and the socket service to localhost when the variables are missing, but set both explicitly in any hosted setup. The login and signup screens also build the GitHub OAuth entry URL from VITE_API_URL.

Sources: backend/.env.example, frontend/.env.example (documented at commit cdef8af)

On this page